[libbluray-devel] examples: fix compiling with c++ compiler

hpi1 git at videolan.org
Wed Feb 18 10:54:33 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Feb 18 11:50:37 2015 +0200| [6b95e7b69379467af0081fecb1718705c53e46d1] | committer: hpi1

examples: fix compiling with c++ compiler

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=6b95e7b69379467af0081fecb1718705c53e46d1
---

 src/examples/bd_info.c   |    2 +-
 src/examples/mpls_dump.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/examples/bd_info.c b/src/examples/bd_info.c
index 093ab22..de85d20 100644
--- a/src/examples/bd_info.c
+++ b/src/examples/bd_info.c
@@ -51,7 +51,7 @@ static const char *_hex2str(const uint8_t *data, size_t len)
     static char *str = NULL;
     size_t i;
 
-    str = realloc(str, 2*len + 1);
+    str = (char*)realloc(str, 2*len + 1);
     *str = 0;
 
     for (i = 0; i < len; i++) {
diff --git a/src/examples/mpls_dump.c b/src/examples/mpls_dump.c
index f95dd09..5cd7a17 100644
--- a/src/examples/mpls_dump.c
+++ b/src/examples/mpls_dump.c
@@ -158,7 +158,7 @@ _mk_path(const char *base, const char *sub)
 {
     size_t n1 = strlen(base);
     size_t n2 = strlen(sub);
-    char *result = malloc(n1 + n2 + strlen(DIR_SEP) + 1);
+    char *result = (char*)malloc(n1 + n2 + strlen(DIR_SEP) + 1);
     strcpy(result, base);
     strcat(result, DIR_SEP);
     strcat(result, sub);
@@ -753,11 +753,11 @@ main(int argc, char *argv[])
             }
         }
         if (dir != NULL) {
-            char **dirlist = calloc(10001, sizeof(char*));
+            char **dirlist = (char**)calloc(10001, sizeof(char*));
             struct dirent *ent;
             int jj = 0;
             for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) {
-                  dirlist[jj++] = strcpy(malloc(strlen(ent->d_name)), ent->d_name);
+                dirlist[jj++] = strcpy((char*)malloc(strlen(ent->d_name)), ent->d_name);
             }
             qsort(dirlist, jj, sizeof(char*), _qsort_str_cmp);
             for (jj = 0; dirlist[jj] != NULL; jj++) {



More information about the libbluray-devel mailing list