diff options
author | frosch <frosch@openttd.org> | 2011-05-29 18:35:31 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-05-29 18:35:31 +0000 |
commit | 615e435677a31a6ed7a78f21ad42af724bf20fca (patch) | |
tree | 27829a81d1431adc113a866693a28e20374c12a4 /src/settings.cpp | |
parent | 36526d6b0520e7cc27c0416a72186eeee7b01bdf (diff) | |
download | openttd-615e435677a31a6ed7a78f21ad42af724bf20fca.tar.xz |
(svn r22522) -Fix (r22489): (size_t)(uint32)(-1) != (size_t)-1
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 24e51a69e..d11ee4344 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -97,10 +97,10 @@ static const char * const _list_group_names[] = { * @param onelen force calculation of the *one parameter * @return the integer index of the full-list, or -1 if not found */ -static int LookupOneOfMany(const char *many, const char *one, size_t onelen = 0) +static size_t LookupOneOfMany(const char *many, const char *one, size_t onelen = 0) { const char *s; - int idx; + size_t idx; if (onelen == 0) onelen = strlen(one); @@ -113,7 +113,7 @@ static int LookupOneOfMany(const char *many, const char *one, size_t onelen = 0) s = many; while (*s != '|' && *s != 0) s++; if ((size_t)(s - many) == onelen && !memcmp(one, many, onelen)) return idx; - if (*s == 0) return -1; + if (*s == 0) return (size_t)-1; many = s + 1; idx++; } @@ -126,11 +126,11 @@ static int LookupOneOfMany(const char *many, const char *one, size_t onelen = 0) * of seperated by a whitespace,tab or | character * @return the 'fully' set integer, or -1 if a set is not found */ -static uint32 LookupManyOfMany(const char *many, const char *str) +static size_t LookupManyOfMany(const char *many, const char *str) { const char *s; - int r; - uint32 res = 0; + size_t r; + size_t res = 0; for (;;) { /* skip "whitespace" */ @@ -141,7 +141,7 @@ static uint32 LookupManyOfMany(const char *many, const char *str) while (*s != 0 && *s != ' ' && *s != '\t' && *s != '|') s++; r = LookupOneOfMany(many, str, s - str); - if (r == -1) return (uint32)-1; + if (r == (size_t)-1) return r; SetBit(res, r); // value found, set it if (*s == 0) break; @@ -1059,7 +1059,7 @@ static bool CheckRoadSide(int p1) * @param value that was read from config file * @return the "hopefully" converted value */ -static int32 ConvertLandscape(const char *value) +static size_t ConvertLandscape(const char *value) { /* try with the old values */ return LookupOneOfMany("normal|hilly|desert|candy", value); |