changeset 1471:a988baa5b21f

Add stub function to prevent attempts to encode formats that do not support encoding yet.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 10 May 2018 23:07:50 +0300
parents 499835ba215c
children b9d3577d8290
files tools/lib64gfx.c
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Thu May 10 22:30:36 2018 +0300
+++ b/tools/lib64gfx.c	Thu May 10 23:07:50 2018 +0300
@@ -586,6 +586,18 @@
 }
 
 
+static int fmtEncodeStub(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
+{
+    (void) buf;
+    (void) img;
+    (void) fmt;
+
+    return dmError(DMERR_NOT_SUPPORTED,
+        "Encoding of '%s' format not supported.\n",
+        fmt->name);
+}
+
+
 static Uint8 fmtGetPixelFunPaint2(
     const DMC64Image *img, const int bmoffs, const int scroffs,
     const int vshift, const int vbitmap, const int raster)
@@ -698,7 +710,7 @@
         C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
         fmtProbeDrazPaint20Packed,
-        fmtDecodeDrazPaintPacked, NULL,
+        fmtDecodeDrazPaintPacked, fmtEncodeStub,
         NULL, NULL,
         NULL,
         {
@@ -715,7 +727,7 @@
         C64_SCR_WIDTH   , C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
         fmtProbeDrazLace10Packed,
-        fmtDecodeDrazPaintPacked, NULL,
+        fmtDecodeDrazPaintPacked, fmtEncodeStub,
         NULL, NULL,
         NULL,
         {
@@ -824,7 +836,7 @@
         C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
         fmtProbeAmicaPaintPacked,
-        fmtDecodeAmicaPaintPacked, NULL,
+        fmtDecodeAmicaPaintPacked, fmtEncodeStub,
         NULL, NULL,
         NULL,
         {
@@ -992,7 +1004,7 @@
         C64_SCR_WIDTH, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
         fmtProbeFunPaint2Unpacked,
-        fmtDecodeFunPaint2Unpacked, NULL,
+        fmtDecodeFunPaint2Unpacked, fmtEncodeStub,
         NULL, NULL,
         fmtGetPixelFunPaint2,
         {
@@ -1012,7 +1024,7 @@
         C64_SCR_WIDTH, C64_SCR_HEIGHT,
         C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
         fmtProbeFunPaint2Packed,
-        fmtDecodeFunPaint2Packed, NULL,
+        fmtDecodeFunPaint2Packed, fmtEncodeStub,
         NULL, NULL,
         fmtGetPixelFunPaint2,
         {