@@ -534,28 +534,27 @@ static char * exif_get_tagname(int tag_num, char *ret, int len)
534
534
#ifdef EXIF_DEBUG
535
535
static unsigned char * exif_char_dump ( unsigned char * addr , int len , int hex )
536
536
{
537
- static unsigned char buf [1024 + 1 ];
538
- int c , i , p = 0 , n = hex ? 5 : 3 ;
539
-
540
- for (i = 0 ; i < len && p + n <=sizeof (buf ); i ++ )
541
- {
542
- if ( i %64 == 0 ) buf [p ++ ] = '\n' ;
543
- c = * addr ++ ;
544
- if ( hex )
545
- {
546
- sprintf (buf + p ,"%02X " ,c );
547
- p += 3 ;
548
- } else {
549
- if (c >=32 )
550
- {
551
- buf [p ++ ] = c ;
552
- } else {
553
- buf [p ++ ] = '?' ;
554
- }
555
- }
556
- }
557
- buf [sizeof (buf )- 1 ]= 0 ;
558
- return buf ;
537
+ static unsigned char buf [1024 + 1 ];
538
+ int c , i , p = 0 , n = hex ? 5 : 3 ;
539
+
540
+ for (i = 0 ; i < len && p + n <=sizeof (buf ); i ++ )
541
+ {
542
+ if (i %64 == 0 )
543
+ buf [p ++ ] = '\n' ;
544
+ c = * addr ++ ;
545
+ if (hex ) {
546
+ sprintf (buf + p ,"%02X " ,c );
547
+ p += 3 ;
548
+ } else {
549
+ if (c >=32 ) {
550
+ buf [p ++ ] = c ;
551
+ } else {
552
+ buf [p ++ ] = '?' ;
553
+ }
554
+ }
555
+ }
556
+ buf [sizeof (buf )- 1 ]= 0 ;
557
+ return buf ;
559
558
}
560
559
#endif
561
560
/* }}} */
@@ -792,12 +791,12 @@ typedef struct {
792
791
#define SECTION_THUMBNAIL 4
793
792
#define SECTION_COMMENT 5
794
793
#define SECTION_APP0 6
795
- #define SECTION_EXIF 7
796
- #define SECTION_FPIX 8
794
+ #define SECTION_EXIF 7
795
+ #define SECTION_FPIX 8
797
796
#define SECTION_GPS 9
798
797
#define SECTION_INTEROP 10
799
798
#define SECTION_APP12 11
800
- #define SECTION_COUNT 12
799
+ #define SECTION_COUNT 12
801
800
802
801
#define FOUND_FILE (1<<SECTION_FILE)
803
802
#define FOUND_COMPUTED (1<<SECTION_COMPUTED)
@@ -815,18 +814,18 @@ typedef struct {
815
814
static char * exif_get_sectionname (int section )
816
815
{
817
816
switch (section ) {
818
- case SECTION_FILE : return "FILE" ;
819
- case SECTION_COMPUTED : return "COMPUTED" ;
820
- case SECTION_ANY_TAG : return "ANY_TAG" ;
821
- case SECTION_IFD0 : return "IFD0" ;
822
- case SECTION_THUMBNAIL : return "THUMBNAIL" ;
823
- case SECTION_COMMENT : return "COMMENT" ;
824
- case SECTION_APP0 : return "APP0" ;
825
- case SECTION_EXIF : return "EXIF" ;
826
- case SECTION_FPIX : return "FPIX" ;
827
- case SECTION_GPS : return "GPS" ;
828
- case SECTION_INTEROP : return "INTEROP" ;
829
- case SECTION_APP12 : return "APP12" ;
817
+ case SECTION_FILE : return "FILE" ;
818
+ case SECTION_COMPUTED : return "COMPUTED" ;
819
+ case SECTION_ANY_TAG : return "ANY_TAG" ;
820
+ case SECTION_IFD0 : return "IFD0" ;
821
+ case SECTION_THUMBNAIL : return "THUMBNAIL" ;
822
+ case SECTION_COMMENT : return "COMMENT" ;
823
+ case SECTION_APP0 : return "APP0" ;
824
+ case SECTION_EXIF : return "EXIF" ;
825
+ case SECTION_FPIX : return "FPIX" ;
826
+ case SECTION_GPS : return "GPS" ;
827
+ case SECTION_INTEROP : return "INTEROP" ;
828
+ case SECTION_APP12 : return "APP12" ;
830
829
}
831
830
return "" ;
832
831
}
@@ -840,7 +839,9 @@ static char *exif_get_sectionlist(int sectionlist)
840
839
int i ,len = 0 ;
841
840
char * sections ;
842
841
843
- for (i = 0 ; i < SECTION_COUNT ; i ++ ) len += strlen (exif_get_sectionname (i ))+ 2 ;
842
+ for (i = 0 ; i < SECTION_COUNT ; i ++ ) {
843
+ len += strlen (exif_get_sectionname (i ))+ 2 ;
844
+ }
844
845
sections = emalloc (len + 1 );
845
846
if ( !sections ) {
846
847
EXIF_ERRLOG_EALLOC
@@ -854,7 +855,8 @@ static char *exif_get_sectionlist(int sectionlist)
854
855
len = strlen (sections );
855
856
}
856
857
}
857
- if (len > 2 ) sections [len - 2 ] = '\0' ;
858
+ if (len > 2 )
859
+ sections [len - 2 ] = '\0' ;
858
860
return sections ;
859
861
}
860
862
/* }}} */
@@ -866,18 +868,18 @@ static char *exif_get_sectionlist(int sectionlist)
866
868
*/
867
869
868
870
typedef struct {
869
- int type ;
870
- size_t size ;
871
- uchar * data ;
871
+ int type ;
872
+ size_t size ;
873
+ uchar * data ;
872
874
} file_section ;
873
875
874
876
typedef struct {
875
- int count ;
876
- file_section * list ;
877
+ int count ;
878
+ file_section * list ;
877
879
} file_section_list ;
878
880
879
881
typedef struct {
880
- image_filetype filetype ;
882
+ image_filetype filetype ;
881
883
size_t width , height ;
882
884
size_t size ;
883
885
size_t offset ;
@@ -891,7 +893,7 @@ typedef struct {
891
893
char * FileName ;
892
894
time_t FileDateTime ;
893
895
size_t FileSize ;
894
- image_filetype FileType ;
896
+ image_filetype FileType ;
895
897
int Height , Width ;
896
898
int IsColor ;
897
899
@@ -927,7 +929,7 @@ typedef struct {
927
929
/* {{{ jpeg_sof_info
928
930
*/
929
931
typedef struct {
930
- int bits_per_sample ;
932
+ int bits_per_sample ;
931
933
size_t width ;
932
934
size_t height ;
933
935
int num_components ;
@@ -940,8 +942,8 @@ typedef struct {
940
942
*/
941
943
int exif_file_sections_add (image_info_type * ImageInfo , int type , size_t size , uchar * data )
942
944
{
943
- file_section * tmp ;
944
- int count = ImageInfo -> file .count ;
945
+ file_section * tmp ;
946
+ int count = ImageInfo -> file .count ;
945
947
946
948
tmp = erealloc (ImageInfo -> file .list ,(count + 1 )* sizeof (file_section ));
947
949
if ( tmp == NULL ) return 0 ;
@@ -1003,7 +1005,7 @@ void exif_iif_add_value( image_info_type *image_info, int section_index, char *n
1003
1005
}
1004
1006
image_info -> info_list [section_index ].list = list ;
1005
1007
1006
- info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1008
+ info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1007
1009
info_data -> tag = tag ;
1008
1010
info_data -> format = format ;
1009
1011
info_data -> length = length ;
@@ -1158,7 +1160,7 @@ void exif_iif_add_int( image_info_type *image_info, int section_index, char *nam
1158
1160
}
1159
1161
image_info -> info_list [section_index ].list = list ;
1160
1162
1161
- info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1163
+ info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1162
1164
info_data -> tag = TAG_NONE ;
1163
1165
info_data -> format = TAG_FMT_SLONG ;
1164
1166
info_data -> length = 1 ;
@@ -1183,20 +1185,18 @@ void exif_iif_add_str( image_info_type *image_info, int section_index, char *nam
1183
1185
char tmp [1024 ];
1184
1186
va_list arglist ;
1185
1187
1186
- va_start ( arglist , value );
1187
- if ( value ) vsnprintf ( tmp , sizeof (tmp ), value , arglist );
1188
- va_end ( arglist );
1188
+ va_start ( arglist , value );
1189
+ if ( value ) vsnprintf ( tmp , sizeof (tmp ), value , arglist );
1190
+ va_end ( arglist );
1189
1191
1190
1192
if ( value ) {
1191
-
1192
- list = erealloc (image_info -> info_list [section_index ].list ,(image_info -> info_list [section_index ].count + 1 )* sizeof (image_info_data ));
1193
+ list = erealloc (image_info -> info_list [section_index ].list ,(image_info -> info_list [section_index ].count + 1 )* sizeof (image_info_data ));
1193
1194
if ( !list ) {
1194
1195
EXIF_ERRLOG_EALLOC
1195
1196
return ;
1196
1197
}
1197
1198
image_info -> info_list [section_index ].list = list ;
1198
-
1199
- info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1199
+ info_data = & image_info -> info_list [section_index ].list [image_info -> info_list [section_index ].count ];
1200
1200
info_data -> tag = TAG_NONE ;
1201
1201
info_data -> format = TAG_FMT_STRING ;
1202
1202
info_data -> length = 1 ;
@@ -1546,7 +1546,7 @@ void add_assoc_image_info( pval *value, int sub_array, image_info_type *image_in
1546
1546
*/
1547
1547
static void exif_process_COM (image_info_type * image_info , uchar * value , int length )
1548
1548
{
1549
- exif_iif_add_tag ( image_info , SECTION_COMMENT , "Comment" , TAG_COMPUTED_VALUE , TAG_FMT_STRING , length - 2 , value + 2 );
1549
+ exif_iif_add_tag ( image_info , SECTION_COMMENT , "Comment" , TAG_COMPUTED_VALUE , TAG_FMT_STRING , length - 2 , value + 2 );
1550
1550
}
1551
1551
/* }}} */
1552
1552
0 commit comments