Use size_t for strlen length temporaries

This commit is contained in:
2026-05-20 15:34:19 -06:00
parent 9a0c07a461
commit cec7e2caf3
6 changed files with 7 additions and 6 deletions

View File

@@ -4397,7 +4397,7 @@ void
check_special_chars (char *cmd, int do_ascii) /* check for %X */ check_special_chars (char *cmd, int do_ascii) /* check for %X */
{ {
int occur = 0; int occur = 0;
int len = strlen (cmd); size_t len = strlen (cmd);
char *buf, *utf; char *buf, *utf;
char tbuf[4]; char tbuf[4];
int i = 0, j = 0; int i = 0, j = 0;

View File

@@ -1017,7 +1017,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
char *account; char *account;
char ip[128], nick[NICKLEN]; char ip[128], nick[NICKLEN];
char *text, *ex; char *text, *ex;
int len = strlen (type); size_t len = strlen (type);
/* fill in the "ip" and "nick" buffers */ /* fill in the "ip" and "nick" buffers */
ex = strchr (word[1], '!'); ex = strchr (word[1], '!');

View File

@@ -321,7 +321,7 @@ url_check_line (char *buf)
for (i = 0; i < ARRAY_SIZE (commands); i++) for (i = 0; i < ARRAY_SIZE (commands); i++)
{ {
char *cmd = commands[i]; char *cmd = commands[i];
int len = strlen (cmd); size_t len = strlen (cmd);
if (strncmp (cmd, po, len) == 0) if (strncmp (cmd, po, len) == 0)
{ {

View File

@@ -98,7 +98,7 @@ path_part (char *file, char *path, int pathlen)
char * /* like strstr(), but nocase */ char * /* like strstr(), but nocase */
nocasestrstr (const char *s, const char *wanted) nocasestrstr (const char *s, const char *wanted)
{ {
register const int len = strlen (wanted); register const size_t len = strlen (wanted);
if (len == 0) if (len == 0)
return (char *)s; return (char *)s;

View File

@@ -1364,7 +1364,7 @@ setup_entry_cb (GtkEntry *entry, setting *set)
int size; int size;
int pos; int pos;
unsigned char *p = (unsigned char*)gtk_entry_get_text (entry); unsigned char *p = (unsigned char*)gtk_entry_get_text (entry);
int len = strlen (p); size_t len = strlen ((const char *) p);
/* need to truncate? */ /* need to truncate? */
if (len >= set->extra) if (len >= set->extra)

View File

@@ -313,7 +313,8 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity) gboolean no_activity)
{ {
int dotime = FALSE; int dotime = FALSE;
int comma, k, i = 0, j = 0, len = strlen (text); int comma, k, i = 0, j = 0;
size_t len = strlen (text);
unsigned char *newtext = g_malloc (len + 1024); unsigned char *newtext = g_malloc (len + 1024);