Lines Matching refs:data

70 exif_data_alloc (ExifData *data, unsigned int i)  in exif_data_alloc()  argument
74 if (!data || !i) in exif_data_alloc()
77 d = exif_mem_alloc (data->priv->mem, i); in exif_data_alloc()
81 EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", i); in exif_data_alloc()
105 ExifData *data; in exif_data_new_mem() local
111 data = exif_mem_alloc (mem, sizeof (ExifData)); in exif_data_new_mem()
112 if (!data) in exif_data_new_mem()
114 data->priv = exif_mem_alloc (mem, sizeof (ExifDataPrivate)); in exif_data_new_mem()
115 if (!data->priv) { in exif_data_new_mem()
116 exif_mem_free (mem, data); in exif_data_new_mem()
119 data->priv->ref_count = 1; in exif_data_new_mem()
121 data->priv->mem = mem; in exif_data_new_mem()
125 data->ifd[i] = exif_content_new_mem (data->priv->mem); in exif_data_new_mem()
126 if (!data->ifd[i]) { in exif_data_new_mem()
127 exif_data_free (data); in exif_data_new_mem()
130 data->ifd[i]->parent = data; in exif_data_new_mem()
139 exif_data_set_option (data, EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS); in exif_data_new_mem()
141 exif_data_set_option (data, EXIF_DATA_OPTION_FOLLOW_SPECIFICATION); in exif_data_new_mem()
144 exif_data_set_data_type (data, EXIF_DATA_TYPE_COUNT); in exif_data_new_mem()
146 return (data); in exif_data_new_mem()
150 exif_data_new_from_data (const unsigned char *data, unsigned int size) in exif_data_new_from_data() argument
155 exif_data_load_data (edata, data, size); in exif_data_new_from_data()
160 exif_data_load_data_entry (ExifData *data, ExifEntry *entry, in exif_data_load_data_entry() argument
166 entry->tag = exif_get_short (d + offset + 0, data->priv->order); in exif_data_load_data_entry()
167 entry->format = exif_get_short (d + offset + 2, data->priv->order); in exif_data_load_data_entry()
168 entry->components = exif_get_long (d + offset + 4, data->priv->order); in exif_data_load_data_entry()
173 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_entry()
189 doff = exif_get_long (d + offset + 8, data->priv->order); in exif_data_load_data_entry()
195 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_entry()
200 entry->data = exif_data_alloc (data, s); in exif_data_load_data_entry()
201 if (entry->data) { in exif_data_load_data_entry()
203 memcpy (entry->data, d + doff, s); in exif_data_load_data_entry()
206 EXIF_LOG_NO_MEMORY(data->priv->log, "ExifData", s); in exif_data_load_data_entry()
211 if (!entry->data) { in exif_data_load_data_entry()
212 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_entry()
215 exif_log (data->priv->log, in exif_data_load_data_entry()
219 entry->data[0], entry->data[1], entry->data[2], in exif_data_load_data_entry()
220 entry->data[3], entry->data[4], entry->data[5], in exif_data_load_data_entry()
221 entry->data[6]); in exif_data_load_data_entry()
223 data->priv->offset_mnote = doff; in exif_data_load_data_entry()
229 exif_data_save_data_entry (ExifData *data, ExifEntry *e, in exif_data_save_data_entry() argument
236 if (!data || !data->priv) in exif_data_save_data_entry()
244 data->priv->order, (ExifShort) e->tag); in exif_data_save_data_entry()
246 data->priv->order, (ExifShort) e->format); in exif_data_save_data_entry()
248 if (!(data->priv->options & EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE)) { in exif_data_save_data_entry()
250 if ((e->tag == EXIF_TAG_MAKER_NOTE) && data->priv->md) { in exif_data_save_data_entry()
252 exif_mem_free (data->priv->mem, e->data); in exif_data_save_data_entry()
253 e->data = NULL; in exif_data_save_data_entry()
255 exif_mnote_data_set_offset (data->priv->md, *ds - 6); in exif_data_save_data_entry()
256 exif_mnote_data_save (data->priv->md, &e->data, &e->size); in exif_data_save_data_entry()
262 data->priv->order, e->components); in exif_data_save_data_entry()
281 t = exif_mem_realloc (data->priv->mem, *d, ts); in exif_data_save_data_entry()
283 EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", ts); in exif_data_save_data_entry()
288 exif_set_long (*d + 6 + offset + 8, data->priv->order, doff); in exif_data_save_data_entry()
297 if (e->data) { in exif_data_save_data_entry()
298 memcpy (*d + 6 + doff, e->data, s); in exif_data_save_data_entry()
307 exif_data_load_data_thumbnail (ExifData *data, const unsigned char *d, in exif_data_load_data_thumbnail() argument
312 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_thumbnail()
318 if (data->data) in exif_data_load_data_thumbnail()
319 exif_mem_free (data->priv->mem, data->data); in exif_data_load_data_thumbnail()
320 if (!(data->data = exif_data_alloc (data, s))) { in exif_data_load_data_thumbnail()
321 EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", s); in exif_data_load_data_thumbnail()
322 data->size = 0; in exif_data_load_data_thumbnail()
325 data->size = s; in exif_data_load_data_thumbnail()
326 memcpy (data->data, d + o, s); in exif_data_load_data_thumbnail()
332 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, \
338 if (data->ifd[(i)]->count) { \
339 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, \
358 exif_data_load_data_content (ExifData *data, ExifIfd ifd, in exif_data_load_data_content() argument
368 if (!data || !data->priv) in exif_data_load_data_content()
376 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", in exif_data_load_data_content()
383 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", in exif_data_load_data_content()
387 n = exif_get_short (d + offset, data->priv->order); in exif_data_load_data_content()
388 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_content()
395 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_content()
401 tag = exif_get_short (d + offset + 12 * i, data->priv->order); in exif_data_load_data_content()
409 data->priv->order); in exif_data_load_data_content()
413 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_content()
419 exif_data_load_data_content (data, EXIF_IFD_EXIF, d, ds, o, recursion_depth + 1); in exif_data_load_data_content()
423 exif_data_load_data_content (data, EXIF_IFD_GPS, d, ds, o, recursion_depth + 1); in exif_data_load_data_content()
427 exif_data_load_data_content (data, EXIF_IFD_INTEROPERABILITY, d, ds, o, recursion_depth + 1); in exif_data_load_data_content()
432 exif_data_load_data_thumbnail (data, d, in exif_data_load_data_content()
439 exif_data_load_data_thumbnail (data, d, in exif_data_load_data_content()
461 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_content()
466 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data_content()
470 if (data->priv->options & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS) in exif_data_load_data_content()
473 entry = exif_entry_new_mem (data->priv->mem); in exif_data_load_data_content()
474 if (exif_data_load_data_entry (data, entry, d, ds, in exif_data_load_data_content()
476 exif_content_add_entry (data->ifd[ifd], entry); in exif_data_load_data_content()
507 exif_data_save_data_content (ExifData *data, ExifContent *ifd, in exif_data_save_data_content() argument
516 if (!data || !data->priv || !ifd || !d || !ds) in exif_data_save_data_content()
520 if (ifd == data->ifd[i]) in exif_data_save_data_content()
535 if (data->ifd[EXIF_IFD_EXIF]->count || in exif_data_save_data_content()
536 data->ifd[EXIF_IFD_INTEROPERABILITY]->count) in exif_data_save_data_content()
540 if (data->ifd[EXIF_IFD_GPS]->count) in exif_data_save_data_content()
545 if (data->size) in exif_data_save_data_content()
549 if (data->ifd[EXIF_IFD_INTEROPERABILITY]->count) in exif_data_save_data_content()
560 t = exif_mem_realloc (data->priv->mem, *d, ts); in exif_data_save_data_content()
562 EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", ts); in exif_data_save_data_content()
569 exif_set_short (*d + 6 + offset, data->priv->order, in exif_data_save_data_content()
577 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_save_data_content()
582 exif_data_save_data_entry (data, ifd->entries[j], d, ds, in exif_data_save_data_content()
599 if (data->ifd[EXIF_IFD_EXIF]->count || in exif_data_save_data_content()
600 data->ifd[EXIF_IFD_INTEROPERABILITY]->count) { in exif_data_save_data_content()
601 exif_set_short (*d + 6 + offset + 0, data->priv->order, in exif_data_save_data_content()
603 exif_set_short (*d + 6 + offset + 2, data->priv->order, in exif_data_save_data_content()
605 exif_set_long (*d + 6 + offset + 4, data->priv->order, in exif_data_save_data_content()
607 exif_set_long (*d + 6 + offset + 8, data->priv->order, in exif_data_save_data_content()
609 exif_data_save_data_content (data, in exif_data_save_data_content()
610 data->ifd[EXIF_IFD_EXIF], d, ds, *ds - 6); in exif_data_save_data_content()
615 if (data->ifd[EXIF_IFD_GPS]->count) { in exif_data_save_data_content()
616 exif_set_short (*d + 6 + offset + 0, data->priv->order, in exif_data_save_data_content()
618 exif_set_short (*d + 6 + offset + 2, data->priv->order, in exif_data_save_data_content()
620 exif_set_long (*d + 6 + offset + 4, data->priv->order, in exif_data_save_data_content()
622 exif_set_long (*d + 6 + offset + 8, data->priv->order, in exif_data_save_data_content()
624 exif_data_save_data_content (data, in exif_data_save_data_content()
625 data->ifd[EXIF_IFD_GPS], d, ds, *ds - 6); in exif_data_save_data_content()
636 if (data->ifd[EXIF_IFD_INTEROPERABILITY]->count) { in exif_data_save_data_content()
637 exif_set_short (*d + 6 + offset + 0, data->priv->order, in exif_data_save_data_content()
639 exif_set_short (*d + 6 + offset + 2, data->priv->order, in exif_data_save_data_content()
641 exif_set_long (*d + 6 + offset + 4, data->priv->order, in exif_data_save_data_content()
643 exif_set_long (*d + 6 + offset + 8, data->priv->order, in exif_data_save_data_content()
645 exif_data_save_data_content (data, in exif_data_save_data_content()
646 data->ifd[EXIF_IFD_INTEROPERABILITY], d, ds, in exif_data_save_data_content()
658 if (data->size) { in exif_data_save_data_content()
661 exif_set_short (*d + 6 + offset + 0, data->priv->order, in exif_data_save_data_content()
663 exif_set_short (*d + 6 + offset + 2, data->priv->order, in exif_data_save_data_content()
665 exif_set_long (*d + 6 + offset + 4, data->priv->order, in exif_data_save_data_content()
667 exif_set_long (*d + 6 + offset + 8, data->priv->order, in exif_data_save_data_content()
669 ts = *ds + data->size; in exif_data_save_data_content()
670 t = exif_mem_realloc (data->priv->mem, *d, ts); in exif_data_save_data_content()
672 EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", in exif_data_save_data_content()
678 memcpy (*d + *ds - data->size, data->data, data->size); in exif_data_save_data_content()
682 exif_set_short (*d + 6 + offset + 0, data->priv->order, in exif_data_save_data_content()
684 exif_set_short (*d + 6 + offset + 2, data->priv->order, in exif_data_save_data_content()
686 exif_set_long (*d + 6 + offset + 4, data->priv->order, in exif_data_save_data_content()
688 exif_set_long (*d + 6 + offset + 8, data->priv->order, in exif_data_save_data_content()
689 data->size); in exif_data_save_data_content()
701 (data->priv->order == EXIF_BYTE_ORDER_INTEL) ? cmp_func_intel : cmp_func_motorola); in exif_data_save_data_content()
704 if (i == EXIF_IFD_0 && (data->ifd[EXIF_IFD_1]->count || in exif_data_save_data_content()
705 data->size)) { in exif_data_save_data_content()
711 exif_set_long (*d + 6 + offset, data->priv->order, *ds - 6); in exif_data_save_data_content()
712 exif_data_save_data_content (data, data->ifd[EXIF_IFD_1], d, ds, in exif_data_save_data_content()
715 exif_set_long (*d + 6 + offset, data->priv->order, 0); in exif_data_save_data_content()
735 interpret_maker_note(ExifData *data, const unsigned char *d, unsigned int ds) in interpret_maker_note() argument
738 ExifEntry* e = exif_data_get_entry (data, EXIF_TAG_MAKER_NOTE); in interpret_maker_note()
742 if ((mnoteid = exif_mnote_data_olympus_identify (data, e)) != 0) { in interpret_maker_note()
743 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, in interpret_maker_note()
745 data->priv->md = exif_mnote_data_olympus_new (data->priv->mem); in interpret_maker_note()
747 } else if ((mnoteid = exif_mnote_data_canon_identify (data, e)) != 0) { in interpret_maker_note()
748 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, in interpret_maker_note()
750 data->priv->md = exif_mnote_data_canon_new (data->priv->mem, data->priv->options); in interpret_maker_note()
752 } else if ((mnoteid = exif_mnote_data_fuji_identify (data, e)) != 0) { in interpret_maker_note()
753 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, in interpret_maker_note()
755 data->priv->md = exif_mnote_data_fuji_new (data->priv->mem); in interpret_maker_note()
759 } else if ((mnoteid = exif_mnote_data_pentax_identify (data, e)) != 0) { in interpret_maker_note()
760 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, in interpret_maker_note()
762 data->priv->md = exif_mnote_data_pentax_new (data->priv->mem); in interpret_maker_note()
768 if (data->priv->md) { in interpret_maker_note()
769 exif_mnote_data_log (data->priv->md, data->priv->log); in interpret_maker_note()
770 exif_mnote_data_set_byte_order (data->priv->md, in interpret_maker_note()
771 data->priv->order); in interpret_maker_note()
772 exif_mnote_data_set_offset (data->priv->md, in interpret_maker_note()
773 data->priv->offset_mnote); in interpret_maker_note()
774 exif_mnote_data_load (data->priv->md, d, ds); in interpret_maker_note()
779 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData", \
783 exif_data_load_data (ExifData *data, const unsigned char *d_orig, in exif_data_load_data() argument
792 if (!data || !data->priv || !d || !ds) in exif_data_load_data()
795 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
807 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
840 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, in exif_data_load_data()
851 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
867 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, in exif_data_load_data()
872 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
888 data->priv->order = EXIF_BYTE_ORDER_INTEL; in exif_data_load_data()
890 data->priv->order = EXIF_BYTE_ORDER_MOTOROLA; in exif_data_load_data()
892 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, in exif_data_load_data()
898 if (exif_get_short (d + 8, data->priv->order) != 0x002a) in exif_data_load_data()
902 offset = exif_get_long (d + 10, data->priv->order); in exif_data_load_data()
903 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
911 exif_data_load_data_content (data, EXIF_IFD_0, d + 6, ds - 6, offset, 0); in exif_data_load_data()
914 n = exif_get_short (d + 6 + offset, data->priv->order); in exif_data_load_data()
918 offset = exif_get_long (d + 6 + offset + 2 + 12 * n, data->priv->order); in exif_data_load_data()
920 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_load_data()
925 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, in exif_data_load_data()
928 exif_data_load_data_content (data, EXIF_IFD_1, d + 6, ds - 6, offset, 0); in exif_data_load_data()
938 interpret_maker_note(data, d, fullds); in exif_data_load_data()
941 if (data->priv->options & EXIF_DATA_OPTION_FOLLOW_SPECIFICATION) in exif_data_load_data()
942 exif_data_fix (data); in exif_data_load_data()
946 exif_data_save_data (ExifData *data, unsigned char **d, unsigned int *ds) in exif_data_save_data() argument
951 if (!data || !d || !ds) in exif_data_save_data()
956 *d = exif_data_alloc (data, *ds); in exif_data_save_data()
964 if (data->priv->order == EXIF_BYTE_ORDER_INTEL) { in exif_data_save_data()
971 exif_set_short (*d + 8, data->priv->order, 0x002a); in exif_data_save_data()
979 exif_set_long (*d + 10, data->priv->order, 8); in exif_data_save_data()
982 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_save_data()
984 exif_data_save_data_content (data, data->ifd[EXIF_IFD_0], d, ds, in exif_data_save_data()
986 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", in exif_data_save_data()
1005 exif_data_ref (ExifData *data) in exif_data_ref() argument
1007 if (!data) in exif_data_ref()
1010 data->priv->ref_count++; in exif_data_ref()
1014 exif_data_unref (ExifData *data) in exif_data_unref() argument
1016 if (!data) in exif_data_unref()
1019 data->priv->ref_count--; in exif_data_unref()
1020 if (!data->priv->ref_count) in exif_data_unref()
1021 exif_data_free (data); in exif_data_unref()
1025 exif_data_free (ExifData *data) in exif_data_free() argument
1028 ExifMem *mem = (data && data->priv) ? data->priv->mem : NULL; in exif_data_free()
1030 if (!data) in exif_data_free()
1034 if (data->ifd[i]) { in exif_data_free()
1035 exif_content_unref (data->ifd[i]); in exif_data_free()
1036 data->ifd[i] = NULL; in exif_data_free()
1040 if (data->data) { in exif_data_free()
1041 exif_mem_free (mem, data->data); in exif_data_free()
1042 data->data = NULL; in exif_data_free()
1045 if (data->priv) { in exif_data_free()
1046 if (data->priv->log) { in exif_data_free()
1047 exif_log_unref (data->priv->log); in exif_data_free()
1048 data->priv->log = NULL; in exif_data_free()
1050 if (data->priv->md) { in exif_data_free()
1051 exif_mnote_data_unref (data->priv->md); in exif_data_free()
1052 data->priv->md = NULL; in exif_data_free()
1054 exif_mem_free (mem, data->priv); in exif_data_free()
1055 exif_mem_free (mem, data); in exif_data_free()
1062 exif_data_dump (ExifData *data) in exif_data_dump() argument
1066 if (!data) in exif_data_dump()
1070 if (data->ifd[i] && data->ifd[i]->count) { in exif_data_dump()
1073 exif_content_dump (data->ifd[i], 0); in exif_data_dump()
1077 if (data->data) { in exif_data_dump()
1078 printf ("%i byte(s) thumbnail data available.", data->size); in exif_data_dump()
1079 if (data->size >= 4) { in exif_data_dump()
1081 data->data[0], data->data[1], in exif_data_dump()
1082 data->data[data->size - 2], in exif_data_dump()
1083 data->data[data->size - 1]); in exif_data_dump()
1089 exif_data_get_byte_order (ExifData *data) in exif_data_get_byte_order() argument
1091 if (!data) in exif_data_get_byte_order()
1094 return (data->priv->order); in exif_data_get_byte_order()
1098 exif_data_foreach_content (ExifData *data, ExifDataForeachContentFunc func, in exif_data_foreach_content() argument
1103 if (!data || !func) in exif_data_foreach_content()
1107 func (data->ifd[i], user_data); in exif_data_foreach_content()
1116 entry_set_byte_order (ExifEntry *e, void *data) in entry_set_byte_order() argument
1118 ByteOrderChangeData *d = data; in entry_set_byte_order()
1123 exif_array_set_byte_order (e->format, e->data, e->components, d->old, d->new); in entry_set_byte_order()
1127 content_set_byte_order (ExifContent *content, void *data) in content_set_byte_order() argument
1129 exif_content_foreach_entry (content, entry_set_byte_order, data); in content_set_byte_order()
1133 exif_data_set_byte_order (ExifData *data, ExifByteOrder order) in exif_data_set_byte_order() argument
1137 if (!data || (order == data->priv->order)) in exif_data_set_byte_order()
1140 d.old = data->priv->order; in exif_data_set_byte_order()
1142 exif_data_foreach_content (data, content_set_byte_order, &d); in exif_data_set_byte_order()
1143 data->priv->order = order; in exif_data_set_byte_order()
1144 if (data->priv->md) in exif_data_set_byte_order()
1145 exif_mnote_data_set_byte_order (data->priv->md, order); in exif_data_set_byte_order()
1149 exif_data_log (ExifData *data, ExifLog *log) in exif_data_log() argument
1153 if (!data || !data->priv) in exif_data_log()
1155 exif_log_unref (data->priv->log); in exif_data_log()
1156 data->priv->log = log; in exif_data_log()
1160 exif_content_log (data->ifd[i], log); in exif_data_log()
1166 exif_data_get_log (ExifData *data) in exif_data_get_log() argument
1168 if (!data || !data->priv) in exif_data_get_log()
1170 return data->priv->log; in exif_data_get_log()
1230 fix_func (ExifContent *c, void *UNUSED(data)) in fix_func() argument
1234 if (c->parent->data) in fix_func()