minor tuning

This commit is contained in:
tTh 2022-08-23 12:10:16 +02:00
parent 05f65ef5c9
commit bce4464719
3 changed files with 44 additions and 23 deletions

View File

@ -437,12 +437,16 @@ switch (commande)
break; break;
} }
#if DEBUG_LEVEL if (foo) {
fprintf(stderr, "%s: return code is %d\n", __FILE__, foo); fprintf(stderr, "%s: return code is %d\n", __FILE__, foo);
puts(""); /* make a nicer display in debug mode */ Image_print_error(argv[0], foo);
#endif }
foo = Image_TGA_save(argv[3], dst, 0); foo = Image_TGA_save(argv[3], dst, 0);
if (foo) {
fprintf(stderr, "%s: error %d saving '%s'\n", __FILE__, foo, argv[3]);
Image_print_error(argv[0], foo);
}
return 0; return 0;
} }

View File

@ -7,7 +7,7 @@
#include "../tthimage.h" #include "../tthimage.h"
#define TGA_OUTILS_VERSION "0.60" #define TGA_OUTILS_VERSION "0.61"
/* /*
* 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes. * 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
* 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient) * 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
@ -21,7 +21,7 @@
* 27 Jan 2014: V0.52 added : 'parse_rect_param'. * 27 Jan 2014: V0.52 added : 'parse_rect_param'.
*/ */
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2018" #define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2022"
#define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/" #define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/"
#define PERR(txt) fprintf(stderr, "\t| %s\n", (txt)) #define PERR(txt) fprintf(stderr, "\t| %s\n", (txt))

View File

@ -26,7 +26,7 @@
#define TIMESTAMP 34 #define TIMESTAMP 34
#define PRHISTO 35 #define PRHISTO 35
#define TAG7SEG0 40 #define TAG7SEG0 40
#define BIZARRE 41
#define ENVIRON 50 #define ENVIRON 50
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
mot_clef commandes[] = mot_clef commandes[] =
@ -47,6 +47,7 @@ mot_clef commandes[] =
{ "prhisto", PRHISTO, "s", "filename.tga" }, { "prhisto", PRHISTO, "s", "filename.tga" },
{ "tag7", TAG7SEG0, "si", "fname.tga nnn" }, { "tag7", TAG7SEG0, "si", "fname.tga nnn" },
{ "environ", ENVIRON, "", "" }, { "environ", ENVIRON, "", "" },
{ "bizarre", BIZARRE, "", "portnawak..." },
{ "mk_rgb", MK_RGB, "siiiii", "fname w h r g b" }, { "mk_rgb", MK_RGB, "siiiii", "fname w h r g b" },
{ NULL, 0, NULL, NULL } { NULL, 0, NULL, NULL }
}; };
@ -66,31 +67,28 @@ if (foo)
{ {
fprintf(stderr, "something is bad with %s : %d\n", filename, foo); fprintf(stderr, "something is bad with %s : %d\n", filename, foo);
Image_print_error("explanation", foo); Image_print_error("explanation", foo);
return foo;
} }
foo = 0;
switch(flags) switch(flags)
{ {
case 0: case 0:
printf("%8d %8d\n", width, height); printf("%8d %8d\n", width, height); break;
break;
case 1: case 1:
printf("%dx%d\n", width, height); printf("%dx%d\n", width, height); break;
break;
case 2: case 2:
printf(" -w%d -h%d\n", width, height); printf(" -w%d -h%d\n", width, height); break;
break;
case 3: case 3:
printf("width=%d height=%d\n", width, height); printf("width=%d height=%d\n", width, height); break;
break;
case 4: case 4:
printf("%d\n", width); printf("%d\n", width); break;
break;
case 5: case 5:
printf("%d\n", height); printf("%d\n", height);
break; break;
default: default:
fprintf(stderr, "bad flag %d in %s\n", flags, __func__); fprintf(stderr, "bad flag %d in %s\n", flags, __func__);
abort(); foo = BAD_PARAMETER;
break; /* unreached ? */ break; /* unreached ? */
} }
return foo; return foo;
@ -104,7 +102,7 @@ int foo;
fprintf(stderr, "Show Header '%s' %d\n", filename, flag); fprintf(stderr, "Show Header '%s' %d\n", filename, flag);
#endif #endif
foo = Image_TGA_show_header(filename, 0); foo = Image_TGA_show_header(filename, flag);
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s got %d\n", __func__, foo); fprintf(stderr, "%s got %d\n", __func__, foo);
@ -240,13 +238,13 @@ char *noms[] =
"FIXED_SEED", ENV_DEFAULT_RGBA "FIXED_SEED", ENV_DEFAULT_RGBA
}; };
for (foo=0; foo<(sizeof(noms)/sizeof(char *)); foo++) for (foo=0; foo<(int)(sizeof(noms)/sizeof(char *)); foo++)
{ {
ptr = getenv(noms[foo]); ptr = getenv(noms[foo]);
printf("%5d %-25s %s\n", foo, noms[foo], ptr); printf("%5d %-25s %s\n", foo, noms[foo], ptr);
} }
return FUNC_NOT_FINISH; return OLL_KORRECT; /* ? seriously ? */
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int tag_7_segments_0(char *fname, int value) int tag_7_segments_0(char *fname, int value)
@ -271,6 +269,10 @@ foo = Image_7seg_tag0(src, buffer, 0);
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s : tagging %s -> %d\n", __func__, fname, foo); fprintf(stderr, "%s : tagging %s -> %d\n", __func__, fname, foo);
#endif #endif
if (foo) {
fprintf(stderr, "ERR %d IN %s\n", foo, __func__);
abort();
}
foo = Image_TGA_save(fname, src, 0); foo = Image_TGA_save(fname, src, 0);
#if DEBUG_LEVEL > 1 #if DEBUG_LEVEL > 1
@ -280,6 +282,20 @@ fprintf(stderr, "%s : saving %s -> %d\n", __func__, fname, foo);
return -1; return -1;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int bizarre(char *fname, int notused)
{
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, fname, notused);
if (notused) {
fprintf(stderr, "in %s notused must be zero, was %d\n",
__func__, notused);
return INVALID_PARAM;
}
return OLL_KORRECT;
}
/*::------------------------------------------------------------------::*/
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int foo; int foo;
@ -397,11 +413,12 @@ switch(mode)
break; break;
default: default:
fprintf(stderr, "Hu ho %d ?\n", mode); fprintf(stderr, "Hu ho %d ?\n", mode);
foo = FULL_NUCKED;
break; break;
} }
if (foo) { if (foo) {
fprintf(stderr, "at end of %s, foo was %d\n", __func__, foo); fprintf(stderr, "*** at end of %s, foo was %d\n", __func__, foo);
} }
return 0; return 0;
} }