changeset 1129:c59fe7000c95 trunk

[svn] Fully respect pointer signedness in libmp4ff.
author chainsaw
date Sat, 03 Jun 2006 15:29:45 -0700
parents 69b1707d83a5
children b60f95fa6dc8
files Plugins/Input/aac/mp4ff/mp4atom.c Plugins/Input/aac/mp4ff/mp4ffint.h Plugins/Input/aac/mp4ff/mp4meta.c Plugins/Input/aac/mp4ff/mp4tagupdate.c Plugins/Input/aac/mp4ff/mp4util.c
diffstat 5 files changed, 34 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/aac/mp4ff/mp4atom.c	Sat Jun 03 12:19:34 2006 -0700
+++ b/Plugins/Input/aac/mp4ff/mp4atom.c	Sat Jun 03 15:29:45 2006 -0700
@@ -31,15 +31,15 @@
 #include "drms.h"
 
 /* parse atom header size */
-int32_t mp4ff_atom_get_size(const int8_t *data)
+int32_t mp4ff_atom_get_size(const uint8_t *data)
 {
     uint32_t result;
     uint32_t a, b, c, d;
 
-    a = (uint8_t)data[0];
-    b = (uint8_t)data[1];
-    c = (uint8_t)data[2];
-    d = (uint8_t)data[3];
+    a = data[0];
+    b = data[1];
+    c = data[2];
+    d = data[3];
 
     result = (a<<24) | (b<<16) | (c<<8) | d;
     //if (result > 0 && result < 8) result = 8;
@@ -182,7 +182,7 @@
 {
     uint64_t size;
     int32_t ret;
-    int8_t atom_header[8];
+    uint8_t atom_header[8];
 
     ret = mp4ff_read_data(f, atom_header, 8);
     if (ret != 8)
--- a/Plugins/Input/aac/mp4ff/mp4ffint.h	Sat Jun 03 12:19:34 2006 -0700
+++ b/Plugins/Input/aac/mp4ff/mp4ffint.h	Sat Jun 03 15:29:45 2006 -0700
@@ -238,10 +238,10 @@
 int64_t mp4ff_position(const mp4ff_t *f);
 int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position);
 int32_t mp4ff_truncate(mp4ff_t * f);
-char * mp4ff_read_string(mp4ff_t * f,uint32_t length);
+unsigned char * mp4ff_read_string(mp4ff_t * f,uint32_t length);
 
 /* mp4atom.c */
-int32_t mp4ff_atom_get_size(const int8_t *data);
+int32_t mp4ff_atom_get_size(const uint8_t *data);
 int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1,
                                   const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2);
 uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b, const int8_t c, const int8_t d);
@@ -272,7 +272,7 @@
 /* mp4meta.c */
 int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value);
 int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value);
-int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name);
+int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, unsigned char **name);
 int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size);
 int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
 int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size);
--- a/Plugins/Input/aac/mp4ff/mp4meta.c	Sat Jun 03 12:19:34 2006 -0700
+++ b/Plugins/Input/aac/mp4ff/mp4meta.c	Sat Jun 03 15:29:45 2006 -0700
@@ -158,7 +158,7 @@
     return 0;
 }
 
-int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name)
+int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, unsigned char **name)
 {
     char *tag_names[] = {
         "unknown", "title", "artist", "writer", "album",
@@ -186,7 +186,7 @@
     default: tag_idx = 0; break;
     }
 
-	*name = strdup(tag_names[tag_idx]);
+	*name = (unsigned char*)strdup(tag_names[tag_idx]);
 
     return 0;
 }
@@ -196,10 +196,9 @@
     uint8_t atom_type;
     uint8_t header_size = 0;
     uint64_t subsize, sumsize = 0;
