This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 427d2740236f2b4c0e9045282ca3d8d1cc37042a (commit) via 7ced426dcbac270e05d48913f2611f34e48eeb40 (commit) from aef381e3ac79970a4167fd9f0d5d681e4203ef5e (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/427d2740236f2b4c0e9045282ca3d8d1cc370...
commit 427d2740236f2b4c0e9045282ca3d8d1cc37042a Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 3 11:22:32 2012 +0200
loaders: Make use of edhanced debug messages.
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c index 72e4c86..2c40f47 100644 --- a/libs/loaders/GP_JPG.c +++ b/libs/loaders/GP_JPG.c @@ -219,7 +219,7 @@ static void read_jpg_metadata(struct jpeg_decompress_struct *cinfo, marker->data_length, 1); break; case JPEG_APP0: - GP_DEBUG(0, "TODO: JFIF"); + GP_TODO("JFIF"); break; case JPEG_APP0 + 1: GP_MetaDataFromExif(data, marker->data, marker->data_length); diff --git a/libs/loaders/GP_MetaExif.c b/libs/loaders/GP_MetaExif.c index 08fb7f9..f188e00 100644 --- a/libs/loaders/GP_MetaExif.c +++ b/libs/loaders/GP_MetaExif.c @@ -201,7 +201,7 @@ static const struct IFD_tag IFD_tags[] = {
/* TAGs from Exif SubIFD */ {IFD_EXPOSURE_PROGRAM, "Exposure Program", IFD_UNSIGNED_SHORT, 1}, - {IFD_ISO_SPEED_RATINGS, "ISO Speed Ratings", IFD_UNSIGNED_SHORT, 2}, + {IFD_ISO_SPEED_RATINGS, "ISO Speed Ratings", IFD_UNSIGNED_SHORT, 1}, {IFD_EXIF_VERSION, "Exif Version", IFD_UNDEFINED, 4}, {IFD_DATE_TIME_ORIGINAL, "Date Time Original", IFD_ASCII_STRING, 20}, {IFD_DATE_TIME_DIGITIZED, "Date Time Digitized", IFD_ASCII_STRING, 20}, @@ -360,21 +360,21 @@ static void load_tag(GP_MetaData *self, void *buf, size_t buf_len, int swap, const struct IFD_tag *res = IFD_tag_get(tag);
if (res == NULL) { - GP_DEBUG(1, "Skipping unknown IFD tag 0x%02x", tag); + GP_TODO("Skipping unknown IFD tag 0x%02x", tag); return; }
if (res->format != format) { - GP_DEBUG(1, "Unexpected tag '%s' format '%s' (0x%02x) " - "expected '%s'", res->name, - IFD_format_name(format), format, - IFD_format_name(res->format)); + GP_WARN("Unexpected tag '%s' format '%s' (0x%02x) " + "expected '%s'", res->name, + IFD_format_name(format), format, + IFD_format_name(res->format)); }
if ((res->num_components != 0) && (res->num_components != num_comp)) { - GP_DEBUG(1, "Unexpected tag '%s' num_components %u expected %u", - res->name, num_comp, res->num_components); + GP_WARN("Unexpected tag '%s' num_components %u expected %u", + res->name, num_comp, res->num_components); } const char *addr; @@ -420,8 +420,8 @@ static void load_tag(GP_MetaData *self, void *buf, size_t buf_len, int swap, break; unused: default: - GP_DEBUG(0, "Unused record '%s' format '%s' (0x%02x)", res->name, - IFD_format_name(format), format); + GP_TODO("Unused record '%s' format '%s' (0x%02x)", res->name, + IFD_format_name(format), format); } }
@@ -483,16 +483,15 @@ int GP_MetaDataFromExif(GP_MetaData *self, void *buf, size_t buf_len) buf_char(buf, 3, buf_len) != 'f' || buf_char(buf, 4, buf_len) != 0 || buf_char(buf, 5, buf_len) != 0) { - GP_DEBUG(1, "Missing ASCII 'Exif - "the start of the buffer"); + GP_WARN("Missing ASCII 'Exif + "the start of the buffer"); return 1; }
if (((c1 = buf_char(buf, 6, buf_len)) != (c2 = buf_char(buf, 7, buf_len))) || (c1 != 'I' && c1 != 'M')) { - GP_DEBUG(1, "Expected II or MM got %x%x, corrupt header?", - c1, c2); + GP_WARN("Expected II or MM got %x%x, corrupt header?", c1, c2); return 1; }
@@ -505,7 +504,7 @@ int GP_MetaDataFromExif(GP_MetaData *self, void *buf, size_t buf_len) GET_16(tag, buf, 8, buf_len, swap);
if (tag != 0x002a) { - GP_DEBUG(1, "Expected TIFF TAG '0x002a' got '0x%04x'", tag); + GP_WARN("Expected TIFF TAG '0x002a' got '0x%04x'", tag); return 1; }
http://repo.or.cz/w/gfxprim.git/commit/7ced426dcbac270e05d48913f2611f34e48ee...
commit 7ced426dcbac270e05d48913f2611f34e48eeb40 Author: Cyril Hrubis metan@ucw.cz Date: Sun Jun 3 11:14:04 2012 +0200
core: Edhance and rewrite debug messages.
diff --git a/include/core/GP_Debug.h b/include/core/GP_Debug.h index 235f001..a09ba69 100644 --- a/include/core/GP_Debug.h +++ b/include/core/GP_Debug.h @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -33,6 +33,10 @@ Debug level > 1 is intended for more verbose reporting, like inner cycles or loop debugging.
+ Debug levels with negative level are special. Debug level -1 means TODO, + level -2 says WARNING while -2 means BUG (i.e. library get into unconsistent + state). + */
#ifndef GP_DEBUG_H @@ -45,17 +49,23 @@
#define GP_DEFAULT_DEBUG_LEVEL 0
-#define GP_DEBUG(level, ...) do { - if (level <= GP_GetDebugLevel()) { - fprintf(stderr, "%u: %s:%s():%u: ", level, __FILE__, - __FUNCTION__, __LINE__); - fprintf(stderr, __VA_ARGS__); - fputc('n', stderr); - } -} while (0) +#define GP_DEBUG(level, ...) + GP_DebugPrint(level, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + +#define GP_TODO(...) + GP_DebugPrint(-1, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + +#define GP_WARN(...) + GP_DebugPrint(-2, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + +#define GP_BUG(...) + GP_DebugPrint(-3, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__)
void GP_SetDebugLevel(unsigned int level);
unsigned int GP_GetDebugLevel(void);
+void GP_DebugPrint(int level, const char *file, const char *function, int line, + const char *fmt, ...) __attribute__ ((format (printf, 5, 6))); + #endif /* GP_DEBUG_H */ diff --git a/libs/core/GP_Debug.c b/libs/core/GP_Debug.c index d3b8cbe..ecef216 100644 --- a/libs/core/GP_Debug.c +++ b/libs/core/GP_Debug.c @@ -16,20 +16,57 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
+#include <stdarg.h> + #include "GP_Debug.h"
-static unsigned int GP_debug_level = GP_DEFAULT_DEBUG_LEVEL; +static unsigned int debug_level = GP_DEFAULT_DEBUG_LEVEL;
void GP_SetDebugLevel(unsigned int level) { - GP_debug_level = level; + debug_level = level; }
unsigned int GP_GetDebugLevel(void) { - return GP_debug_level; + return debug_level; +} + +void GP_DebugPrint(int level, const char *file, const char *function, int line, + const char *fmt, ...) +{ + int i; + + if (level > (int)debug_level) + return; + + for (i = 1; i < level; i++) + fputc(' ', stderr); + + switch (level) { + case -3: + fprintf(stderr, "*** BUG: %s:%s():%u: ", file, function, line); + break; + case -2: + fprintf(stderr, "*** WARNING: %s:%s():%u: ", file, function, line); + break; + case -1: + fprintf(stderr, "*** TODO: %s:%s():%u: ", file, function, line); + break; + default: + fprintf(stderr, "%u: %s:%s():%u: ", + level, file, function, line); + break; + } + + va_list va; + va_start(va, fmt); + vfprintf(stderr, fmt, va); + va_end(va); + + fputc('n', stderr); }
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Debug.h | 28 ++++++++++++++++++-------- libs/core/GP_Debug.c | 45 ++++++++++++++++++++++++++++++++++++++++--- libs/loaders/GP_JPG.c | 2 +- libs/loaders/GP_MetaExif.c | 29 +++++++++++++-------------- 4 files changed, 75 insertions(+), 29 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.