33#define CHECKOVERFLOW(offset,datasize,structsize) (( (offset) >= (datasize)) || ((structsize) > (datasize)) || ((offset) > (datasize) - (structsize) ))
44 for (i = 0; i < n->
count; i++)
69 if (n->
count <= i)
return NULL;
82 unsigned char **buf,
unsigned int *buf_size)
89 if (!n || !buf || !buf_size)
return;
97 *buf_size = o2 + 2 + n->
count * 12 + 4;
107 strcpy ((
char *)*buf,
"QVC");
121 strcpy ((
char *)*buf,
"AOC");
137 strcpy ((
char *)*buf,
"AOC");
163 for (i = 0; i < n->
count; i++) {
167 size_t o = o2 + i * 12;
184 size_t ts = *buf_size + s;
203 memset (*buf + doff, 0, s);
208 if (*buf_size < (o2 + n->
count * 12 + 4)) {
219 const unsigned char *buf,
unsigned int buf_size)
222 size_t i, tcount, o, datao, base = 0;
227 if (!buf || !buf_size) {
229 "ExifMnoteDataPentax",
"Short MakerNote");
235 "ExifMnoteDataPentax",
"Short MakerNote");
240 if (!memcmp(buf + datao,
"AOC", 4)) {
241 if ((buf[datao + 4] ==
'I') && (buf[datao + 5] ==
'I')) {
244 }
else if ((buf[datao + 4] ==
'M') && (buf[datao + 5] ==
'M')) {
252 "Parsing Pentax maker note v%d...", (
int)n->
version);
255 }
else if (!memcmp(buf + datao,
"QVC", 4)) {
257 "Parsing Casio maker note v2...");
264 "Parsing Pentax maker note v1...");
292 for (i = c, o = datao; i; --i, o += 12) {
298 "ExifMnoteDataPentax",
"Short MakerNote");
308 "Loading entry 0x%x ('%s')...", n->
entries[tcount].
tag,
328 size_t dataofs = o + 8;
335 "ExifMnoteDataPentax",
"Tag data past end "
336 "of buffer (%u > %u)", (
unsigned)(dataofs + s), buf_size);
345 memcpy (n->
entries[tcount].
data, buf + dataofs, s);
367 if (note->
count <= n)
return 0;
376 if (!note)
return NULL;
377 if (note->
count <= n)
return NULL;
386 if (!note)
return NULL;
387 if (note->
count <= n)
return NULL;
396 if (!note)
return NULL;
397 if (note->
count <= n)
return NULL;
418 for (i = 0; i < n->
count; i++) {
431 if ((e->
size >= 8) && !memcmp (e->
data,
"AOC", 4)) {
432 if (((e->
data[4] ==
'I') && (e->
data[5] ==
'I')) ||
433 ((e->
data[4] ==
'M') && (e->
data[5] ==
'M')))
440 if ((e->
size >= 8) && !memcmp (e->
data,
"QVC", 4))
445 if ((e->
size >= 2) && (e->
data[0] == 0x00) && (e->
data[1] == 0x1b))
456 if (!mem)
return NULL;
Defines the ExifByteOrder enum and the associated functions.
ExifByteOrder
Which byte order to use.
@ EXIF_BYTE_ORDER_INTEL
Little-endian byte order.
@ EXIF_BYTE_ORDER_MOTOROLA
Big-endian byte order.
void exif_log(ExifLog *log, ExifLogCode code, const char *domain, const char *format,...)
@ EXIF_LOG_CODE_CORRUPT_DATA
#define EXIF_LOG_NO_MEMORY(l, d, s)
void exif_mem_free(ExifMem *mem, void *d)
void * exif_mem_alloc(ExifMem *mem, ExifLong ds)
void * exif_mem_realloc(ExifMem *mem, void *d, ExifLong ds)
static void exif_mnote_data_pentax_set_byte_order(ExifMnoteData *d, ExifByteOrder o)
int exif_mnote_data_pentax_identify(const ExifData *ed, const ExifEntry *e)
Detect if MakerNote is recognized as one handled by the Pentax module.
static void exif_mnote_data_pentax_set_offset(ExifMnoteData *d, unsigned int o)
static void exif_mnote_data_pentax_load(ExifMnoteData *en, const unsigned char *buf, unsigned int buf_size)
static unsigned int exif_mnote_data_pentax_count(ExifMnoteData *n)
static const char * exif_mnote_data_pentax_get_title(ExifMnoteData *d, unsigned int n)
static char * exif_mnote_data_pentax_get_value(ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
static void exif_mnote_data_pentax_clear(ExifMnoteDataPentax *n)
ExifMnoteData * exif_mnote_data_pentax_new(ExifMem *mem)
static const char * exif_mnote_data_pentax_get_description(ExifMnoteData *d, unsigned int n)
static void exif_mnote_data_pentax_free(ExifMnoteData *n)
static unsigned int exif_mnote_data_pentax_get_id(ExifMnoteData *d, unsigned int n)
static void exif_mnote_data_pentax_save(ExifMnoteData *ne, unsigned char **buf, unsigned int *buf_size)
save the MnoteData from ne to buf
#define CHECKOVERFLOW(offset, datasize, structsize)
static const char * exif_mnote_data_pentax_get_name(ExifMnoteData *d, unsigned int n)
void exif_mnote_data_construct(ExifMnoteData *, ExifMem *mem)
ExifLong exif_get_long(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifLong value from memory.
ExifShort exif_get_short(const unsigned char *buf, ExifByteOrder order)
Retrieve an ExifShort value from memory.
void exif_array_set_byte_order(ExifFormat f, unsigned char *b, unsigned int n, ExifByteOrder o_orig, ExifByteOrder o_new)
void exif_set_long(unsigned char *b, ExifByteOrder order, ExifLong value)
Store an ExifLong value into memory in EXIF format.
void exif_set_short(unsigned char *b, ExifByteOrder order, ExifShort value)
Store an ExifShort value into memory in EXIF format.
EXIF data manipulation functions and types.
uint16_t ExifShort
EXIF Unsigned Short data type.
char * mnote_pentax_entry_get_value(MnotePentaxEntry *entry, char *val, unsigned int maxlen)
const char * mnote_pentax_tag_get_description(MnotePentaxTag t)
const char * mnote_pentax_tag_get_title(MnotePentaxTag t)
const char * mnote_pentax_tag_get_name(MnotePentaxTag t)
Represents the entire EXIF data found in an image.
Data found in one EXIF tag.
unsigned char * data
Pointer to the raw EXIF data for this entry.
unsigned int size
Number of bytes in the buffer at data.
const char *(* get_name)(ExifMnoteData *, unsigned int)
const char *(* get_description)(ExifMnoteData *, unsigned int)
void(* load)(ExifMnoteData *, const unsigned char *, unsigned int)
char *(* get_value)(ExifMnoteData *, unsigned int, char *val, unsigned int maxlen)
unsigned int(* get_id)(ExifMnoteData *, unsigned int)
void(* save)(ExifMnoteData *, unsigned char **, unsigned int *)
unsigned int(* count)(ExifMnoteData *)
void(* set_offset)(ExifMnoteData *, unsigned int)
const char *(* get_title)(ExifMnoteData *, unsigned int)
void(* set_byte_order)(ExifMnoteData *, ExifByteOrder)
void(* free)(ExifMnoteData *)
MnotePentaxEntry * entries
enum PentaxVersion version
ExifMnoteDataMethods methods