41 printf(
" Entry %u: %s (%s)\n"
42 " Size, Comps: %d, %d\n"
57 static unsigned content_count;
70 printf(
" MakerNote\n");
71 for (i=0; i < num; ++i) {
77 printf(
" Entry %u: %u, %s\n"
79 " Value: %s\n", i,
id,
name, (
unsigned)strlen(buf), buf);
86 static void test_parse(
const char *filename,
void *callback_data,
int swap)
94 const char *fn = strrchr(filename,
'/');
99 printf(
"File %s\n", fn);
102 fd = open(filename,O_RDONLY);
107 if (-1 == fstat(fd, &stbuf)) {
111 data = malloc(stbuf.st_size);
113 fprintf (stderr,
"Failed to allocate %ld bytes for reading %s\n", stbuf.st_size, filename);
116 if (-1 == read(fd, data, stbuf.st_size)) {
126 fprintf (stderr,
"Could not load data from '%s'!\n", filename);
130 printf(
"Byte order: %s\n",
141 printf(
"New byte order: %s\n",
154 typedef void (*
test_parse_func) (
const char *filename,
void *callback_data,
int swap);
160 const char *start =
string;
161 const char *p = start;
163 if (*p ==
' ' || *p ==
'\t' || *p ==
'\n' || *p ==
'\r' || *p ==
'\0' ) {
164 size_t len = p-start;
167 char *str = malloc(1+len);
169 memcpy(str, start, len);
171 func(str, callback_data, 0);
188 int main(
const int argc,
const char *argv[])
191 void *callback_data = NULL;
195 if (argc > 1 && !strcmp(argv[1],
"--swap-byte-order")) {
201 for (i=first; i<argc; i++) {
207 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.
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.
ExifMnoteData * exif_data_get_mnote_data(ExifData *d)
Return the MakerNote data out of the EXIF data.
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.
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_get_id(ExifMnoteData *d, unsigned int n)
Return the MakerNote tag number for the tag at the specified index within the MakerNote.
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)
int main(const int argc, const char *argv[])