Changeset - r7510:aee01ec6466f
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-08-31 20:50:18
rubidium@openttd.org
(svn r11025) -Fix: safeguard StrEmpty from calls with NULL.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/string.h
Show inline comments
 
@@ -40,25 +40,25 @@ void str_strip_colours(char *str);
 
 * Valid filter types for IsValidChar.
 
 */
 
enum CharSetFilter {
 
	CS_ALPHANUMERAL,      ///< Both numeric and alphabetic and spaces and stuff
 
	CS_NUMERAL,           ///< Only numeric ones
 
	CS_ALPHA,             ///< Only alphabetic values
 
};
 

	
 
/** Convert the given string to lowercase, only works with ASCII! */
 
void strtolower(char *str);
 

	
 

	
 
static inline bool StrEmpty(const char *s) { return s[0] == '\0'; }
 
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)
 
{
 
	const char *t;
 
	for (t = str; *t != '\0' && t - str < maxlen; t++);
 
	return t - str;
 
}
 

	
 
/** Convert the md5sum number to a 'hexadecimal' string, return next pos in buffer */
 
char *md5sumToString(char *buf, const char *last, const uint8 md5sum[16]);
0 comments (0 inline, 0 general)