From 9d632d97dec488765dce44af4ba65ce7bf4187c5 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on ChromeOS)" <rob@synchro.net>
Date: Sat, 11 Feb 2023 16:16:13 -0800
Subject: [PATCH] When writing hex integer values, use "0" rather than "0x0"

upgrade_to_v320.js sets these values to just "0", so let's not thrash on the
format.
---
 src/xpdev/ini_file.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c
index 0ccd83ab98..1b2c746f00 100644
--- a/src/xpdev/ini_file.c
+++ b/src/xpdev/ini_file.c
@@ -730,18 +730,20 @@ char* iniSetULongInt(str_list_t* list, const char* section, const char* key, ulo
 char* iniSetHexInt(str_list_t* list, const char* section, const char* key, uint value
 					,ini_style_t* style)
 {
-	char	str[INI_MAX_VALUE_LEN];
+	char	str[INI_MAX_VALUE_LEN] = "0";
 
-	SAFEPRINTF(str,"0x%x",value);
+	if(value)
+		SAFEPRINTF(str,"0x%x",value);
 	return iniSetString(list, section, key, str, style);
 }
 
 char* iniSetHexInt64(str_list_t* list, const char* section, const char* key, uint64_t value
 					,ini_style_t* style)
 {
-	char	str[INI_MAX_VALUE_LEN];
+	char	str[INI_MAX_VALUE_LEN] = "0";
 
-	SAFEPRINTF(str,"0x%" PRIx64, value);
+	if(value)
+		SAFEPRINTF(str,"0x%" PRIx64, value);
 	return iniSetString(list, section, key, str, style);
 }
 
-- 
GitLab