-    char * name = NULL;
-	char * data = NULL;
-	uint32_t done = 0;
-
+    unsigned char * name = NULL;
+    unsigned char * data = NULL;
+    uint32_t done = 0;
 
     while (sumsize < size)
     {
@@ -280,7 +279,7 @@
 		if (!done)
 		{
 			if (name == NULL) mp4ff_set_metadata_name(f, parent_atom_type, &name);
-			if (name) mp4ff_tag_add_field(&(f->tags), name, data);
+			if (name) mp4ff_tag_add_field(&(f->tags), (char*)name, (char*)data);
 		}
 
 		free(data);
--- a/Plugins/Input/aac/mp4ff/mp4tagupdate.c	Sat Jun 03 12:19:34 2006 -0700
+++ b/Plugins/Input/aac/mp4ff/mp4tagupdate.c	Sat Jun 03 15:29:45 2006 -0700
@@ -128,7 +128,7 @@
 	bufptr = membuffer_get_ptr(buf);
 	if (bufptr==0) return 0;
 	
-	if ((unsigned)mp4ff_read_data(src,(char*)bufptr + oldsize,bytes)!=bytes)
+	if ((unsigned)mp4ff_read_data(src,(unsigned char*)bufptr + oldsize,bytes)!=bytes)
 	{
 		membuffer_set_error(buf);
 		return 0;
@@ -383,7 +383,7 @@
 	uint64_t atom_offset = base;
 	for(;;)
 	{
-		char atom_name[4];
+		unsigned char atom_name[4];
 		uint32_t atom_size;
 
 		mp4ff_set_position(f,atom_offset);
@@ -603,7 +603,7 @@
     /* copy moov atom to end of the file */
     if (ff->last_atom != ATOM_MOOV)
     {
-        char *free_data = "free";
+        unsigned char *free_data = (unsigned char*)"free";
 
         /* rename old moov to free */
         mp4ff_set_position(ff, ff->moov_offset + 4);
@@ -611,14 +611,14 @@
 	
         mp4ff_set_position(ff, ff->file_size);
 		mp4ff_write_int32(ff,new_moov_size + 8);
-		mp4ff_write_data(ff,"moov",4);
+		mp4ff_write_data(ff,(unsigned char*)"moov",4);
 		mp4ff_write_data(ff, new_moov_data, new_moov_size);
     }
 	else
 	{
         mp4ff_set_position(ff, ff->moov_offset);
 		mp4ff_write_int32(ff,new_moov_size + 8);
-		mp4ff_write_data(ff,"moov",4);
+		mp4ff_write_data(ff,(unsigned char*)"moov",4);
 		mp4ff_write_data(ff, new_moov_data, new_moov_size);
 	}
 
--- a/Plugins/Input/aac/mp4ff/mp4util.c	Sat Jun 03 12:19:34 2006 -0700
+++ b/Plugins/Input/aac/mp4ff/mp4util.c	Sat Jun 03 15:29:45 2006 -0700
@@ -105,13 +105,13 @@
 {
     uint32_t result;
     uint32_t a, b, c, d;
-    int8_t data[4];
+    uint8_t data[4];
     
     mp4ff_read_data(f, data, 4);
-    a = (uint8_t)data[0];
-    b = (uint8_t)data[1];
-    c = (uint8_t)data[2];
-    d = (uint8_t)data[3];
+    a = data[0];
+    b = data[1];
+    c = data[2];
+    d = data[3];
 
     result = (a<<24) | (b<<16) | (c<<8) | d;
     return (uint32_t)result;
@@ -121,12 +121,12 @@
 {
     uint32_t result;
     uint32_t a, b, c;
-    int8_t data[4];
+    uint8_t data[4];
     
     mp4ff_read_data(f, data, 3);
-    a = (uint8_t)data[0];
-    b = (uint8_t)data[1];
-    c = (uint8_t)data[2];
+    a = data[0];
+    b = data[1];
+    c = data[2];
 
     result = (a<<16) | (b<<8) | c;
     return (uint32_t)result;
@@ -136,19 +136,19 @@
 {
     uint32_t result;
     uint32_t a, b;
-    int8_t data[2];
+    uint8_t data[2];
     
     mp4ff_read_data(f, data, 2);
-    a = (uint8_t)data[0];
-    b = (uint8_t)data[1];
+    a = data[0];
+    b = data[1];
 
     result = (a<<8) | b;
     return (uint16_t)result;
 }
 
-char * mp4ff_read_string(mp4ff_t * f,uint32_t length)
+unsigned char * mp4ff_read_string(mp4ff_t * f,uint32_t length)
 {
-	char * str = (char*)malloc(length + 1);
+	unsigned char * str = (unsigned char*)malloc(length + 1);
 	if (str!=0)
 	{
 		if ((uint32_t)mp4ff_read_data(f,str,length)!=length)