equal
deleted
inserted
replaced
43 |
43 |
44 static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; } |
44 static inline bool StrEmpty(const char *s) { return s == NULL || s[0] == '\0'; } |
45 |
45 |
46 |
46 |
47 /** Get the length of a string, within a limited buffer */ |
47 /** Get the length of a string, within a limited buffer */ |
48 static inline int ttd_strnlen(const char *str, int maxlen) |
48 static inline size_t ttd_strnlen(const char *str, size_t maxlen) |
49 { |
49 { |
50 const char *t; |
50 const char *t; |
51 for (t = str; *t != '\0' && t - str < maxlen; t++) {} |
51 for (t = str; *t != '\0' && (size_t)(t - str) < maxlen; t++) {} |
52 return t - str; |
52 return t - str; |
53 } |
53 } |
54 |
54 |
55 /** Convert the md5sum number to a 'hexadecimal' string, return next pos in buffer */ |
55 /** Convert the md5sum number to a 'hexadecimal' string, return next pos in buffer */ |
56 char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16]); |
56 char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16]); |