42 printf(
" Entry %u: %s (%s)\n"
43 " Size, Comps: %d, %d\n"
58 static unsigned content_count;
71 printf(
" MakerNote\n");
72 for (i=0; i < num; ++i) {
78 printf(
" Entry %u: %u, %s\n"
80 " Value: %s\n", i,
id,
name, (
unsigned)strlen(buf), buf);
87static void test_parse(
const char *filename,
void *callback_data,
int swap)
95 const char *fn = strrchr(filename,
'/');
100 printf(
"File %s\n", fn);
105 fd = open(filename,O_RDONLY);
110 if (-1 == fstat(fd, &stbuf)) {
114 data = malloc(stbuf.st_size);
116 fprintf (stderr,
"Failed to allocate %ld bytes for reading %s\n", (
long)stbuf.st_size, filename);
119 if (-1 == read(fd, data, stbuf.st_size)) {
130 fprintf (stderr,
"Could not load data from '%s'!\n", filename);
133 printf(
"Byte order: %s\n",
144 printf(
"New byte order: %s\n",
163 const char *start =
string;
164 const char *p = start;
166 if (*p ==
' ' || *p ==
'\t' || *p ==
'\n' || *p ==
'\r' || *p ==
'\0' ) {
167 size_t len = p-start;
170 char *str = malloc(1+len);
172 memcpy(str, start, len);
174 func(str, callback_data, 0);
191int main(
const int argc,
const char *argv[])
194 void *callback_data = NULL;
198 if (argc > 1 && !strcmp(argv[1],
"--swap-byte-order")) {
204 for (i=first; i<argc; i++) {
210 const char *envar = getenv(
"TEST_IMAGES");
const char * exif_byte_order_get_name(ExifByteOrder order)
Return a short, localized, textual name for the given byte order.
ExifByteOrder
Which byte order to use.
@ EXIF_BYTE_ORDER_INTEL
Little-endian byte order.
@ EXIF_BYTE_ORDER_MOTOROLA
Big-endian byte order.
ExifIfd exif_content_get_ifd(ExifContent *c)
Return the IFD number in which the given ExifContent is found.
void exif_content_foreach_entry(ExifContent *content, ExifContentForeachEntryFunc func, void *data)
Executes function on each EXIF tag in this IFD in turn.
void exif_data_set_byte_order(ExifData *data, ExifByteOrder order)
Set the byte order to use for this EXIF data.
void exif_data_unref(ExifData *data)
ExifByteOrder exif_data_get_byte_order(ExifData *data)
Return the byte order in use by this EXIF structure.
ExifMnoteData * exif_data_get_mnote_data(ExifData *d)
Return the MakerNote data out of the EXIF data.
ExifData * exif_data_new_from_data(const unsigned char *data, unsigned int size)
Allocate a new ExifData and load EXIF data from a memory buffer.
ExifData * exif_data_new_from_file(const char *path)
Allocate a new ExifData and load EXIF data from a JPEG file.
void exif_data_foreach_content(ExifData *data, ExifDataForeachContentFunc func, void *user_data)
Execute a function on each IFD in turn.
Defines the ExifData type and the associated functions.
const char * exif_entry_get_value(ExifEntry *e, char *val, unsigned int maxlen)
Return a localized textual representation of the value of the EXIF entry.
char * exif_mnote_data_get_value(ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen)
Return a textual representation of the value of the MakerNote entry.
unsigned int exif_mnote_data_get_id(ExifMnoteData *d, unsigned int n)
Return the MakerNote tag number for the tag at the specified index within the MakerNote.
const char * exif_mnote_data_get_name(ExifMnoteData *d, unsigned int n)
Returns textual name of the given MakerNote tag.
unsigned int exif_mnote_data_count(ExifMnoteData *d)
Return the number of tags in the MakerNote.
System specific definitions, not for installation!
const char * exif_tag_get_name(ExifTag tag)
Represents the entire EXIF data found in an image.
Data found in one EXIF tag.
unsigned long components
Number of elements in the array, if this is an array entry.
ExifFormat format
Type of data in this entry.
ExifTag tag
EXIF tag for this entry.
unsigned int size
Number of bytes in the buffer at data.
void(* test_parse_func)(const char *filename, void *callback_data, int swap)
static unsigned entry_count
static void data_foreach_func(ExifContent *content, void *callback_data)
static void test_parse(const char *filename, void *callback_data, int swap)
static void content_foreach_func(ExifEntry *entry, void *UNUSED(callback_data))
static void dump_makernote(ExifData *d)
static void split_ws_string(const char *string, test_parse_func func, void *callback_data)