33#define CHECKOVERFLOW(offset,datasize,structsize) (( (offset) >= (datasize)) || ((structsize) > (datasize)) || ((offset) > (datasize) - (structsize) ))
48 for (i = 0; i < n->
count; i++)
72 if (!d || !val)
return NULL;
73 if (i >= n->
count)
return NULL;
84 unsigned int *buf_size)
91 if (!n || !buf || !buf_size)
return;
97 *buf_size = 8 + 4 + 2 + n->
count * 12 + 4;
108 memcpy (*buf,
"FUJIFILM", 8);
115 for (i = 0; i < n->
count; i++) {
116 o = 8 + 4 + 2 + i * 12;
140 doff = *buf_size - s;
141 if (s & 1) { doff--; *(*buf + *buf_size - 1) =
'\0'; }
150 if (!n->
entries[i].
data) memset (*buf + doff, 0, s);
157 const unsigned char *buf,
unsigned int buf_size)
161 size_t i, tcount, o, datao;
165 if (!buf || !buf_size) {
167 "ExifMnoteDataFuji",
"Short MakerNote");
172 "ExifMnoteDataFuji",
"Short MakerNote");
182 "ExifMnoteDataFuji",
"Short MakerNote");
210 for (i = c, o = datao; i; --i, o += 12) {
216 "ExifMnoteDataFuji",
"Short MakerNote");
226 "Loading entry 0x%x ('%s')...", n->
entries[tcount].
tag,
245 size_t dataofs = o + 8;
252 "ExifMnoteDataFuji",
"Tag data past end of "
253 "buffer (%u >= %u)", (
unsigned)(dataofs + s), buf_size);
262 memcpy (n->
entries[tcount].
data, buf + dataofs, s);
284 if (note->
count <= n)
return 0;
294 if (i >= n->
count)
return NULL;
304 if (i >= n->
count)
return NULL;
314 if (i >= n->
count)
return NULL;
329 for (i = 0; i < n->
count; i++) {
348 return ((e->
size >= 12) && !memcmp (e->
data,
"FUJIFILM", 8));
356 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.
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 const char * exif_mnote_data_fuji_get_title(ExifMnoteData *d, unsigned int i)
static void exif_mnote_data_fuji_load(ExifMnoteData *en, const unsigned char *buf, unsigned int buf_size)
static void exif_mnote_data_fuji_set_offset(ExifMnoteData *n, unsigned int o)
static const char * exif_mnote_data_fuji_get_description(ExifMnoteData *d, unsigned int i)
static void exif_mnote_data_fuji_save(ExifMnoteData *ne, unsigned char **buf, unsigned int *buf_size)
static unsigned int exif_mnote_data_fuji_count(ExifMnoteData *n)
ExifMnoteData * exif_mnote_data_fuji_new(ExifMem *mem)
int exif_mnote_data_fuji_identify(const ExifData *ed, const ExifEntry *e)
Detect if MakerNote is recognized as one handled by the Fuji module.
static unsigned int exif_mnote_data_fuji_get_id(ExifMnoteData *d, unsigned int n)
static const char * exif_mnote_data_fuji_get_name(ExifMnoteData *d, unsigned int i)
static void exif_mnote_data_fuji_free(ExifMnoteData *n)
#define CHECKOVERFLOW(offset, datasize, structsize)
static void exif_mnote_data_fuji_clear(ExifMnoteDataFuji *n)
static void exif_mnote_data_fuji_set_byte_order(ExifMnoteData *d, ExifByteOrder o)
static char * exif_mnote_data_fuji_get_value(ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
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.
uint32_t ExifLong
EXIF Unsigned Long data type.
uint16_t ExifShort
EXIF Unsigned Short data type.
char * mnote_fuji_entry_get_value(MnoteFujiEntry *entry, char *val, unsigned int maxlen)
const char * mnote_fuji_tag_get_name(MnoteFujiTag t)
const char * mnote_fuji_tag_get_title(MnoteFujiTag t)
const char * mnote_fuji_tag_get_description(MnoteFujiTag 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 *)
ExifMnoteDataMethods methods