# HG changeset patch # User Matti Hamalainen # Date 1526163561 -10800 # Node ID ba09aa661c72350393bd26b5c413d604e561308b # Parent 87af4e63a3920ae723a0f99ca0d6ae012f6a16eb Cleanups. diff -r 87af4e63a392 -r ba09aa661c72 tools/gfxconv.c --- a/tools/gfxconv.c Sat May 12 23:08:16 2018 +0300 +++ b/tools/gfxconv.c Sun May 13 01:19:21 2018 +0300 @@ -990,14 +990,15 @@ } -int dmConvertC64Bitmap(DMC64Image **pdst, const DMC64Image *src, const DMC64ImageFormat *fmt) +int dmConvertC64Bitmap(DMC64Image **pdst, const DMC64Image *src, + const DMC64ImageFormat *dstFmt, const DMC64ImageFormat *srcFmt) { DMC64Image *dst; - if (pdst == NULL || fmt == NULL || src == NULL) + if (pdst == NULL || dstFmt == NULL || src == NULL || srcFmt == NULL) return DMERR_NULLPTR; - if ((dst = *pdst = dmC64ImageAlloc(fmt)) == NULL) + if ((dst = *pdst = dmC64ImageAlloc(dstFmt)) == NULL) return DMERR_MALLOC; if (src->type == dst->type) @@ -1026,7 +1027,7 @@ for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++) { - const DMC64EncDecOp *op = &fmt->encdecOps[i]; + const DMC64EncDecOp *op = &dstFmt->encdecOps[i]; size_t size; // Check for last operator @@ -1034,7 +1035,7 @@ break; // Check size - if (!dmC64GetOpSize(op, fmt, &size)) + if (!dmC64GetOpSize(op, dstFmt, &size)) return DMERR_INVALID_DATA; // Perform operation @@ -1065,8 +1066,7 @@ // And output the file dmMsg(1, "Writing output file '%s'\n", filename); - if ((res = dmWriteDataFile(NULL, filename, buf.data, buf.len)) != DMERR_OK) - goto error; + res = dmWriteDataFile(NULL, filename, buf.data, buf.len); error: dmGrowBufFree(&buf); @@ -1751,7 +1751,7 @@ break; case FFMT_BITMAP: - if ((res = dmConvertC64Bitmap(&outC64Image, inC64Image, &dmC64ImageFormats[optOutSubFormat])) != DMERR_OK) + if ((res = dmConvertC64Bitmap(&outC64Image, inC64Image, &dmC64ImageFormats[optOutSubFormat], inC64Fmt)) != DMERR_OK) { dmErrorMsg("Error in bitmap format conversion.\n"); goto error;