# HG changeset patch # User Matti Hamalainen # Date 1525908342 -10800 # Node ID a602488830fc8399eeb6f8cd2bb34bae0984673c # Parent c1dee757de9d689e0e0e790705afb424fff97900 Cleanups. diff -r c1dee757de9d -r a602488830fc tools/gfxconv.c --- a/tools/gfxconv.c Thu May 10 02:24:41 2018 +0300 +++ b/tools/gfxconv.c Thu May 10 02:25:42 2018 +0300 @@ -1614,8 +1614,8 @@ int main(int argc, char *argv[]) { FILE *inFile = NULL; - const DMC64ImageFormat *cfmt = NULL; - DMC64Image *cimage = NULL; + const DMC64ImageFormat *inC64Fmt = NULL; + DMC64Image *inC64Image = NULL; Uint8 *dataBuf = NULL; size_t dataSize; int i; @@ -1686,11 +1686,11 @@ forced->name, forced->type, forced->fext); } - res = dmC64DecodeBMP(&cimage, dataBuf, dataSize, optInSkip, optInSkip + 2, &cfmt, forced); - if (forced == NULL && cfmt != NULL) + res = dmC64DecodeBMP(&inC64Image, dataBuf, dataSize, optInSkip, optInSkip + 2, &inC64Fmt, forced); + if (forced == NULL && inC64Fmt != NULL) { dmMsg(1,"Probed %s format image, type %d, %s\n", - cfmt->name, cfmt->type, cfmt->fext); + inC64Fmt->name, inC64Fmt->type, inC64Fmt->fext); } if (res == DMERR_OK) @@ -1741,7 +1741,7 @@ *outFmtExt = convFormatList[outFormat].fext; if (optInFormat == FFMT_BITMAP) - inFmtExt = cfmt->name; + inFmtExt = inC64Fmt->name; dmMsg(1, "Attempting conversion %s (%s) -> %s (%s)\n", inFmtName, inFmtExt, outFmtName, outFmtExt); @@ -1768,7 +1768,7 @@ switch (optOutFormat) { case FFMT_IMAGE: - res = dmC64ConvertBMP2Image(&outImage, cimage, cfmt); + res = dmC64ConvertBMP2Image(&outImage, inC64Image, inC64Fmt); if (res != DMERR_OK || outImage == NULL) { @@ -1779,14 +1779,13 @@ res = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); break; - case FFMT_BITMAP: - res = dmWriteBitmap(optOutFilename, cimage, optOutSubFormat, TRUE); + res = dmWriteBitmap(optOutFilename, inC64Image, optOutSubFormat, TRUE); break; case FFMT_CHAR: case FFMT_SPRITE: - res = dmC64ConvertBMP2Image(&outImage, cimage, cfmt); + res = dmC64ConvertBMP2Image(&outImage, inC64Image, inC64Fmt); if (res != DMERR_OK || outImage == NULL) { @@ -1808,7 +1807,7 @@ case FFMT_IMAGE: { - DMImage *outImage = NULL; + DMImage *inImage = NULL; int res = DMERR_OK; if (optOutFilename == NULL) @@ -1820,22 +1819,22 @@ // Read input DMImageFormat *ifmt = &dmImageFormatList[optInSubFormat]; if (ifmt->readFILE != NULL) - res = ifmt->readFILE(inFile, &outImage); + res = ifmt->readFILE(inFile, &inImage); else dmErrorMsg("Unsupported input image format for bitmap/image conversion.\n"); - if (res != DMERR_OK || outImage == NULL) + if (res != DMERR_OK || inImage == NULL) break; switch (optOutFormat) { case FFMT_IMAGE: - res = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); + res = dmWriteImage(optOutFilename, inImage, &optSpec, optOutSubFormat, TRUE); break; case FFMT_CHAR: case FFMT_SPRITE: - res = dmWriteSpritesAndChars(optOutFilename, outImage, optOutFormat, optInMulticolor); + res = dmWriteSpritesAndChars(optOutFilename, inImage, optOutFormat, optInMulticolor); break; default: @@ -1849,7 +1848,7 @@ dmErrorStr(res)); } - dmImageFree(outImage); + dmImageFree(inImage); } break; } @@ -1859,7 +1858,7 @@ fclose(inFile); dmFree(dataBuf); - dmC64ImageFree(cimage); + dmC64ImageFree(inC64Image); return 0; }