diff Discovery/Src/show_logbook.c @ 994:bad5561c0c59 GasConsumption

Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names. Also fix some compiler warnings from non-safe use of 'memcpy'. (mikeller)
author heinrichsweikamp
date Sun, 27 Apr 2025 09:56:22 +0200
parents d9290c76b840
children b0d3e8b84966
line wrap: on
line diff
--- a/Discovery/Src/show_logbook.c	Fri Apr 25 08:26:03 2025 +0200
+++ b/Discovery/Src/show_logbook.c	Sun Apr 27 09:56:22 2025 +0200
@@ -897,6 +897,7 @@
     releaseFrame(17,tLOGbackground.FBStartAdress);
 }
 
+#define MSG_LENGTH 30
 
 static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards)
 {
@@ -919,7 +920,7 @@
     uint8_t  gasdata[1000];
     dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
-    char msg[15];
+    char msg[MSG_LENGTH];
     char gas_name[15];
     int j = 0;
 
@@ -979,18 +980,18 @@
             	if(index < NUM_GASES)		/* Switch to Bailout is not covered by log gas list */
             	{
             		snprintf(gas_name,15,"Bailout");
-            		snprintf(msg,15,"G%d: %s",index +1, gas_name);
+                        snprintf(msg, MSG_LENGTH, "G%d: %s", index +1, gas_name);
             	}
             	else
             	{
             		print_gas_name(gas_name,15,logbookHeader.gasordil[index-NUM_GASES].oxygen_percentage,logbookHeader.gasordil[index-NUM_GASES].helium_percentage);
-            		snprintf(msg,15,"D%d: %s",index +1 - NUM_GASES, gas_name);
+                        snprintf(msg, MSG_LENGTH, "D%d: %s", index + 1 - NUM_GASES, gas_name);
             	}
             }
             else
             {
             	print_gas_name(gas_name,15,logbookHeader.gasordil[index].oxygen_percentage,logbookHeader.gasordil[index].helium_percentage);
-            	snprintf(msg,15,"G%d: %s",index +1, gas_name);
+                snprintf(msg, MSG_LENGTH, "G%d: %s", index + 1, gas_name);
             }
             Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg);
         }