]> granicus.if.org Git - php/commitdiff
MFH (#26056: Warnings while compiling exif.c)
authorMarcus Boerger <helly@php.net>
Sat, 8 Nov 2003 14:16:14 +0000 (14:16 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 8 Nov 2003 14:16:14 +0000 (14:16 +0000)
ext/exif/exif.c

index c130fbc44a74f9f6bae91ab88bf96c5da99ff092..2e6c9c91da90db8707c143b9cfce3b9827938d08 100644 (file)
@@ -1301,7 +1301,7 @@ static char *exif_get_sectionname(int section)
        return "";
 }
 
-static const tag_table_type exif_get_tag_table(int section)
+static tag_table_type exif_get_tag_table(int section)
 {
        switch(section) {
                case SECTION_FILE:      return &tag_table_IFD[0];
@@ -1525,7 +1525,7 @@ static int exif_file_sections_free(image_info_type *ImageInfo)
 /* {{{ exif_iif_add_value
  Add a value to image_info
 */
-static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC)
+static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC)
 {
        size_t idex;
        void *vptr;
@@ -1662,7 +1662,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
 */
 static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC)
 {
-       exif_iif_add_value(image_info, section_index, name, tag, format, length, value, image_info->motorola_intel TSRMLS_CC);
+       exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel TSRMLS_CC);
 }
 /* }}} */
 
@@ -1819,7 +1819,7 @@ static void exif_iif_free(image_info_type *image_info, int section_index) {
 static void add_assoc_image_info(pval *value, int sub_array, image_info_type *image_info, int section_index TSRMLS_DC)
 {
        char    buffer[64], *val, *name, uname[64];
-       int     i, ap, l, b, idx=0, done, unknown=0;
+       int     i, ap, l, b, idx=0, unknown=0;
 #ifdef EXIF_DEBUG
        int     info_tag;
 #endif
@@ -1839,7 +1839,6 @@ static void add_assoc_image_info(pval *value, int sub_array, image_info_type *im
                }
 
                for(i=0; i<image_info->info_list[section_index].count; i++) {
-                       done       = 0;
                        info_data  = &image_info->info_list[section_index].list[i];
 #ifdef EXIF_DEBUG
                        info_tag   = info_data->tag; /* conversion */
@@ -2218,7 +2217,7 @@ static char * exif_get_markername(int marker)
 #endif
 /* }}} */
 
-/* {{{ proto string|false exif_tagname(index)
+/* {{{ proto string exif_tagname(index)
        Get headername for index or false if not defined */
 PHP_FUNCTION(exif_tagname)
 {
@@ -2713,7 +2712,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
                        // JPEG does not use absolute pointers instead its pointers are relative to the start
                        // of the TIFF header in APP1 section.
                        */
-                       if (offset_val<0 || offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM)) {
+                       if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM)) {
                                if (value_ptr < dir_entry) {
                                        /* we can read this if offset_val > 0 */
                                        /* some files have their values in other parts of the file */
@@ -3113,7 +3112,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
 {
        int section, sn;
        int marker = 0, last_marker = M_PSEUDO, comment_correction=1;
-       int ll, lh;
+       unsigned int ll, lh;
        uchar *Data;
        size_t fpos, size, got, itemlen;
        jpeg_sof_info  sof_info;
@@ -3176,7 +3175,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
                Data[0] = (uchar)lh;
                Data[1] = (uchar)ll;
 
-               got = php_stream_read(ImageInfo->infile, Data+2, itemlen-2); /* Read the whole section. */
+               got = php_stream_read(ImageInfo->infile, (char*)(Data+2), itemlen-2); /* Read the whole section. */
                if (got != itemlen-2) {
                        exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, "error reading from file: got=x%04X(=%d) != itemlen-2=x%04X(=%d)", got, got, itemlen-2, itemlen-2);
                        return FALSE;
@@ -3194,7 +3193,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
                                        size = ImageInfo->FileSize - fpos;
                                        sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL);
                                        Data = ImageInfo->file.list[sn].data;
-                                       got = php_stream_read(ImageInfo->infile, Data, size);
+                                       got = php_stream_read(ImageInfo->infile, (char*)Data, size);
                                        if (got != size) {
                                                EXIF_ERRLOG_FILEEOF
                                                return FALSE;
@@ -3265,7 +3264,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC)
  * scan JPEG in thumbnail (memory) */
 static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC)
 {
-       uchar           c, *data = ImageInfo->Thumbnail.data;
+       uchar           c, *data = (uchar*)ImageInfo->Thumbnail.data;
        int             n, marker;
        size_t          length=2, pos=0;
        jpeg_sof_info   sof_info;
@@ -3362,7 +3361,7 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
                exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2);
 #endif
                php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */
-               php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data, 2);
+               php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2);
                num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel);
                dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/;
                if (ImageInfo->FileSize >= dir_offset+dir_size) {
@@ -3372,8 +3371,8 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
                        if (exif_file_sections_realloc(ImageInfo, sn, dir_size TSRMLS_CC)) {
                                return FALSE;
                        }
-                       php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+2, dir_size-2);
-                       /*exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/
+                       php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+2), dir_size-2);
+                       /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/
                        next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel);
 #ifdef EXIF_DEBUG
                        exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF done, next offset x%04X", next_offset);
@@ -3461,7 +3460,7 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
 #ifdef EXIF_DEBUG
                                        exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF: filesize(x%04X), IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size);
 #endif
-                                       php_stream_read(ImageInfo->infile, ImageInfo->file.list[sn].data+dir_size, ifd_size-dir_size);
+                                       php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+dir_size), ifd_size-dir_size);
 #ifdef EXIF_DEBUG
                                        exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "read from TIFF, done");
 #endif
@@ -3524,8 +3523,8 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
                                                exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, "next IFD: %s done", exif_get_sectionname(sub_section_index));
 #endif
                                        } else {
-                                               if (!exif_process_IFD_TAG(ImageInfo, dir_entry,
-                                                                                                 ImageInfo->file.list[sn].data-dir_offset,
+                                               if (!exif_process_IFD_TAG(ImageInfo, (char*)dir_entry,
+                                                                                                 (char*)(ImageInfo->file.list[sn].data-dir_offset),
                                                                                                  ifd_size, 0, section_index, 0, tag_table TSRMLS_CC)) {
                                                        return FALSE;
                                                }
@@ -3582,7 +3581,7 @@ static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC)
 
        if (ImageInfo->FileSize >= 2) {
                php_stream_seek(ImageInfo->infile, 0, SEEK_SET);
-               php_stream_read(ImageInfo->infile, file_header, 2);
+               php_stream_read(ImageInfo->infile, (char*)file_header, 2);
                if ((file_header[0]==0xff) && (file_header[1]==M_SOI)) {
                        ImageInfo->FileType = IMAGE_FILETYPE_JPEG;
                        if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) {
@@ -3722,7 +3721,7 @@ static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_t
 }
 /* }}} */
 
-/* {{{ proto array|false exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]])
+/* {{{ proto array exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]])
    Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails */
 PHP_FUNCTION(exif_read_data)
 {
@@ -3915,7 +3914,7 @@ PHP_FUNCTION(exif_read_data)
 }
 /* }}} */
 
-/* {{{ proto string|false exif_thumbnail(string filename [, &width, &height [, &imagetype]])
+/* {{{ proto string exif_thumbnail(string filename [, &width, &height [, &imagetype]])
    Reads the embedded thumbnail */
 PHP_FUNCTION(exif_thumbnail)
 {