comparison src/exif.c @ 1000:4fe8f9656107

For the sake of consistency, use glib basic types everywhere.
author zas_
date Tue, 26 Aug 2008 22:22:51 +0000
parents 6ca2c5fd7b13
children 3096a47232ec
comparison
equal deleted inserted replaced
999:bbed8e9a5d33 1000:4fe8f9656107
479 case EXIF_FORMAT_UNKNOWN: 479 case EXIF_FORMAT_UNKNOWN:
480 /* unknown, data is NULL */ 480 /* unknown, data is NULL */
481 return item; 481 return item;
482 break; 482 break;
483 case EXIF_FORMAT_BYTE_UNSIGNED: 483 case EXIF_FORMAT_BYTE_UNSIGNED:
484 item->data_len = sizeof(char) * elements; 484 item->data_len = sizeof(gchar) * elements;
485 break; 485 break;
486 case EXIF_FORMAT_STRING: 486 case EXIF_FORMAT_STRING:
487 item->data_len = sizeof(char) * elements; 487 item->data_len = sizeof(gchar) * elements;
488 break; 488 break;
489 case EXIF_FORMAT_SHORT_UNSIGNED: 489 case EXIF_FORMAT_SHORT_UNSIGNED:
490 item->data_len = sizeof(guint16) * elements; 490 item->data_len = sizeof(guint16) * elements;
491 break; 491 break;
492 case EXIF_FORMAT_LONG_UNSIGNED: 492 case EXIF_FORMAT_LONG_UNSIGNED:
494 break; 494 break;
495 case EXIF_FORMAT_RATIONAL_UNSIGNED: 495 case EXIF_FORMAT_RATIONAL_UNSIGNED:
496 item->data_len = sizeof(ExifRational) * elements; 496 item->data_len = sizeof(ExifRational) * elements;
497 break; 497 break;
498 case EXIF_FORMAT_BYTE: 498 case EXIF_FORMAT_BYTE:
499 item->data_len = sizeof(char) * elements; 499 item->data_len = sizeof(gchar) * elements;
500 break; 500 break;
501 case EXIF_FORMAT_UNDEFINED: 501 case EXIF_FORMAT_UNDEFINED:
502 item->data_len = sizeof(char) * elements; 502 item->data_len = sizeof(gchar) * elements;
503 break; 503 break;
504 case EXIF_FORMAT_SHORT: 504 case EXIF_FORMAT_SHORT:
505 item->data_len = sizeof(gint16) * elements; 505 item->data_len = sizeof(gint16) * elements;
506 break; 506 break;
507 case EXIF_FORMAT_LONG: 507 case EXIF_FORMAT_LONG:
512 break; 512 break;
513 case EXIF_FORMAT_FLOAT: 513 case EXIF_FORMAT_FLOAT:
514 item->data_len = sizeof(float) * elements; 514 item->data_len = sizeof(float) * elements;
515 break; 515 break;
516 case EXIF_FORMAT_DOUBLE: 516 case EXIF_FORMAT_DOUBLE:
517 item->data_len = sizeof(double) * elements; 517 item->data_len = sizeof(gdouble) * elements;
518 break; 518 break;
519 } 519 }
520 520
521 item->data = g_malloc0(item->data_len); 521 item->data = g_malloc0(item->data_len);
522 522
529 529
530 g_free(item->data); 530 g_free(item->data);
531 g_free(item); 531 g_free(item);
532 } 532 }
533 533
534 char *exif_item_get_tag_name(ExifItem *item) 534 gchar *exif_item_get_tag_name(ExifItem *item)
535 { 535 {
536 if (!item || !item->marker) return NULL; 536 if (!item || !item->marker) return NULL;
537 return g_strdup(item->marker->key); 537 return g_strdup(item->marker->key);
538 } 538 }
539 539
547 { 547 {
548 if (!item) return 0; 548 if (!item) return 0;
549 return item->elements; 549 return item->elements;
550 } 550 }
551 551
552 char *exif_item_get_data(ExifItem *item, guint *data_len) 552 gchar *exif_item_get_data(ExifItem *item, guint *data_len)
553 { 553 {
554 if (data_len) 554 if (data_len)
555 *data_len = item->data_len; 555 *data_len = item->data_len;
556 return g_memdup(item->data, item->data_len); 556 return g_memdup(item->data, item->data_len);
557 } 557 }
561 if (!item) return EXIF_FORMAT_UNKNOWN; 561 if (!item) return EXIF_FORMAT_UNKNOWN;
562 return item->format; 562 return item->format;
563 } 563 }
564 564
565 565
566 char *exif_item_get_description(ExifItem *item) 566 gchar *exif_item_get_description(ExifItem *item)
567 { 567 {
568 if (!item || !item->marker) return NULL; 568 if (!item || !item->marker) return NULL;
569 return g_strdup(_(item->marker->description)); 569 return g_strdup(_(item->marker->description));
570 } 570 }
571 571
572 const char *exif_item_get_format_name(ExifItem *item, gint brief) 572 const gchar *exif_item_get_format_name(ExifItem *item, gint brief)
573 { 573 {
574 if (!item || !item->marker) return NULL; 574 if (!item || !item->marker) return NULL;
575 return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description; 575 return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;
576 } 576 }
577 577
579 { 579 {
580 gint i; 580 gint i;
581 581
582 for (i = 0 ; i < ne; i++) 582 for (i = 0 ; i < ne; i++)
583 { 583 {
584 unsigned char c = ((char *)data)[i]; 584 guchar c = ((gchar *)data)[i];
585 if (c < 32 || c > 127) c = '.'; 585 if (c < 32 || c > 127) c = '.';
586 g_string_append_printf(string, "%c", c); 586 g_string_append_printf(string, "%c", c);
587 } 587 }
588 string = g_string_append(string, " : "); 588 string = g_string_append(string, " : ");
589 for (i = 0 ; i < ne; i++) 589 for (i = 0 ; i < ne; i++)
602 } 602 }
603 else 603 else
604 { 604 {
605 spacer = ""; 605 spacer = "";
606 } 606 }
607 g_string_append_printf(string, "%s%02x", spacer, ((char *)data)[i]); 607 g_string_append_printf(string, "%s%02x", spacer, ((gchar *)data)[i]);
608 } 608 }
609 609
610 return string; 610 return string;
611 } 611 }
612 612
634 *------------------------------------------------------------------- 634 *-------------------------------------------------------------------
635 */ 635 */
636 636
637 /* note: the align_buf is used to avoid alignment issues (on sparc) */ 637 /* note: the align_buf is used to avoid alignment issues (on sparc) */
638 638
639 guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo) 639 guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo)
640 { 640 {
641 guint16 align_buf; 641 guint16 align_buf;
642 642
643 memcpy(&align_buf, f, sizeof(guint16)); 643 memcpy(&align_buf, f, sizeof(guint16));
644 644
646 return GUINT16_FROM_LE(align_buf); 646 return GUINT16_FROM_LE(align_buf);
647 else 647 else
648 return GUINT16_FROM_BE(align_buf); 648 return GUINT16_FROM_BE(align_buf);
649 } 649 }
650 650
651 guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo) 651 guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo)
652 { 652 {
653 guint32 align_buf; 653 guint32 align_buf;
654 654
655 memcpy(&align_buf, f, sizeof(guint32)); 655 memcpy(&align_buf, f, sizeof(guint32));
656 656
658 return GUINT32_FROM_LE(align_buf); 658 return GUINT32_FROM_LE(align_buf);
659 else 659 else
660 return GUINT32_FROM_BE(align_buf); 660 return GUINT32_FROM_BE(align_buf);
661 } 661 }
662 662
663 void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo) 663 void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo)
664 { 664 {
665 guint16 align_buf; 665 guint16 align_buf;
666 666
667 if (bo == EXIF_BYTE_ORDER_INTEL) 667 if (bo == EXIF_BYTE_ORDER_INTEL)
668 { 668 {
674 } 674 }
675 675
676 memcpy(f, &align_buf, sizeof(guint16)); 676 memcpy(f, &align_buf, sizeof(guint16));
677 } 677 }
678 678
679 void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo) 679 void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo)
680 { 680 {
681 guint32 align_buf; 681 guint32 align_buf;
682 682
683 if (bo == EXIF_BYTE_ORDER_INTEL) 683 if (bo == EXIF_BYTE_ORDER_INTEL)
684 { 684 {
753 memcpy(dest, src, len); 753 memcpy(dest, src, len);
754 break; 754 break;
755 case EXIF_FORMAT_STRING: 755 case EXIF_FORMAT_STRING:
756 memcpy(dest, src, len); 756 memcpy(dest, src, len);
757 /* string is NULL terminated, make sure this is true */ 757 /* string is NULL terminated, make sure this is true */
758 if (((char *)dest)[len - 1] != '\0') ((char *)dest)[len - 1] = '\0'; 758 if (((gchar *)dest)[len - 1] != '\0') ((gchar *)dest)[len - 1] = '\0';
759 break; 759 break;
760 case EXIF_FORMAT_SHORT_UNSIGNED: 760 case EXIF_FORMAT_SHORT_UNSIGNED:
761 case EXIF_FORMAT_SHORT: 761 case EXIF_FORMAT_SHORT:
762 for (i = 0; i < ne; i++) 762 for (i = 0; i < ne; i++)
763 { 763 {
805 for (i = 0; i < ne; i++) 805 for (i = 0; i < ne; i++)
806 { 806 {
807 ExifRational r; 807 ExifRational r;
808 808
809 rational_from_data(&r, src + i * bs, bo); 809 rational_from_data(&r, src + i * bs, bo);
810 if (r.den) ((double *)dest)[i] = (double)r.num / r.den; 810 if (r.den) ((gdouble *)dest)[i] = (gdouble)r.num / r.den;
811 } 811 }
812 break; 812 break;
813 } 813 }
814 } 814 }
815 815
816 static gint exif_parse_IFD_entry(ExifData *exif, unsigned char *tiff, guint offset, 816 static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
817 guint size, ExifByteOrder bo, 817 guint size, ExifByteOrder bo,
818 gint level, 818 gint level,
819 const ExifMarker *list) 819 const ExifMarker *list)
820 { 820 {
821 guint tag; 821 guint tag;
919 919
920 return 0; 920 return 0;
921 } 921 }
922 922
923 gint exif_parse_IFD_table(ExifData *exif, 923 gint exif_parse_IFD_table(ExifData *exif,
924 unsigned char *tiff, guint offset, 924 guchar *tiff, guint offset,
925 guint size, ExifByteOrder bo, 925 guint size, ExifByteOrder bo,
926 gint level, 926 gint level,
927 const ExifMarker *list) 927 const ExifMarker *list)
928 { 928 {
929 guint count; 929 guint count;
953 *------------------------------------------------------------------- 953 *-------------------------------------------------------------------
954 * file formats 954 * file formats
955 *------------------------------------------------------------------- 955 *-------------------------------------------------------------------
956 */ 956 */
957 957
958 gint exif_tiff_directory_offset(unsigned char *data, const guint len, 958 gint exif_tiff_directory_offset(guchar *data, const guint len,
959 guint *offset, ExifByteOrder *bo) 959 guint *offset, ExifByteOrder *bo)
960 { 960 {
961 if (len < 8) return FALSE; 961 if (len < 8) return FALSE;
962 962
963 if (memcmp(data, "II", 2) == 0) 963 if (memcmp(data, "II", 2) == 0)
981 *offset = exif_byte_get_int32(data + 4, *bo); 981 *offset = exif_byte_get_int32(data + 4, *bo);
982 982
983 return (*offset < len); 983 return (*offset < len);
984 } 984 }
985 985
986 gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list) 986 gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list)
987 { 987 {
988 ExifByteOrder bo; 988 ExifByteOrder bo;
989 guint offset; 989 guint offset;
990 990
991 if (!exif_tiff_directory_offset(tiff, size, &offset, &bo)) return -1; 991 if (!exif_tiff_directory_offset(tiff, size, &offset, &bo)) return -1;
1017 length of NN... == SSSS - 2. 1017 length of NN... == SSSS - 2.
1018 NNN.: the data in this segment 1018 NNN.: the data in this segment
1019 */ 1019 */
1020 static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL }; 1020 static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL };
1021 1021
1022 void exif_add_jpeg_color_profile(ExifData *exif, unsigned char *cp_data, guint cp_length) 1022 void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length)
1023 { 1023 {
1024 ExifItem *item = exif_item_new(jpeg_color_marker.format, jpeg_color_marker.tag, 1, 1024 ExifItem *item = exif_item_new(jpeg_color_marker.format, jpeg_color_marker.tag, 1,
1025 &jpeg_color_marker); 1025 &jpeg_color_marker);
1026 g_free(item->data); 1026 g_free(item->data);
1027 item->data = cp_data; 1027 item->data = cp_data;
1030 exif->items = g_list_prepend(exif->items, item); 1030 exif->items = g_list_prepend(exif->items, item);
1031 1031
1032 } 1032 }
1033 1033
1034 static gint exif_jpeg_parse(ExifData *exif, 1034 static gint exif_jpeg_parse(ExifData *exif,
1035 unsigned char *data, guint size, 1035 guchar *data, guint size,
1036 ExifMarker *list) 1036 ExifMarker *list)
1037 { 1037 {
1038 guint seg_offset = 0; 1038 guint seg_offset = 0;
1039 guint seg_length = 0; 1039 guint seg_length = 0;
1040 gint res = -1; 1040 gint res = -1;
1058 } 1058 }
1059 1059
1060 return res; 1060 return res;
1061 } 1061 }
1062 1062
1063 unsigned char *exif_get_color_profile(ExifData *exif, guint *data_len) 1063 guchar *exif_get_color_profile(ExifData *exif, guint *data_len)
1064 { 1064 {
1065 ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile"); 1065 ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile");
1066 if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED) 1066 if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED)
1067 return (unsigned char*) exif_item_get_data(prof_item, data_len); 1067 return (guchar *) exif_item_get_data(prof_item, data_len);
1068 return NULL; 1068 return NULL;
1069 } 1069 }
1070 1070
1071 1071
1072 /* 1072 /*
1097 return ret; 1097 return ret;
1098 } 1098 }
1099 return NULL; 1099 return NULL;
1100 } 1100 }
1101 1101
1102 static gint map_file(const gchar *path, void **mapping, int *size) 1102 static gint map_file(const gchar *path, void **mapping, gint *size)
1103 { 1103 {
1104 int fd; 1104 gint fd;
1105 struct stat fs; 1105 struct stat fs;
1106 1106
1107 fd = open(path, O_RDONLY); 1107 fd = open(path, O_RDONLY);
1108 if (fd == -1) 1108 if (fd == -1)
1109 { 1109 {
1130 1130
1131 close(fd); 1131 close(fd);
1132 return 0; 1132 return 0;
1133 } 1133 }
1134 1134
1135 static gint unmap_file(void *mapping, int size) 1135 static gint unmap_file(void *mapping, gint size)
1136 { 1136 {
1137 if (munmap(mapping, size) == -1) 1137 if (munmap(mapping, size) == -1)
1138 { 1138 {
1139 perror("munmap"); 1139 perror("munmap");
1140 return -1; 1140 return -1;
1163 1163
1164 ExifData *exif_read(gchar *path, gchar *sidecar_path) 1164 ExifData *exif_read(gchar *path, gchar *sidecar_path)
1165 { 1165 {
1166 ExifData *exif; 1166 ExifData *exif;
1167 void *f; 1167 void *f;
1168 int size, res; 1168 gint size, res;
1169 gchar *pathl; 1169 gchar *pathl;
1170 1170
1171 if (!path) return NULL; 1171 if (!path) return NULL;
1172 1172
1173 pathl = path_from_utf8(path); 1173 pathl = path_from_utf8(path);
1180 1180
1181 exif = g_new0(ExifData, 1); 1181 exif = g_new0(ExifData, 1);
1182 exif->items = NULL; 1182 exif->items = NULL;
1183 exif->current = NULL; 1183 exif->current = NULL;
1184 1184
1185 res = exif_jpeg_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList); 1185 res = exif_jpeg_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
1186 if (res == -2) 1186 if (res == -2)
1187 { 1187 {
1188 res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList); 1188 res = exif_tiff_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
1189 } 1189 }
1190 1190
1191 if (res != 0) 1191 if (res != 0)
1192 { 1192 {
1193 FormatRawExifType exif_type; 1193 FormatRawExifType exif_type;
1199 { 1199 {
1200 case FORMAT_RAW_EXIF_NONE: 1200 case FORMAT_RAW_EXIF_NONE:
1201 default: 1201 default:
1202 break; 1202 break;
1203 case FORMAT_RAW_EXIF_TIFF: 1203 case FORMAT_RAW_EXIF_TIFF:
1204 res = exif_tiff_parse(exif, (unsigned char*)f + offset, size - offset, 1204 res = exif_tiff_parse(exif, (guchar *)f + offset, size - offset,
1205 ExifKnownMarkersList); 1205 ExifKnownMarkersList);
1206 break; 1206 break;
1207 case FORMAT_RAW_EXIF_JPEG: 1207 case FORMAT_RAW_EXIF_JPEG:
1208 res = exif_jpeg_parse(exif, (unsigned char*)f + offset, size - offset, 1208 res = exif_jpeg_parse(exif, (guchar *)f + offset, size - offset,
1209 ExifKnownMarkersList); 1209 ExifKnownMarkersList);
1210 break; 1210 break;
1211 case FORMAT_RAW_EXIF_IFD_II: 1211 case FORMAT_RAW_EXIF_IFD_II:
1212 case FORMAT_RAW_EXIF_IFD_MM: 1212 case FORMAT_RAW_EXIF_IFD_MM:
1213 res = exif_parse_IFD_table(exif, (unsigned char*)f, offset, size - offset, 1213 res = exif_parse_IFD_table(exif, (guchar *)f, offset, size - offset,
1214 (exif_type == FORMAT_RAW_EXIF_IFD_II) ? 1214 (exif_type == FORMAT_RAW_EXIF_IFD_II) ?
1215 EXIF_BYTE_ORDER_INTEL : EXIF_BYTE_ORDER_MOTOROLA, 1215 EXIF_BYTE_ORDER_INTEL : EXIF_BYTE_ORDER_MOTOROLA,
1216 0, ExifKnownMarkersList); 1216 0, ExifKnownMarkersList);
1217 break; 1217 break;
1218 case FORMAT_RAW_EXIF_PROPRIETARY: 1218 case FORMAT_RAW_EXIF_PROPRIETARY:
1219 if (exif_parse_func) 1219 if (exif_parse_func)
1220 { 1220 {
1221 res = exif_parse_func((unsigned char*)f + offset, size - offset, exif); 1221 res = exif_parse_func((guchar *)f + offset, size - offset, exif);
1222 } 1222 }
1223 break; 1223 break;
1224 } 1224 }
1225 } 1225 }
1226 1226
1260 return NULL; 1260 return NULL;
1261 } 1261 }
1262 1262
1263 #define EXIF_DATA_AS_TEXT_MAX_COUNT 16 1263 #define EXIF_DATA_AS_TEXT_MAX_COUNT 16
1264 1264
1265 gchar *exif_item_get_string(ExifItem *item, int idx) 1265 gchar *exif_item_get_string(ExifItem *item, gint idx)
1266 { 1266 {
1267 return exif_item_get_data_as_text(item); 1267 return exif_item_get_data_as_text(item);
1268 } 1268 }
1269 1269
1270 1270
1294 case EXIF_FORMAT_BYTE: 1294 case EXIF_FORMAT_BYTE:
1295 case EXIF_FORMAT_UNDEFINED: 1295 case EXIF_FORMAT_UNDEFINED:
1296 if (ne == 1 && marker->list) 1296 if (ne == 1 && marker->list)
1297 { 1297 {
1298 gchar *result; 1298 gchar *result;
1299 unsigned char val; 1299 guchar val;
1300 1300
1301 if (item->format == EXIF_FORMAT_BYTE_UNSIGNED || 1301 if (item->format == EXIF_FORMAT_BYTE_UNSIGNED ||
1302 item->format == EXIF_FORMAT_UNDEFINED) 1302 item->format == EXIF_FORMAT_UNDEFINED)
1303 { 1303 {
1304 val = ((unsigned char *)data)[0]; 1304 val = ((guchar *)data)[0];
1305 } 1305 }
1306 else 1306 else
1307 { 1307 {
1308 val = (unsigned char)(((signed char *)data)[0]); 1308 val = (guchar)(((signed gchar *)data)[0]);
1309 } 1309 }
1310 1310
1311 result = exif_text_list_find_value(marker->list, (guint)val); 1311 result = exif_text_list_find_value(marker->list, (guint)val);
1312 string = g_string_append(string, result); 1312 string = g_string_append(string, result);
1313 g_free(result); 1313 g_free(result);
1337 break; 1337 break;
1338 case EXIF_FORMAT_LONG_UNSIGNED: 1338 case EXIF_FORMAT_LONG_UNSIGNED:
1339 for (i = 0; i < ne; i++) 1339 for (i = 0; i < ne; i++)
1340 { 1340 {
1341 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "", 1341 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
1342 (unsigned long int)((guint32 *)data)[i]); 1342 (gulong)((guint32 *)data)[i]);
1343 } 1343 }
1344 break; 1344 break;
1345 case EXIF_FORMAT_RATIONAL_UNSIGNED: 1345 case EXIF_FORMAT_RATIONAL_UNSIGNED:
1346 for (i = 0; i < ne; i++) 1346 for (i = 0; i < ne; i++)
1347 { 1347 {
1348 ExifRational *r; 1348 ExifRational *r;
1349 1349
1350 r = &((ExifRational *)data)[i]; 1350 r = &((ExifRational *)data)[i];
1351 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "", 1351 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
1352 (unsigned long)r->num, (unsigned long)r->den); 1352 (gulong)r->num, (gulong)r->den);
1353 } 1353 }
1354 break; 1354 break;
1355 case EXIF_FORMAT_SHORT: 1355 case EXIF_FORMAT_SHORT:
1356 for (i = 0; i < ne; i++) 1356 for (i = 0; i < ne; i++)
1357 { 1357 {
1361 break; 1361 break;
1362 case EXIF_FORMAT_LONG: 1362 case EXIF_FORMAT_LONG:
1363 for (i = 0; i < ne; i++) 1363 for (i = 0; i < ne; i++)
1364 { 1364 {
1365 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "", 1365 g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
1366 (long int)((gint32 *)data)[i]); 1366 (glong)((gint32 *)data)[i]);
1367 } 1367 }
1368 break; 1368 break;
1369 case EXIF_FORMAT_RATIONAL: 1369 case EXIF_FORMAT_RATIONAL:
1370 for (i = 0; i < ne; i++) 1370 for (i = 0; i < ne; i++)
1371 { 1371 {
1372 ExifRational *r; 1372 ExifRational *r;
1373 1373
1374 r = &((ExifRational *)data)[i]; 1374 r = &((ExifRational *)data)[i];
1375 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "", 1375 g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
1376 (long)r->num, (long)r->den); 1376 (glong)r->num, (glong)r->den);
1377 } 1377 }
1378 break; 1378 break;
1379 case EXIF_FORMAT_FLOAT: 1379 case EXIF_FORMAT_FLOAT:
1380 for (i = 0; i < ne; i++) 1380 for (i = 0; i < ne; i++)
1381 { 1381 {
1385 break; 1385 break;
1386 case EXIF_FORMAT_DOUBLE: 1386 case EXIF_FORMAT_DOUBLE:
1387 for (i = 0; i < ne; i++) 1387 for (i = 0; i < ne; i++)
1388 { 1388 {
1389 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "", 1389 g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
1390 ((double *)data)[i]); 1390 ((gdouble *)data)[i]);
1391 } 1391 }
1392 break; 1392 break;
1393 } 1393 }
1394 1394
1395 if (item->elements > EXIF_DATA_AS_TEXT_MAX_COUNT && 1395 if (item->elements > EXIF_DATA_AS_TEXT_MAX_COUNT &&
1519 } 1519 }
1520 } 1520 }
1521 fprintf(f, "----------------------------------------------------\n"); 1521 fprintf(f, "----------------------------------------------------\n");
1522 } 1522 }
1523 1523
1524 int exif_write(ExifData *exif) 1524 gint exif_write(ExifData *exif)
1525 { 1525 {
1526 log_printf("Not compiled with EXIF write support"); 1526 log_printf("Not compiled with EXIF write support");
1527 return 0; 1527 return 0;
1528 } 1528 }
1529 1529
1530 ExifItem *exif_add_item(ExifData *exif, const gchar *key) 1530 ExifItem *exif_add_item(ExifData *exif, const gchar *key)
1531 { 1531 {
1532 return NULL; 1532 return NULL;
1533 } 1533 }
1534 1534
1535 int exif_item_delete(ExifData *exif, ExifItem *item) 1535 gint exif_item_delete(ExifData *exif, ExifItem *item)
1536 { 1536 {
1537 return 0; 1537 return 0;
1538 } 1538 }
1539 1539
1540 int exif_item_set_string(ExifItem *item, const char *str) 1540 gint exif_item_set_string(ExifItem *item, const gchar *str)
1541 { 1541 {
1542 return 0; 1542 return 0;
1543 } 1543 }
1544 1544
1545 1545