#include <config.h>
#include <libexif/exif-entry.h>
#include <libexif/exif-ifd.h>
#include <libexif/exif-utils.h>
#include <libexif/i18n.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <math.h>
Go to the source code of this file.
Data Structures | |
struct | _ExifEntryPrivate |
Defines | |
#define | M_PI 3.14159265358979323846 |
#define | CF(entry, target, v, maxlen) |
#define | CC(entry, target, v, maxlen) |
Functions | |
ExifLog * | exif_data_get_log (ExifData *) |
static void | exif_entry_log (ExifEntry *e, ExifLogCode code, const char *format,...) |
static void * | exif_entry_alloc (ExifEntry *e, unsigned int i) |
static void * | exif_entry_realloc (ExifEntry *e, void *d_orig, unsigned int i) |
ExifEntry * | exif_entry_new (void) |
Reserve memory for and initialize a new ExifEntry. | |
ExifEntry * | exif_entry_new_mem (ExifMem *mem) |
Reserve memory for and initialize new ExifEntry using the specified memory allocator. | |
void | exif_entry_ref (ExifEntry *e) |
Increase reference counter for ExifEntry. | |
void | exif_entry_unref (ExifEntry *e) |
Decrease reference counter for ExifEntry. | |
void | exif_entry_free (ExifEntry *e) |
Actually free the ExifEntry. | |
static ExifShort | exif_get_short_convert (const unsigned char *buf, ExifFormat format, ExifByteOrder order) |
Get a value and convert it to an ExifShort. | |
void | exif_entry_fix (ExifEntry *e) |
Fix the type or format of the given EXIF entry to bring it into spec. | |
static void | exif_entry_format_value (ExifEntry *e, char *val, size_t maxlen) |
Format the value of an ExifEntry for human display in a generic way. | |
void | exif_entry_dump (ExifEntry *e, unsigned int indent) |
Dump text representation of ExifEntry to stdout. | |
static int | match_repeated_char (const unsigned char *data, unsigned char ch, size_t n) |
Check if a string consists entirely of a single, repeated character. | |
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. | |
void | exif_entry_initialize (ExifEntry *e, ExifTag tag) |
Initialize an empty ExifEntry with default data in the correct format for the given tag. | |
Variables | |
struct { | |
ExifTag tag | |
const char * strings [10] | |
} | list [] |
struct { | |
ExifTag tag | |
struct { | |
int index | |
const char * values [4] | |
list of progressively shorter string descriptions; the longest one that fits will be selected | |
} elem [25] | |
} | list2 [] |
#define CC | ( | entry, | |||
target, | |||||
v, | |||||
maxlen | ) |
Value:
{ \ if (entry->components != target) { \ exif_entry_log (entry, EXIF_LOG_CODE_CORRUPT_DATA, \ _("The tag '%s' contains an invalid number of " \ "components (%i, expected %i)."), \ exif_tag_get_name (entry->tag), \ (int) entry->components, (int) target); \ break; \ } \ }
Definition at line 651 of file exif-entry.c.
#define CF | ( | entry, | |||
target, | |||||
v, | |||||
maxlen | ) |
Value:
{ \ if (entry->format != target) { \ exif_entry_log (entry, EXIF_LOG_CODE_CORRUPT_DATA, \ _("The tag '%s' contains data of an invalid " \ "format ('%s', expected '%s')."), \ exif_tag_get_name (entry->tag), \ exif_format_get_name (entry->format), \ exif_format_get_name (target)); \ break; \ } \ }
Definition at line 638 of file exif-entry.c.
#define M_PI 3.14159265358979323846 |
static void* exif_entry_alloc | ( | ExifEntry * | e, | |
unsigned int | i | |||
) | [static] |
Definition at line 73 of file exif-entry.c.
References exif_data_get_log(), EXIF_LOG_NO_MEMORY, exif_mem_alloc(), _ExifEntryPrivate::mem, _ExifContent::parent, _ExifEntry::parent, and _ExifEntry::priv.
Referenced by exif_entry_fix(), and exif_entry_initialize().
void exif_entry_dump | ( | ExifEntry * | entry, | |
unsigned int | indent | |||
) |
Dump text representation of ExifEntry to stdout.
This is intended for diagnostic purposes only.
[in] | entry | EXIF tag data |
[in] | indent | how many levels deep to indent the data |
Definition at line 592 of file exif-entry.c.
Referenced by exif_content_dump().
void exif_entry_fix | ( | ExifEntry * | entry | ) |
Fix the type or format of the given EXIF entry to bring it into spec.
If the data for this EXIF tag is in of the wrong type or is in an invalid format according to the EXIF specification, then it is converted to make it valid. This may involve, for example, converting an EXIF_FORMAT_LONG into a EXIF_FORMAT_SHORT. If the tag is unknown, its value is untouched.
[in,out] | entry | EXIF entry |
Definition at line 196 of file exif-entry.c.
Referenced by fix_func().
static void exif_entry_format_value | ( | ExifEntry * | e, | |
char * | val, | |||
size_t | maxlen | |||
) | [static] |
Format the value of an ExifEntry for human display in a generic way.
The output is localized. The formatting is independent of the tag number and is based entirely on the data type.
[in] | e | EXIF entry |
[out] | val | buffer in which to store value |
[in] | maxlen | one less than the length of the buffer val |
Definition at line 444 of file exif-entry.c.
References _, _ExifEntry::components, _ExifEntry::data, ExifSRational::denominator, ExifRational::denominator, exif_data_get_byte_order(), EXIF_FORMAT_ASCII, EXIF_FORMAT_BYTE, EXIF_FORMAT_DOUBLE, EXIF_FORMAT_FLOAT, exif_format_get_size(), EXIF_FORMAT_LONG, EXIF_FORMAT_RATIONAL, EXIF_FORMAT_SBYTE, EXIF_FORMAT_SHORT, EXIF_FORMAT_SLONG, EXIF_FORMAT_SRATIONAL, EXIF_FORMAT_SSHORT, EXIF_FORMAT_UNDEFINED, exif_get_long(), exif_get_rational(), exif_get_short(), exif_get_slong(), exif_get_srational(), exif_get_sshort(), _ExifEntry::format, MIN, ExifSRational::numerator, ExifRational::numerator, _ExifContent::parent, _ExifEntry::parent, and _ExifEntry::size.
Referenced by exif_entry_get_value().
void exif_entry_free | ( | ExifEntry * | entry | ) |
Actually free the ExifEntry.
[in] | entry | EXIF entry |
Definition at line 155 of file exif-entry.c.
Referenced by exif_entry_unref().
const char* exif_entry_get_value | ( | ExifEntry * | entry, | |
char * | val, | |||
unsigned int | maxlen | |||
) |
Return a localized textual representation of the value of the EXIF entry.
This is meant for display to the user. The format of each tag is subject to change between locales and in newer versions of libexif. Users who require the tag data in an unambiguous form should access the data members of the ExifEntry structure directly.
[in] | entry | EXIF entry |
[out] | val | buffer in which to store value |
[in] | maxlen | length of the buffer val |
Definition at line 830 of file exif-entry.c.
Referenced by content_foreach_func(), exif_entry_dump(), exif_mnote_data_canon_identify(), exif_mnote_data_olympus_identify(), and main().
Initialize an empty ExifEntry with default data in the correct format for the given tag.
Definition at line 1408 of file exif-entry.c.
Referenced by exif_content_fix(), and main().
static void exif_entry_log | ( | ExifEntry * | e, | |
ExifLogCode | code, | |||
const char * | format, | |||
... | ||||
) | [static] |
Definition at line 51 of file exif-entry.c.
References exif_data_get_log(), exif_logv(), _ExifContent::parent, and _ExifEntry::parent.
Referenced by exif_entry_fix(), and exif_entry_get_value().
ExifEntry* exif_entry_new | ( | void | ) |
Reserve memory for and initialize a new ExifEntry.
No memory is allocated for the data
element of the returned ExifEntry.
Definition at line 109 of file exif-entry.c.
Referenced by exif_content_fix(), and main().
Reserve memory for and initialize new ExifEntry using the specified memory allocator.
No memory is allocated for the data
element of the returned ExifEntry.
Definition at line 120 of file exif-entry.c.
Referenced by exif_data_load_data_content(), and exif_entry_new().
static void* exif_entry_realloc | ( | ExifEntry * | e, | |
void * | d_orig, | |||
unsigned int | i | |||
) | [static] |
Definition at line 90 of file exif-entry.c.
References exif_data_get_log(), EXIF_LOG_NO_MEMORY, exif_mem_free(), exif_mem_realloc(), _ExifEntryPrivate::mem, _ExifContent::parent, _ExifEntry::parent, and _ExifEntry::priv.
Referenced by exif_entry_fix().
void exif_entry_ref | ( | ExifEntry * | entry | ) |
Increase reference counter for ExifEntry.
[in] | entry | ExifEntry |
Definition at line 137 of file exif-entry.c.
Referenced by exif_content_add_entry().
void exif_entry_unref | ( | ExifEntry * | entry | ) |
Decrease reference counter for ExifEntry.
When the reference count drops to zero, free the entry.
[in] | entry | ExifEntry |
Definition at line 145 of file exif-entry.c.
Referenced by exif_content_fix(), exif_content_free(), exif_content_remove_entry(), exif_data_load_data_content(), and main().
static ExifShort exif_get_short_convert | ( | const unsigned char * | buf, | |
ExifFormat | format, | |||
ExifByteOrder | order | |||
) | [inline, static] |
Get a value and convert it to an ExifShort.
Definition at line 174 of file exif-entry.c.
References EXIF_FORMAT_BYTE, EXIF_FORMAT_LONG, EXIF_FORMAT_SBYTE, EXIF_FORMAT_SHORT, EXIF_FORMAT_SLONG, EXIF_FORMAT_SSHORT, exif_get_long(), exif_get_short(), exif_get_slong(), and exif_get_sshort().
Referenced by exif_entry_fix().
static int match_repeated_char | ( | const unsigned char * | data, | |
unsigned char | ch, | |||
size_t | n | |||
) | [static] |
Check if a string consists entirely of a single, repeated character.
Up to first n bytes are checked.
[in] | data | pointer of string to check |
[in] | ch | character to match |
[in] | n | maximum number of characters to match |
Definition at line 624 of file exif-entry.c.
Referenced by exif_entry_get_value().
struct { ... } elem[25] |
int index |
Definition at line 707 of file exif-entry.c.
Referenced by exif_entry_get_value(), mnote_fuji_entry_get_value(), mnote_olympus_entry_get_value(), and mnote_pentax_entry_get_value().
struct { ... } list[] [static] |
Referenced by exif_entry_get_value().
struct { ... } list2[] [static] |
Referenced by exif_entry_get_value().
const char* strings[10] |
Definition at line 705 of file exif-entry.c.
Definition at line 664 of file exif-entry.c.
const char* values[4] |
list of progressively shorter string descriptions; the longest one that fits will be selected
Definition at line 708 of file exif-entry.c.
Referenced by exif_entry_get_value().