changeset 2457:16426e9dc238

Add few comments.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 Apr 2020 15:10:18 +0300
parents f5f8001490ae
children f6278408bfae
files tools/libgfx.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/libgfx.c	Wed Apr 15 14:21:38 2020 +0300
+++ b/tools/libgfx.c	Wed Apr 15 15:10:18 2020 +0300
@@ -346,12 +346,15 @@
     int res;
     Uint16 tmp1, tmp2;
 
+    // Allocate a palette with 256 entries
     if ((res = dmPaletteAlloc(pdst, 256, -1)) != DMERR_OK)
         return res;
 
+    // Read data for 256 entries
     if ((res = dmPaletteReadData(fp, *pdst, 256)) != DMERR_OK)
         goto error;
 
+    // Read the footer
     if (!dmf_read_be16(fp, &tmp1) ||
         !dmf_read_be16(fp, &tmp2))
     {
@@ -359,12 +362,14 @@
         goto error;
     }
 
+    // Check for validity
     if (tmp1 == 0 || tmp1 > 256)
     {
         res = DMERR_INVALID_DATA;
         goto error;
     }
 
+    // Resize the palette
     if ((res = dmPaletteResize(pdst, tmp1)) != DMERR_OK)
         goto error;