diff --git a/funcs/utils.c b/funcs/utils.c index 6a3e8d0..b8e64be 100644 --- a/funcs/utils.c +++ b/funcs/utils.c @@ -108,7 +108,13 @@ return -1; /* --------------------------------------------------------------------- */ int print_rectangle(char *str, FimgArea51 *rect) { -printf("rect @ %p '%s':\n\t %dx%d at %d,%d\n", rect, str, +if (MAGIC_AREA51 != rect->magic) { + fprintf(stderr, "%s: bad magic number 0x%08X\n", __func__, + rect->magic); + return -666; + } + +printf("rect @ %p '%s' :\n\t %dx%d at %d,%d\n", rect, str, rect->w, rect->h, rect->x, rect->y); return 0; } @@ -120,22 +126,26 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused) { int x, y, w, h, foo; +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %s %p %d )\n", __func__, str, r, notused); +#endif + if (notused) { fprintf(stderr, "notused was %d, must be 0 in %s\n", - notused, __func__); - } - -if (verbosity) - fprintf(stderr, "parsing %s\n", str); + notused, __func__); } +if (verbosity > 1) fprintf(stderr, "parsing '%s'\n", str); foo = sscanf(str, "%d,%d,%d,%d", &w, &h, &x, &y); if (4 == foo) { r->x = x, r->y = y, r->w = w, r->h = h; + r->magic = MAGIC_AREA51; return 4; } + +r->magic = 0xBAD; + return -1; } - /* --------------------------------------------------------------------- */ int format_from_extension(char *fname) {