[libbluray-devel] C90 compat fixes

Petri Hintukainen git at videolan.org
Mon Jun 20 16:59:39 CEST 2016


libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sat Jun 18 15:01:02 2016 +0300| [32248ed811d548a2c950f30bebad12f9e427e17c] | committer: Petri Hintukainen

C90 compat fixes

> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=32248ed811d548a2c950f30bebad12f9e427e17c
---

 examples/udfls.c         |   15 ++++++++++++---
 src/default_blockinput.c |    4 ++--
 src/ecma167.c            |    4 +++-
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/examples/udfls.c b/examples/udfls.c
index 03bf77d..3f0d031 100644
--- a/examples/udfls.c
+++ b/examples/udfls.c
@@ -41,15 +41,24 @@ static int _lsdir(udfread *udf, const char *path)
         if (!strcmp(dirent.d_name, ".") || !strcmp(dirent.d_name, "..")) continue;
 
         if (dirent.d_type == UDF_DT_DIR) {
+            char *next_dir;
+
             printf("\t\t %s%s\n", path, dirent.d_name);
-            char *next_dir = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 2);
+
+            next_dir = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 2);
             sprintf(next_dir, "%s%s/",  path, dirent.d_name);
+
             _lsdir(udf, next_dir);
+
             free(next_dir);
         } else {
-            char *file = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 1);
+            char *file;
+            UDFFILE *fp;
+
+            file = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 1);
             sprintf(file, "%s%s",  path, dirent.d_name);
-            UDFFILE *fp = udfread_file_open(udf, file);
+
+            fp = udfread_file_open(udf, file);
             printf("%16" PRId64 " %s%s\n",  udfread_file_size(fp), path, dirent.d_name);
             udfread_file_close(fp);
             free(file);
diff --git a/src/default_blockinput.c b/src/default_blockinput.c
index 34ebdd1..ac4d671 100644
--- a/src/default_blockinput.c
+++ b/src/default_blockinput.c
@@ -109,12 +109,12 @@ static uint32_t _def_size(udfread_block_input *p_gen)
 
 static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32_t nblocks, int flags)
 {
-    (void)flags;
     default_block_input *p = (default_block_input *)p_gen;
-
     size_t bytes, got;
     off_t  pos;
 
+    (void)flags;
+
     bytes = (size_t)nblocks * UDF_BLOCK_SIZE;
     got   = 0;
     pos   = (off_t)lba * UDF_BLOCK_SIZE;
diff --git a/src/ecma167.c b/src/ecma167.c
index f7ab66c..b7b87a6 100644
--- a/src/ecma167.c
+++ b/src/ecma167.c
@@ -122,6 +122,8 @@ void decode_partition(const uint8_t *p, struct partition_descriptor *pd)
 /* Logical Volume Descriptor (ECMA 167 3/10.6) */
 void decode_logical_volume(const uint8_t *p, struct logical_volume_descriptor *lvd)
 {
+    size_t map_size;
+
     lvd->block_size = _get_u32(p + 212);
 
     decode_entity_id(p + 216, &lvd->domain_id);
@@ -132,7 +134,7 @@ void decode_logical_volume(const uint8_t *p, struct logical_volume_descriptor *l
     lvd->num_partition_maps         = _get_u32(p + 268);
 
     /* XXX cut long maps */
-    uint32_t map_size = lvd->partition_map_lable_length;
+    map_size = lvd->partition_map_lable_length;
     if (map_size > sizeof(lvd->partition_map_table)) {
         map_size = sizeof(lvd->partition_map_table);
     }



More information about the libbluray-devel mailing list