From d095867349ac68f503a90a62dd6e0a0ef0577979 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on ChromeOS)" <rob@synchro.net>
Date: Sat, 11 Feb 2023 16:54:43 -0800
Subject: [PATCH] More iniGetShort ->iniGetUShort fixups

Not that most of these values should ever exceed 32767, but might as well
---
 src/sbbs3/scfglib2.c | 16 ++++++++--------
 src/sbbs3/scfgsave.c | 30 +++++++++++++++---------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/sbbs3/scfglib2.c b/src/sbbs3/scfglib2.c
index ee98031898..743bc9bee3 100644
--- a/src/sbbs3/scfglib2.c
+++ b/src/sbbs3/scfglib2.c
@@ -61,14 +61,14 @@ BOOL read_file_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
 	ini = iniReadFile(fp);
 	fclose(fp);
 
-	cfg->min_dspace = iniGetShortInt(ini, ROOT_SECTION, "min_dspace", 0);
-	cfg->max_batup = iniGetShortInt(ini, ROOT_SECTION, "max_batup", 0);
-	cfg->max_batdn = iniGetShortInt(ini, ROOT_SECTION, "max_batdn", 0);
-	cfg->max_userxfer = iniGetShortInt(ini, ROOT_SECTION, "max_userxfer", 0);
-	cfg->cdt_up_pct = iniGetShortInt(ini, ROOT_SECTION, "upload_credit_pct", 0);
-	cfg->cdt_dn_pct = iniGetShortInt(ini, ROOT_SECTION, "download_credit_pct", 0);
-	cfg->leech_pct = iniGetShortInt(ini, ROOT_SECTION, "leech_pct", 0);
-	cfg->leech_sec = iniGetShortInt(ini, ROOT_SECTION, "leech_sec", 0);
+	cfg->min_dspace = iniGetUShortInt(ini, ROOT_SECTION, "min_dspace", 0);
+	cfg->max_batup = iniGetUShortInt(ini, ROOT_SECTION, "max_batup", 0);
+	cfg->max_batdn = iniGetUShortInt(ini, ROOT_SECTION, "max_batdn", 0);
+	cfg->max_userxfer = iniGetUShortInt(ini, ROOT_SECTION, "max_userxfer", 0);
+	cfg->cdt_up_pct = iniGetUShortInt(ini, ROOT_SECTION, "upload_credit_pct", 0);
+	cfg->cdt_dn_pct = iniGetUShortInt(ini, ROOT_SECTION, "download_credit_pct", 0);
+	cfg->leech_pct = iniGetUShortInt(ini, ROOT_SECTION, "leech_pct", 0);
+	cfg->leech_sec = iniGetUShortInt(ini, ROOT_SECTION, "leech_sec", 0);
 	cfg->file_misc = iniGetInt32(ini, ROOT_SECTION, "settings", 0);
 	cfg->filename_maxlen = iniGetIntInRange(ini, ROOT_SECTION, "filename_maxlen", 8, SMB_FILEIDX_NAMELEN, UINT16_MAX);
 
diff --git a/src/sbbs3/scfgsave.c b/src/sbbs3/scfgsave.c
index fccfd0abe9..a671292c0d 100644
--- a/src/sbbs3/scfgsave.c
+++ b/src/sbbs3/scfgsave.c
@@ -359,7 +359,7 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
 		iniSetString(&section, name, "description", cfg->grp[i]->lname, NULL);
 		iniSetString(&section, name, "ars", cfg->grp[i]->arstr, NULL);
 		iniSetString(&section, name, "code_prefix", cfg->grp[i]->code_prefix, NULL);
-		iniSetShortInt(&section, name, "sort", cfg->grp[i]->sort, NULL);
+		iniSetUInteger(&section, name, "sort", cfg->grp[i]->sort, NULL);
 		strListMerge(&ini, section);
 		free(section);
 	}
@@ -590,12 +590,12 @@ static void write_dir_defaults_cfg(str_list_t* ini, const char* section, dir_t*
 	iniSetString(ini, section, "upload_sem", dir->upload_sem, NULL);
 	iniSetString(ini, section, "extensions", dir->exts, NULL);
 	iniSetHexInt(ini, section, "settings", dir->misc, NULL);
-	iniSetShortInt(ini, section, "seq_dev", dir->seqdev, NULL);
-	iniSetShortInt(ini, section, "sort", dir->sort, NULL);
-	iniSetShortInt(ini, section, "max_age", dir->maxage, NULL);
-	iniSetShortInt(ini, section, "max_files", dir->maxfiles, NULL);
-	iniSetShortInt(ini, section, "upload_credit_pct", dir->up_pct, NULL);
-	iniSetShortInt(ini, section, "download_credit_pct", dir->dn_pct, NULL);
+	iniSetUInteger(ini, section, "seq_dev", dir->seqdev, NULL);
+	iniSetUInteger(ini, section, "sort", dir->sort, NULL);
+	iniSetUShortInt(ini, section, "max_age", dir->maxage, NULL);
+	iniSetUShortInt(ini, section, "max_files", dir->maxfiles, NULL);
+	iniSetUShortInt(ini, section, "upload_credit_pct", dir->up_pct, NULL);
+	iniSetUShortInt(ini, section, "download_credit_pct", dir->dn_pct, NULL);
 }
 
 /****************************************************************************/
@@ -615,15 +615,15 @@ BOOL write_file_cfg(scfg_t* cfg, int backup_level)
 
 	str_list_t ini = strListInit();
 	iniSetUShortInt(&ini, ROOT_SECTION, "min_dspace", cfg->min_dspace, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "max_batup", cfg->max_batup, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "max_batdn", cfg->max_batdn, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "max_userxfer" ,cfg->max_userxfer, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "upload_credit_pct", cfg->cdt_up_pct, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "download_credit_pct", cfg->cdt_dn_pct, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "leech_pct", cfg->leech_pct, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "leech_sec", cfg->leech_sec, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "max_batup", cfg->max_batup, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "max_batdn", cfg->max_batdn, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "max_userxfer" ,cfg->max_userxfer, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "upload_credit_pct", cfg->cdt_up_pct, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "download_credit_pct", cfg->cdt_dn_pct, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "leech_pct", cfg->leech_pct, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "leech_sec", cfg->leech_sec, NULL);
 	iniSetHexInt(&ini, ROOT_SECTION, "settings", cfg->file_misc, NULL);
-	iniSetShortInt(&ini, ROOT_SECTION, "filename_maxlen", cfg->filename_maxlen, NULL);
+	iniSetUShortInt(&ini, ROOT_SECTION, "filename_maxlen", cfg->filename_maxlen, NULL);
 
 	/* Extractable File Types */
 
-- 
GitLab