diff dwtest.c @ 2855:86286f528adf

Fix new safety warnings reported by the new GCC on Linux. The semaphore code is used on other platforms... make sure all platforms using this code are the same.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 Nov 2022 03:50:00 +0000
parents 8a5131cbbe93
children 4b075e64536c
line wrap: on
line diff
--- a/dwtest.c	Tue Nov 15 02:29:56 2022 +0000
+++ b/dwtest.c	Tue Nov 15 03:50:00 2022 +0000
@@ -344,7 +344,7 @@
 void draw_file(int row, int col, int nrows, int fheight, HPIXMAP hpma)
 {
     HPIXMAP hpm = hpma ? hpma : text2pm;
-    char buf[10];
+    char buf[15] = {0};
     int i,y,fileline;
     char *pLine;
 
@@ -359,12 +359,12 @@
         {
             fileline = i + row - 1;
             y = i*fheight;
-            dw_color_background_set(1 + (fileline % 15) );
+            dw_color_background_set(1 + (fileline % 15));
             dw_color_foreground_set(fileline < 0 ? DW_CLR_WHITE : fileline % 16);
             if(!hpma)
             {
-                sprintf( buf, "%6.6d", i+row );
-                dw_draw_text( 0, text1pm, 0, y, buf);
+                snprintf(buf, 15, "%6.6d", i+row);
+                dw_draw_text(0, text1pm, 0, y, buf);
             }
             pLine = lp[i+row];
             dw_draw_text(0, hpm, 0, y, pLine+col);