EXIF library (libexif) Internals  0.6.24
exif-content.c File Reference
#include <config.h>
#include <libexif/exif-content.h>
#include <libexif/exif-system.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for exif-content.c:

Go to the source code of this file.

Data Structures

struct  _ExifContentPrivate
 

Functions

ExifContentexif_content_new (void)
 Reserve memory for and initialize a new ExifContent. More...
 
ExifContentexif_content_new_mem (ExifMem *mem)
 Reserve memory for and initialize new ExifContent using the specified memory allocator. More...
 
void exif_content_ref (ExifContent *content)
 Increase reference counter for ExifContent. More...
 
void exif_content_unref (ExifContent *content)
 Decrease reference counter for ExifContent. More...
 
void exif_content_free (ExifContent *content)
 Actually free the ExifContent. More...
 
void exif_content_dump (ExifContent *content, unsigned int indent)
 Dump contents of the IFD to stdout. More...
 
void exif_content_add_entry (ExifContent *c, ExifEntry *entry)
 Add an EXIF tag to an IFD. More...
 
void exif_content_remove_entry (ExifContent *c, ExifEntry *e)
 Remove an EXIF tag from an IFD. More...
 
ExifEntryexif_content_get_entry (ExifContent *content, ExifTag tag)
 Return the ExifEntry in this IFD corresponding to the given tag. More...
 
void exif_content_foreach_entry (ExifContent *content, ExifContentForeachEntryFunc func, void *data)
 Executes function on each EXIF tag in this IFD in turn. More...
 
void exif_content_log (ExifContent *content, ExifLog *log)
 Set the log message object for this IFD. More...
 
ExifIfd exif_content_get_ifd (ExifContent *c)
 Return the IFD number in which the given ExifContent is found. More...
 
static void fix_func (ExifEntry *e, void *UNUSED(data))
 
static void remove_not_recorded (ExifEntry *e, void *UNUSED(data))
 Check if this entry is unknown and if so, delete it. More...
 
void exif_content_fix (ExifContent *c)
 Fix the IFD to bring it into specification. More...
 

Function Documentation

◆ exif_content_add_entry()

void exif_content_add_entry ( ExifContent c,
ExifEntry entry 
)

Add an EXIF tag to an IFD.

If this tag already exists in the IFD, this function does nothing.

Precondition
The "tag" member of the entry must be set on entry.
Parameters
[out]cIFD
[in]entryEXIF entry to add

Definition at line 139 of file exif-content.c.

References _ExifContent::count, _ExifContent::entries, exif_content_get_entry(), exif_entry_ref(), exif_log(), EXIF_LOG_CODE_DEBUG, exif_mem_realloc(), exif_tag_get_name(), _ExifContentPrivate::log, _ExifContentPrivate::mem, _ExifEntry::parent, _ExifContent::priv, and _ExifEntry::tag.

Referenced by content_null_test(), exif_content_fix(), exif_data_load_data_content(), and main().

Here is the call graph for this function:

◆ exif_content_dump()

void exif_content_dump ( ExifContent content,
unsigned int  indent 
)

Dump contents of the IFD to stdout.

This is intended for diagnostic purposes only.

Parameters
[in]contentIFD data
[in]indenthow many levels deep to indent the data

Definition at line 120 of file exif-content.c.

References _ExifContent::count, _ExifContent::entries, exif_entry_dump(), and MIN.

Referenced by content_null_test(), and exif_data_dump().

Here is the call graph for this function:

◆ exif_content_fix()

void exif_content_fix ( ExifContent c)

Fix the IFD to bring it into specification.

Call exif_entry_fix on each entry in this IFD to fix existing entries, create any new entries that are mandatory in this IFD but do not yet exist, and remove any entries that are not allowed in this IFD.

Parameters
[in,out]cEXIF content for an IFD

Definition at line 284 of file exif-content.c.

References _ExifContent::count, exif_content_add_entry(), exif_content_foreach_entry(), exif_content_get_entry(), exif_content_get_ifd(), exif_data_get_data_type(), exif_entry_initialize(), exif_entry_new(), exif_entry_unref(), exif_ifd_get_name(), exif_log(), EXIF_LOG_CODE_DEBUG, EXIF_SUPPORT_LEVEL_MANDATORY, exif_tag_get_name_in_ifd(), exif_tag_get_support_level_in_ifd(), exif_tag_table_count(), exif_tag_table_get_tag(), fix_func(), ifd, _ExifContentPrivate::log, _ExifContent::parent, _ExifContent::priv, and remove_not_recorded().

Referenced by content_null_test(), and fix_func().

Here is the call graph for this function:

◆ exif_content_foreach_entry()

void exif_content_foreach_entry ( ExifContent content,
ExifContentForeachEntryFunc  func,
void *  user_data 
)

Executes function on each EXIF tag in this IFD in turn.

The tags will not necessarily be visited in numerical order.

Parameters
[in,out]contentIFD over which to iterate
[in]funcfunction to call for each entry
[in]user_datadata to pass into func on each call

Definition at line 216 of file exif-content.c.

References _ExifContent::count, and _ExifContent::entries.

Referenced by content_null_test(), content_set_byte_order(), data_foreach_func(), and exif_content_fix().

◆ exif_content_free()

void exif_content_free ( ExifContent content)

Actually free the ExifContent.

Deprecated:
Should not be called directly. Use exif_content_ref and exif_content_unref instead.
Parameters
[in]contentExifContent

Definition at line 99 of file exif-content.c.

