changeset 2338:ae938889eafb

Make dmC64ConvertGenericBMP2Image() and dmC64ConvertGenericImage2BMP() static.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Sep 2019 11:14:39 +0300
parents 8f4cfe59b2bb
children 2b22a7719a58
files tools/lib64gfx.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Mon Sep 23 11:11:33 2019 +0300
+++ b/tools/lib64gfx.c	Mon Sep 23 11:14:39 2019 +0300
@@ -1398,7 +1398,7 @@
 
 // Convert a C64 format bitmap in DMC64Image struct to
 // a indexed/paletted bitmap image.
-int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
+static int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
 {
     DMC64GetPixelFunc getPixel;
 
@@ -1448,17 +1448,19 @@
 }
 
 
-int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
+int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *pspec)
 {
-    DMImage *dst;
+    DMC64ImageConvSpec spec;
     BOOL mixed;
     int res;
 
-    if (pdst == NULL || src == NULL || spec == NULL)
+    if (pdst == NULL || src == NULL || pspec == NULL)
         return DMERR_NULLPTR;
 
+    memcpy(&spec, pspec, sizeof(spec));
+
     // Allocate image structure
-    if ((*pdst = dst = dmImageAlloc(
+    if ((*pdst = dmImageAlloc(
         src->fmt->width, src->fmt->height, DM_PIXFMT_PALETTE, -1)) == NULL)
         return DMERR_MALLOC;
 
@@ -1466,14 +1468,14 @@
     mixed = (src->extraInfo[D64_EI_MODE] & D64_FMT_ILACE) &&
         src->extraInfo[D64_EI_ILACE_TYPE] == D64_ILACE_COLOR;
 
-    if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK)
+    if ((res = dmC64SetImagePalette(*pdst, &spec, mixed)) != DMERR_OK)
         return res;
 
     // Convert
     if (src->fmt->convertFrom != NULL)
-        res = src->fmt->convertFrom(dst, src, spec);
+        res = src->fmt->convertFrom(*pdst, src, &spec);
     else
-        res = dmC64ConvertGenericBMP2Image(dst, src, spec);
+        res = dmC64ConvertGenericBMP2Image(*pdst, src, &spec);
 
     return res;
 }
@@ -1545,7 +1547,7 @@
 
 
 // Convert a generic bitmap image to DMC64Image
-int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src,
+static int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src,
     const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
 {
     if (dst == NULL || src == NULL || fmt == NULL || spec == NULL)