From d56a62dcf15b64e9b0448f8091b992f952bc2398 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Windows 11)" <rob@synchro.net> Date: Sat, 30 Dec 2023 17:38:26 -0800 Subject: [PATCH] Constify string arrays passed to js_CreateArrayOfStrings() Should calm the clang warnings reported by Deuce: e.g. passing 'char *[18]' to parameter of type 'const char **' discards qualifiers in nested pointer types --- src/sbbs3/js_archive.c | 2 +- src/sbbs3/js_client.c | 2 +- src/sbbs3/js_com.c | 2 +- src/sbbs3/js_conio.c | 2 +- src/sbbs3/js_cryptcert.c | 6 +++--- src/sbbs3/js_cryptcon.c | 6 +++--- src/sbbs3/js_cryptkeyset.c | 4 ++-- src/sbbs3/js_file_area.c | 6 +++--- src/sbbs3/js_filebase.c | 6 +++--- src/sbbs3/js_internal.c | 2 +- src/sbbs3/js_mqtt.c | 4 ++-- src/sbbs3/js_msg_area.c | 6 +++--- src/sbbs3/js_msgbase.c | 2 +- src/sbbs3/js_queue.c | 2 +- src/sbbs3/js_server.c | 2 +- src/sbbs3/js_socket.c | 2 +- src/sbbs3/js_system.c | 6 +++--- src/sbbs3/js_uifc.c | 8 ++++---- src/sbbs3/js_user.c | 8 ++++---- src/sbbs3/js_xtrn_area.c | 8 ++++---- 20 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/sbbs3/js_archive.c b/src/sbbs3/js_archive.c index a5c679bcd8..ffffa434ab 100644 --- a/src/sbbs3/js_archive.c +++ b/src/sbbs3/js_archive.c @@ -607,7 +607,7 @@ static jsSyncMethodSpec js_archive_functions[] = { }; #ifdef BUILD_JSDOCS -static char* archive_prop_desc[] = { +static const char* archive_prop_desc[] = { "Format/compression type of archive file - <small>READ ONLY</small>" ,"Filename specified in constructor - <small>READ ONLY</small>" diff --git a/src/sbbs3/js_client.c b/src/sbbs3/js_client.c index 3ea1b30666..37ba369dbb 100644 --- a/src/sbbs3/js_client.c +++ b/src/sbbs3/js_client.c @@ -51,7 +51,7 @@ enum { }; #ifdef BUILD_JSDOCS - static char* client_prop_desc[] = { +static const char* client_prop_desc[] = { "Client's IPv4 or IPv6 address" ,"Client's host name (up to 64 characters)" ,"Client's TCP or UDP port number" diff --git a/src/sbbs3/js_com.c b/src/sbbs3/js_com.c index d1f892a758..04bef5ec75 100644 --- a/src/sbbs3/js_com.c +++ b/src/sbbs3/js_com.c @@ -512,7 +512,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* com_prop_desc[] = { +static const char* com_prop_desc[] = { "Error status for the last COM operation that failed - <small>READ ONLY</small>" ,"<tt>true</tt> if port is in a connected state - <small>READ ONLY</small>" ,"Enable debug logging" diff --git a/src/sbbs3/js_conio.c b/src/sbbs3/js_conio.c index cf95dbc470..e471005ba9 100644 --- a/src/sbbs3/js_conio.c +++ b/src/sbbs3/js_conio.c @@ -1197,7 +1197,7 @@ static JSClass js_conio_class = { }; #ifdef BUILD_JSDOCS -static char* conio_prop_desc[] = { +static const char* conio_prop_desc[] = { "Allows windows to scroll", "Enables direct video writes (does nothing)", "Do not update the screen when characters are printed", diff --git a/src/sbbs3/js_cryptcert.c b/src/sbbs3/js_cryptcert.c index a8717ce9d1..46890fd027 100644 --- a/src/sbbs3/js_cryptcert.c +++ b/src/sbbs3/js_cryptcert.c @@ -3146,7 +3146,7 @@ js_cryptcert_constructor(JSContext *cx, uintN argc, jsval *arglist) } #ifdef BUILD_JSDOCS -static char* cryptcert_cursor_prop_desc[] = { +static const char* cryptcert_cursor_prop_desc[] = { "Move the cursor to the first group or attribute.", "Move the cursor to the last group or attribute.", "Move the cursor to the next group or attribute.", @@ -3154,7 +3154,7 @@ static char* cryptcert_cursor_prop_desc[] = { NULL }; -static char* cryptcert_type_prop_desc[] = { +static const char* cryptcert_type_prop_desc[] = { "No certificate type", "Certificate.", "Attribute certificate.", @@ -3172,7 +3172,7 @@ static char* cryptcert_type_prop_desc[] = { NULL }; -static char* cryptcert_format_prop_desc[] = { +static const char* cryptcert_format_prop_desc[] = { "No certificate format", "A certification request, certificate, or CRL in binary data format. The certificate object is encoded according to the ASN.1 distinguished encoding rules. This is the normal certificate encoding format.", "A certificate encoded as a PKCS #7 certificate chain.", diff --git a/src/sbbs3/js_cryptcon.c b/src/sbbs3/js_cryptcon.c index 7da6c8bd4a..25a53af18b 100644 --- a/src/sbbs3/js_cryptcon.c +++ b/src/sbbs3/js_cryptcon.c @@ -651,7 +651,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* cryptcon_prop_desc[] = { +static const char* cryptcon_prop_desc[] = { "Algorithm constant (CryptContext.ALGO.XXX)" ,"Cipher block size in bytes" ,"Output of hasing algorithms (ie: MD5, SHA1, etc)" @@ -1009,7 +1009,7 @@ js_cryptcon_constructor(JSContext *cx, uintN argc, jsval *arglist) } #ifdef BUILD_JSDOCS -static char* cryptcon_algo_prop_desc[] = { +static const char* cryptcon_algo_prop_desc[] = { "No encryption", "<p>DES is a 64-bit block cipher with a 56-bit key. Note that this algorithm is no longer considered secure and should not be used. It is present in cryptlib only for compatibility with legacy applications.</p>" "<p>Although cryptlib uses 64-bit DES keys, only 56 bits of the key are actually used. The least significant bit in each byte is used as a parity bit (cryptlib will set the correct parity values for you, so you don't have to worry about this). You can treat the algorithm as having a 64-bit key, but bear in mind that only the high 7 bits of each byte are actually used as keying material.</p>" @@ -1043,7 +1043,7 @@ static char* cryptcon_algo_prop_desc[] = { NULL }; -static char* cryptcon_mode_prop_desc[] = { +static const char* cryptcon_mode_prop_desc[] = { "No encryption mode", "ECB", "CBC", diff --git a/src/sbbs3/js_cryptkeyset.c b/src/sbbs3/js_cryptkeyset.c index 22864d8c94..4ea1626d69 100644 --- a/src/sbbs3/js_cryptkeyset.c +++ b/src/sbbs3/js_cryptkeyset.c @@ -359,7 +359,7 @@ js_cryptkeyset_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval * #ifdef BUILD_JSDOCS -static char* cryptkeyset_prop_desc[] = { +static const char* cryptkeyset_prop_desc[] = { "Keyopt constant (CryptKeyset.KEYOPT.XXX):<ul class=\"showList\">\n" "<li>CryptKeyset.KEYOPT.NONE</li>\n" "<li>CryptKeyset.KEYOPT.READONLY</li>\n" @@ -507,7 +507,7 @@ js_cryptkeyset_constructor(JSContext *cx, uintN argc, jsval *arglist) } #ifdef BUILD_JSDOCS -static char* cryptkeyset_keyopt_prop_desc[] = { +static const char* cryptkeyset_keyopt_prop_desc[] = { "No special access options (this option implies read/write access).", "<p>Read-only keyset access. This option is automatically enabled by cryptlib for keyset types that have read-only restrictions enforced by the nature of the keyset, the operating system, or user access rights.</p>" "<p>Unless you specifically require write access to the keyset, you should use this option since it allows cryptlib to optimise its buffering and access strategies for the keyset.</p>", diff --git a/src/sbbs3/js_file_area.c b/src/sbbs3/js_file_area.c index 493bad57cc..57f3790ee7 100644 --- a/src/sbbs3/js_file_area.c +++ b/src/sbbs3/js_file_area.c @@ -24,14 +24,14 @@ #ifdef BUILD_JSDOCS -static char* file_area_prop_desc[] = { +static const char* file_area_prop_desc[] = { "Minimum amount of available disk space (in bytes) required for user uploads to be allowed" ,"File area settings (bit-flags) - see <tt>FM_*</tt> in <tt>sbbsdefs.js</tt> for details" ,"Web file virtual path prefix" ,NULL }; -static char* lib_prop_desc[] = { +static const char* lib_prop_desc[] = { "Index into lib_list array (or -1 if not in array)" ,"Unique number for this library" ,"Name" @@ -43,7 +43,7 @@ static char* lib_prop_desc[] = { ,NULL }; -static char* dir_prop_desc[] = { +static const char* dir_prop_desc[] = { "Index into dir_list array (or -1 if not in array)" ,"Unique number for this directory" diff --git a/src/sbbs3/js_filebase.c b/src/sbbs3/js_filebase.c index eab058e9e4..d73bbb4f46 100644 --- a/src/sbbs3/js_filebase.c +++ b/src/sbbs3/js_filebase.c @@ -1600,7 +1600,7 @@ static jsSyncPropertySpec js_filebase_properties[] = { }; #ifdef BUILD_JSDOCS -static char* filebase_prop_desc[] = { +static const char* filebase_prop_desc[] = { "Last occurred file base error description - <small>READ ONLY</small>" ,"Return value of last <i>SMB Library</i> function call - <small>READ ONLY</small>" @@ -1842,7 +1842,7 @@ js_filebase_constructor(JSContext *cx, uintN argc, jsval *arglist) } #ifdef BUILD_JSDOCS -static char* filebase_detail_prop_desc[] = { +static const char* filebase_detail_prop_desc[] = { "Include indexed-filenames only", "Normal level of file detail (e.g. full filenames, minimal metadata)", "Normal level of file detail plus extended descriptions", @@ -1851,7 +1851,7 @@ static char* filebase_detail_prop_desc[] = { NULL }; -static char* filebase_sort_prop_desc[] = { +static const char* filebase_sort_prop_desc[] = { "Natural sort order (same as DATE_A)", "Filename ascending, case insensitive sort order", "Filename descending, case insensitive sort order", diff --git a/src/sbbs3/js_internal.c b/src/sbbs3/js_internal.c index f5d214b6f0..d73fe159e4 100644 --- a/src/sbbs3/js_internal.c +++ b/src/sbbs3/js_internal.c @@ -252,7 +252,7 @@ static jsSyncPropertySpec js_properties[] = { }; #ifdef BUILD_JSDOCS -static char* prop_desc[] = { +static const char* prop_desc[] = { /* New properties go here... */ "Full path and filename of JS file executed" ,"JS filename executed (with no path)" diff --git a/src/sbbs3/js_mqtt.c b/src/sbbs3/js_mqtt.c index 3f648639ff..4e13b2c523 100644 --- a/src/sbbs3/js_mqtt.c +++ b/src/sbbs3/js_mqtt.c @@ -346,7 +346,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* com_prop_desc[] = { +static const char* prop_desc[] = { "Result (error value) of last MQTT library function call - <small>READ ONLY</small>" ,"Result description of last MQTT library function call - <small>READ ONLY</small>" ,"MQTT library name and version - <small>READ ONLY</small>" @@ -742,7 +742,7 @@ static JSBool js_mqtt_constructor(JSContext* cx, uintN argc, jsval *arglist) js_DescribeSyncConstructor(cx,obj,"To create a new MQTT object: " "<tt>var mqtt = new MQTT([<i>client_id</i>])</tt><br>" ); - js_CreateArrayOfStrings(cx, obj, "_property_desc_list", com_prop_desc, JSPROP_READONLY); + js_CreateArrayOfStrings(cx, obj, "_property_desc_list", prop_desc, JSPROP_READONLY); #endif return JS_TRUE; diff --git a/src/sbbs3/js_msg_area.c b/src/sbbs3/js_msg_area.c index a09818306a..e7feb8adc8 100644 --- a/src/sbbs3/js_msg_area.c +++ b/src/sbbs3/js_msg_area.c @@ -25,14 +25,14 @@ #ifdef BUILD_JSDOCS -static char* msg_area_prop_desc[] = { +static const char* msg_area_prop_desc[] = { "Message area settings (bit-flags) - see <tt>MM_*</tt> in <tt>sbbsdefs.js</tt> for details" ,"FidoNet NetMail settings (bit-flags) - see <tt>NMAIL_*</tt> in <tt>sbbsdefs.js</tt> for details" ,"Internet NetMail settings (bit-flags) - see <tt>NMAIL_*</tt> in <tt>sbbsdefs.js</tt> for details" ,NULL }; -static char* msg_grp_prop_desc[] = { +static const char* msg_grp_prop_desc[] = { "Index into grp_list array (or -1 if not in array)" ,"Unique number for this message group" ,"Group name" @@ -43,7 +43,7 @@ static char* msg_grp_prop_desc[] = { ,NULL }; -static char* msg_sub_prop_desc[] = { +static const char* msg_sub_prop_desc[] = { "Index into sub_list array (or -1 if not in array)</i>" ,"Group's index into grp_list array</i>" diff --git a/src/sbbs3/js_msgbase.c b/src/sbbs3/js_msgbase.c index 5dfae9dd84..ae3274073c 100644 --- a/src/sbbs3/js_msgbase.c +++ b/src/sbbs3/js_msgbase.c @@ -3080,7 +3080,7 @@ static jsSyncPropertySpec js_msgbase_properties[] = { }; #ifdef BUILD_JSDOCS -static char* msgbase_prop_desc[] = { +static const char* msgbase_prop_desc[] = { "Last occurred message base error - <small>READ ONLY</small>" ,"Return value of last <i>SMB Library</i> function call - <small>READ ONLY</small>" diff --git a/src/sbbs3/js_queue.c b/src/sbbs3/js_queue.c index 3c23158179..f6aa8e0389 100644 --- a/src/sbbs3/js_queue.c +++ b/src/sbbs3/js_queue.c @@ -262,7 +262,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* queue_prop_desc[] = { +static const char* queue_prop_desc[] = { "Name of the queue (if it has one)" ,"<tt>true</tt> if data is waiting to be read from queue" ,"Number of values in the read queue" diff --git a/src/sbbs3/js_server.c b/src/sbbs3/js_server.c index 8f47c397d2..6a01c7c2d6 100644 --- a/src/sbbs3/js_server.c +++ b/src/sbbs3/js_server.c @@ -118,7 +118,7 @@ static jsSyncPropertySpec js_server_properties[] = { }; #ifdef BUILD_JSDOCS -static char* server_prop_desc[] = { +static const char* server_prop_desc[] = { "Server name and version number" ,"Detailed version/build information" diff --git a/src/sbbs3/js_socket.c b/src/sbbs3/js_socket.c index b2997decea..44f6037f2d 100644 --- a/src/sbbs3/js_socket.c +++ b/src/sbbs3/js_socket.c @@ -2251,7 +2251,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* socket_prop_desc[] = { +static const char* socket_prop_desc[] = { /* Regular properties */ "Error status for the last socket operation that failed - <small>READ ONLY</small>" ,"Error description for the last socket operation that failed - <small>READ ONLY</small>" diff --git a/src/sbbs3/js_system.c b/src/sbbs3/js_system.c index 78994ef08f..c8fa5e2154 100644 --- a/src/sbbs3/js_system.c +++ b/src/sbbs3/js_system.c @@ -618,7 +618,7 @@ static jsSyncPropertySpec js_system_properties[] = { }; #ifdef BUILD_JSDOCS -static char* sys_prop_desc[] = { +static const char* sys_prop_desc[] = { /* Manually created (non-tabled) properties */ "Public host name that uniquely identifies this system on the Internet (usually the same as <i>system.inet_addr</i>)" ,"Socket library version information" @@ -805,7 +805,7 @@ static jsSyncPropertySpec js_sysstats_properties[] = { }; #if !defined(JSDOOR) && defined(BUILD_JSDOCS) -static char* sysstat_prop_desc[] = { +static const char* sysstat_prop_desc[] = { "Total logons" ,"Logons today" ,"Total time used" @@ -2372,7 +2372,7 @@ enum { }; #ifdef BUILD_JSDOCS -static char* node_prop_desc[] = { +static const char* node_prop_desc[] = { "Status (see <tt>nodedefs.js</tt> for valid values)" ,"Error counter" ,"Current user action (see <tt>nodedefs.js</tt>)" diff --git a/src/sbbs3/js_uifc.c b/src/sbbs3/js_uifc.c index 87082e255f..04497efdd9 100644 --- a/src/sbbs3/js_uifc.c +++ b/src/sbbs3/js_uifc.c @@ -213,7 +213,7 @@ static JSBool js_getstrxy_ctx_set(JSContext *cx, JSObject *obj, jsid id, JSBool return JS_TRUE; } #ifdef BUILD_JSDOCS -static char* uifc_list_ctx_prop_desc[] = { +static const char* uifc_list_ctx_prop_desc[] = { "Currently selected item" ,"0-based Line number in the currently displayed set that is highlighted" ,"left column" @@ -221,7 +221,7 @@ static char* uifc_list_ctx_prop_desc[] = { ,"forced width" ,NULL }; -static char* uifc_showbuf_ctx_prop_desc[] = { +static const char* uifc_showbuf_ctx_prop_desc[] = { "Currently selected item" ,"0-based Line number in the currently displayed set that is highlighted" ,"left column" @@ -230,7 +230,7 @@ static char* uifc_showbuf_ctx_prop_desc[] = { ,"forced height" ,NULL }; -static char* uifc_gotoxy_ctx_prop_desc[] = { +static const char* uifc_gotoxy_ctx_prop_desc[] = { "Last pressed key" ,NULL }; @@ -542,7 +542,7 @@ static jsSyncPropertySpec js_properties[] = { {0} }; #ifdef BUILD_JSDOCS -static char* uifc_prop_desc[] = { +static const char* uifc_prop_desc[] = { "UIFC library has been successfully initialized" ,"Current mode flags (see <tt>uifcdefs.js</tt>)" ,"A change has occurred in an input call. You are expected to set this to false before calling the input if you care about it." diff --git a/src/sbbs3/js_user.c b/src/sbbs3/js_user.c index 7df5468e7a..25dee7bd12 100644 --- a/src/sbbs3/js_user.c +++ b/src/sbbs3/js_user.c @@ -847,7 +847,7 @@ static jsSyncPropertySpec js_user_properties[] = { }; #ifdef BUILD_JSDOCS -static char* user_prop_desc[] = { +static const char* user_prop_desc[] = { "Record number (1-based)" ,"Alias/name" @@ -917,7 +917,7 @@ static jsSyncPropertySpec js_user_security_properties[] = { }; #ifdef BUILD_JSDOCS -static char* user_security_prop_desc[] = { +static const char* user_security_prop_desc[] = { "Password" ,"Date password last modified (time_t format)" @@ -956,7 +956,7 @@ static jsSyncPropertySpec js_user_limits_properties[] = { #ifdef BUILD_JSDOCS -static char* user_limits_prop_desc[] = { +static const char* user_limits_prop_desc[] = { "Time (in minutes) per logon" ,"Time (in minutes) per day" @@ -1004,7 +1004,7 @@ static jsSyncPropertySpec js_user_stats_properties[] = { }; #ifdef BUILD_JSDOCS -static char* user_stats_prop_desc[] = { +static const char* user_stats_prop_desc[] = { "Date of previous logon (time_t format)" ,"Date of first logon (time_t format)" diff --git a/src/sbbs3/js_xtrn_area.c b/src/sbbs3/js_xtrn_area.c index c58da772a8..dd0a8afd85 100644 --- a/src/sbbs3/js_xtrn_area.c +++ b/src/sbbs3/js_xtrn_area.c @@ -25,7 +25,7 @@ #ifdef BUILD_JSDOCS -static char* xtrn_sec_prop_desc[] = { +static const char* xtrn_sec_prop_desc[] = { "Index into sec_list array (or -1 if not in index)" ,"Unique number for this external program section" @@ -36,7 +36,7 @@ static char* xtrn_sec_prop_desc[] = { ,NULL }; -static char* xtrn_prog_prop_desc[] = { +static const char* xtrn_prog_prop_desc[] = { "Index into prog_list array (or -1 if not in index)" ,"Program number" @@ -62,7 +62,7 @@ static char* xtrn_prog_prop_desc[] = { ,NULL }; -static char* event_prop_desc[] = { +static const char* event_prop_desc[] = { "Command-line" ,"Startup directory" @@ -79,7 +79,7 @@ static char* event_prop_desc[] = { ,NULL }; -static char* xedit_prop_desc[] = { +static const char* xedit_prop_desc[] = { "Name" ,"Command-line" -- GitLab