31 #define CHECKOVERFLOW(offset,datasize,structsize) (( offset >= datasize) || (structsize > datasize) || (offset > datasize - structsize ))
46 for (i = 0; i < n->
count; i++)
70 if (!d || !val)
return NULL;
71 if (i > n->
count -1)
return NULL;
82 unsigned int *buf_size)
89 if (!n || !buf || !buf_size)
return;
95 *buf_size = 8 + 4 + 2 + n->
count * 12 + 4;
106 memcpy (*buf,
"FUJIFILM", 8);
113 for (i = 0; i < n->
count; i++) {
114 o = 8 + 4 + 2 + i * 12;
138 doff = *buf_size - s;
139 if (s & 1) { doff--; *(*buf + *buf_size - 1) =
'\0'; }
148 if (!n->
entries[i].
data) memset (*buf + doff, 0, s);
155 const unsigned char *buf,
unsigned int buf_size)
159 size_t i, tcount, o, datao;
161 if (!n || !buf || !buf_size) {
163 "ExifMnoteDataFuji",
"Short MakerNote");
169 "ExifMnoteDataFuji",
"Short MakerNote");
178 "ExifMnoteDataFuji",
"Short MakerNote");
206 for (i = c, o = datao; i; --i, o += 12) {
212 "ExifMnoteDataFuji",
"Short MakerNote");
222 "Loading entry 0x%x ('%s')...", n->
entries[tcount].
tag,
241 size_t dataofs = o + 8;
248 "ExifMnoteDataFuji",
"Tag data past end of "
249 "buffer (%u >= %u)", (
unsigned)(dataofs + s), buf_size);
258 memcpy (n->
entries[tcount].
data, buf + dataofs, s);
280 if (note->
count <= n)
return 0;
290 if (i >= n->
count)
return NULL;
300 if (i >= n->
count)
return NULL;
310 if (i >= n->
count)
return NULL;
325 for (i = 0; i < n->
count; i++) {
344 return ((e->
size >= 12) && !memcmp (e->
data,
"FUJIFILM", 8));
352 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_realloc(ExifMem *mem, void *d, ExifLong ds)
void exif_mem_free(ExifMem *mem, void *d)
void * exif_mem_alloc(ExifMem *mem, ExifLong ds)
ExifMnoteData * exif_mnote_data_fuji_new(ExifMem *mem)
static char * exif_mnote_data_fuji_get_value(ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
static const char * exif_mnote_data_fuji_get_name(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)
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 const char * exif_mnote_data_fuji_get_title(ExifMnoteData *d, unsigned int i)
static unsigned int exif_mnote_data_fuji_get_id(ExifMnoteData *d, unsigned int n)
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)
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_description)(ExifMnoteData *, unsigned int)
void(* load)(ExifMnoteData *, const unsigned char *, unsigned int)
const char *(* get_name)(ExifMnoteData *, unsigned int)
const char *(* get_title)(ExifMnoteData *, 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)
void(* set_byte_order)(ExifMnoteData *, ExifByteOrder)
void(* free)(ExifMnoteData *)
ExifMnoteDataMethods methods