mollyguard & debug msg

This commit is contained in:
tTh 2022-11-03 02:58:14 +01:00
parent 1f4b424be7
commit 7f3912a133
1 changed files with 17 additions and 7 deletions

View File

@ -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)
{