From 2c4f57e0c350869b646b5743a91f8c0e9a43caf1 Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Mon, 16 Mar 2009 23:36:13 +0100 Subject: [PATCH] 2009-03-16 Lutz Mueller * libexif/canon/exif-mnote-data-canon.c: (exif_mnote_data_canon_load): Fix the coding style in this function to make it easier to read. --- ChangeLog | 6 ++++ libexif/canon/exif-mnote-data-canon.c | 55 +++++++++++++++++------------------ 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71ec8bd..6710cc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-16 Lutz Mueller + + * libexif/canon/exif-mnote-data-canon.c: + (exif_mnote_data_canon_load): Fix the coding style in this function + to make it easier to read. + 2009-02-02 Dan Fandrich * Added AC_C_INLINE to configure.ac to define the inline keyword diff --git a/libexif/canon/exif-mnote-data-canon.c b/libexif/canon/exif-mnote-data-canon.c index 8d1b5f5..f23aeb8 100644 --- a/libexif/canon/exif-mnote-data-canon.c +++ b/libexif/canon/exif-mnote-data-canon.c @@ -208,47 +208,46 @@ exif_mnote_data_canon_load (ExifMnoteData *ne, for (i = 0; i < c; i++) { o = 6 + 2 + n->offset + 12 * i; if (o + 8 > buf_size) { - exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, - "ExifMnoteCanon", - "Short MakerNote"); - return; + exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, + "ExifMnoteCanon", "Short MakerNote"); + return; } t = exif_mem_realloc (ne->mem, n->entries, - sizeof (MnoteCanonEntry) * (i + 1)); + sizeof (MnoteCanonEntry) * (i + 1)); if (!t) return; /* out of memory */ n->count = i + 1; n->entries = t; memset (&n->entries[i], 0, sizeof (MnoteCanonEntry)); - n->entries[i].tag = exif_get_short (buf + o, n->order); - n->entries[i].format = exif_get_short (buf + o + 2, n->order); - n->entries[i].components = exif_get_long (buf + o + 4, n->order); - n->entries[i].order = n->order; - - exif_log (ne->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteCanon", - "Loading entry 0x%x ('%s')...", n->entries[i].tag, - mnote_canon_tag_get_name (n->entries[i].tag)); - - /* - * Size? If bigger than 4 bytes, the actual data is not - * in the entry but somewhere else (offset). - */ - s = exif_format_get_size (n->entries[i].format) * n->entries[i].components; + n->entries[i].tag = exif_get_short (buf + o, n->order); + n->entries[i].format = exif_get_short (buf + o + 2, n->order); + n->entries[i].components = exif_get_long (buf + o + 4, n->order); + n->entries[i].order = n->order; + + exif_log (ne->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteCanon", + "Loading entry 0x%x ('%s')...", n->entries[i].tag, + mnote_canon_tag_get_name (n->entries[i].tag)); + + /* + * Size? If bigger than 4 bytes, the actual data is not + * in the entry but somewhere else (offset). + */ + s = exif_format_get_size (n->entries[i].format) * n->entries[i].components; if (!s) { - exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, - "ExifMnoteCanon", - "Invalid zero-length tag size"); - return; - } + exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, + "ExifMnoteCanon", + "Invalid zero-length tag size"); + return; + } o += 8; if (s > 4) o = exif_get_long (buf + o, n->order) + 6; if (o + s > buf_size) { exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, - "ExifMnoteCanon", - "Tag data past end of buffer (%u > %u)", - o+s, buf_size); + "ExifMnoteCanon", + "Tag data past end of buffer (%u > %u)", + o + s, buf_size); return; - } + } /* Sanity check */ n->entries[i].data = exif_mem_alloc (ne->mem, sizeof (char) * s); -- 2.7.4