summaryrefslogtreecommitdiff
path: root/src/string_func.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_func.h')
-rw-r--r--src/string_func.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string_func.h b/src/string_func.h
index 0733931f3..0e7aa5331 100644
--- a/src/string_func.h
+++ b/src/string_func.h
@@ -45,10 +45,10 @@ static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; }
/** Get the length of a string, within a limited buffer */
-static inline int ttd_strnlen(const char *str, int maxlen)
+static inline size_t ttd_strnlen(const char *str, size_t maxlen)
{
const char *t;
- for (t = str; *t != '\0' && t - str < maxlen; t++) {}
+ for (t = str; *t != '\0' && (size_t)(t - str) < maxlen; t++) {}
return t - str;
}