References _ExifContent::count, _ExifContent::entries, exif_entry_unref(), exif_log_unref(), exif_mem_free(), exif_mem_unref(), _ExifContentPrivate::log, _ExifContentPrivate::mem, and _ExifContent::priv.

Referenced by content_null_test(), and exif_content_unref().

Here is the call graph for this function:

◆ exif_content_get_entry()

ExifEntry* exif_content_get_entry ( ExifContent content,
ExifTag  tag 
)

Return the ExifEntry in this IFD corresponding to the given tag.

This is a pointer into a member of the ExifContent array and must NOT be freed or unrefed by the caller.

Parameters
[in]contentEXIF content for an IFD
[in]tagEXIF tag to return
Returns
ExifEntry of the tag, or NULL on error

Definition at line 202 of file exif-content.c.

References _ExifContent::count, _ExifContent::entries, tag, and _ExifEntry::tag.

Referenced by content_null_test(), entry_null_test(), exif_content_add_entry(), exif_content_fix(), and exif_entry_get_value().

◆ exif_content_get_ifd()

ExifIfd exif_content_get_ifd ( ExifContent c)

Return the IFD number in which the given ExifContent is found.

Parameters
[in]can ExifContent*
Returns
IFD number, or EXIF_IFD_COUNT on error

Definition at line 240 of file exif-content.c.

References EXIF_IFD_0, EXIF_IFD_1, EXIF_IFD_COUNT, EXIF_IFD_EXIF, EXIF_IFD_GPS, EXIF_IFD_INTEROPERABILITY, and _ExifContent::parent.

Referenced by content_null_test(), data_foreach_func(), exif_content_fix(), and fix_func().

◆ exif_content_log()

void exif_content_log ( ExifContent content,
ExifLog log 
)

Set the log message object for this IFD.

Parameters
[in]contentIFD
[in]logExifLog*

Definition at line 229 of file exif-content.c.

References exif_log_ref(), exif_log_unref(), _ExifContentPrivate::log, and _ExifContent::priv.

Referenced by content_null_test(), and exif_data_log().

Here is the call graph for this function:

◆ exif_content_new()

ExifContent* exif_content_new ( void  )

Reserve memory for and initialize a new ExifContent.

Returns
new allocated ExifContent, or NULL on error
See also
exif_content_new_mem, exif_content_unref

Definition at line 43 of file exif-content.c.

References exif_content_new_mem(), exif_mem_new_default(), and exif_mem_unref().

Referenced by content_null_test().

Here is the call graph for this function:

◆ exif_content_new_mem()

ExifContent* exif_content_new_mem ( ExifMem mem)

Reserve memory for and initialize new ExifContent using the specified memory allocator.

Returns
new allocated ExifContent, or NULL on error
See also
exif_content_new, exif_content_unref

Definition at line 54 of file exif-content.c.

References exif_mem_alloc(), exif_mem_free(), exif_mem_ref(), _ExifContentPrivate::mem, _ExifContent::priv, and _ExifContentPrivate::ref_count.

Referenced by content_null_test(), exif_content_new(), and exif_data_new_mem().

Here is the call graph for this function:

◆ exif_content_ref()

void exif_content_ref ( ExifContent content)

Increase reference counter for ExifContent.

Parameters
[in]contentExifContent
See also
exif_content_unref

Definition at line 79 of file exif-content.c.

References _ExifContent::priv, and _ExifContentPrivate::ref_count.

Referenced by content_null_test().

◆ exif_content_remove_entry()

void exif_content_remove_entry ( ExifContent c,
ExifEntry e 
)

Remove an EXIF tag from an IFD.

If this tag does not exist in the IFD, this function does nothing.

Parameters
[out]cIFD
[in]eEXIF entry to remove

Definition at line 163 of file exif-content.c.

References _ExifContent::count, _ExifContent::entries, exif_entry_unref(), exif_mem_free(), exif_mem_realloc(), _ExifContentPrivate::mem, _ExifEntry::parent, and _ExifContent::priv.

Referenced by content_null_test(), fix_func(), main(), and remove_not_recorded().

Here is the call graph for this function:

◆ exif_content_unref()

void exif_content_unref ( ExifContent content)

Decrease reference counter for ExifContent.

When the reference count drops to zero, free the content.

Parameters
[in]contentExifContent

Definition at line 88 of file exif-content.c.

References exif_content_free(), _ExifContent::priv, and _ExifContentPrivate::ref_count.

Referenced by content_null_test(), and exif_data_free().

Here is the call graph for this function:

◆ fix_func()

static void fix_func ( ExifEntry e,
void *  UNUSEDdata 
)
static

Definition at line 254 of file exif-content.c.

References exif_entry_fix().

Referenced by exif_content_fix().

Here is the call graph for this function:

◆ remove_not_recorded()

static void remove_not_recorded ( ExifEntry e,
void *  UNUSEDdata 
)
static

Check if this entry is unknown and if so, delete it.

Note
Be careful calling this function in a loop. Deleting an entry from an ExifContent changes the index of subsequent entries, as well as the total size of the entries array.

Definition at line 266 of file exif-content.c.

References exif_content_remove_entry(), exif_data_get_data_type(), exif_entry_get_ifd, exif_ifd_get_name(), exif_log(), EXIF_LOG_CODE_DEBUG, EXIF_SUPPORT_LEVEL_NOT_RECORDED, exif_tag_get_support_level_in_ifd(), ifd, _ExifContentPrivate::log, _ExifContent::parent, _ExifEntry::parent, _ExifContent::priv, and _ExifEntry::tag.

Referenced by exif_content_fix().

Here is the call graph for this function:

libexif Generated by doxygen