Mercurial > hg > dmlib
diff tools/fontconv.c @ 958:985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Feb 2015 03:58:25 +0200 |
parents | ee46d039c45d |
children | 2b48b7fe95bc |
line wrap: on
line diff
--- a/tools/fontconv.c Fri Feb 27 02:21:57 2015 +0200 +++ b/tools/fontconv.c Fri Feb 27 03:58:25 2015 +0200 @@ -64,14 +64,14 @@ int w, h; if (sscanf(optArg, "%d:%d", &w, &h) != 2) { - dmError("Invalid argument for -s option, '%s'.\n", + dmErrorMsg("Invalid argument for -s option, '%s'.\n", optArg); return FALSE; } if (w < DMFONT_MIN_WIDTH || w > DMFONT_MAX_WIDTH || h < DMFONT_MIN_HEIGHT || h > DMFONT_MAX_HEIGHT) { - dmError("Invalid dimensions, must be %d < W %d, %d < H < %d.\n", + dmErrorMsg("Invalid dimensions, must be %d < W %d, %d < H < %d.\n", DMFONT_MIN_WIDTH , DMFONT_MAX_WIDTH, DMFONT_MIN_HEIGHT , DMFONT_MAX_HEIGHT); return FALSE; @@ -91,7 +91,7 @@ if (sscanf(optArg, "%02x%02x%02x", &colR, &colG, &colB) != 3 && sscanf(optArg, "%02x%02x%02x%02x", &colR, &colG, &colB, &colA) != 4) { - dmError("Invalid RGB hex representation '%s'.\n", + dmErrorMsg("Invalid RGB hex representation '%s'.\n", optArg); return FALSE; } @@ -104,7 +104,7 @@ break; default: - dmError("Unknown argument '%s'.\n", currArg); + dmErrorMsg("Unknown argument '%s'.\n", currArg); return FALSE; } @@ -121,7 +121,7 @@ optOutFilename = currArg; else { - dmError("Too many filename arguments, '%s'\n", currArg); + dmErrorMsg("Too many filename arguments, '%s'\n", currArg); return FALSE; } @@ -287,14 +287,14 @@ // Check arguments if (!optInFilename || !optOutFilename) { - dmError("Input or output file not specified!\n"); + dmErrorMsg("Input or output file not specified!\n"); return 1; } #ifdef DM_GFX_TTF_TEXT if (TTF_Init() < 0) { - dmError("Could not initialize FreeType/TTF: %s\n", SDL_GetError()); + dmErrorMsg("Could not initialize FreeType/TTF: %s\n", SDL_GetError()); goto error_exit; } initTTF = TRUE; @@ -303,7 +303,7 @@ // Open the source file if ((res = dmf_create_stdio(optInFilename, "rb", &inFile)) != DMERR_OK) { - dmError("Error opening input file '%s', %d: %s\n", + dmErrorMsg("Error opening input file '%s', %d: %s\n", optInFilename, res, dmErrorStr(res)); return 1; } @@ -343,7 +343,7 @@ if ((fontbmap = dmLoadImage(inFile)) == NULL) { - dmError("Could not load image file '%s'.\n", optInFilename); + dmErrorMsg("Could not load image file '%s'.\n", optInFilename); goto error_exit; } @@ -353,7 +353,7 @@ if ((res = dmCreateBitmapFontFromImage(fontbmap, optSplitWidth, optSplitHeight, &font)) != DMERR_OK) { - dmError("Could not create a font from image, %d: %s\n", + dmErrorMsg("Could not create a font from image, %d: %s\n", res, dmErrorStr(res)); goto error_exit; } @@ -361,7 +361,7 @@ if (font == NULL) { - dmError("No font loaded.\n"); + dmErrorMsg("No font loaded.\n"); goto error_exit; } @@ -369,7 +369,7 @@ if ((res = dmf_create_stdio(optOutFilename, "wb", &outFile)) != DMERR_OK) { - dmError("Error creating file '%s', %d: %s\n", + dmErrorMsg("Error creating file '%s', %d: %s\n", optInFilename, res, dmErrorStr(res)); goto error_exit; } @@ -379,7 +379,7 @@ if (res != DMERR_OK) { - dmError("Error saving font, %d: %s\n", + dmErrorMsg("Error saving font, %d: %s\n", res, dmErrorStr(res)); }