mirror of https://github.com/OpenTTD/OpenTTD
(svn r22522) -Fix (r22489): (size_t)(uint32)(-1) != (size_t)-1
parent
36526d6b05
commit
615e435677
|
@ -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);
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef SimpleTinyEnumT<SettingGuiFlagLong, uint16> SettingGuiFlag;
|
|||
|
||||
|
||||
typedef bool OnChange(int32 var); ///< callback prototype on data modification
|
||||
typedef int32 OnConvert(const char *value); ///< callback prototype for convertion error
|
||||
typedef size_t OnConvert(const char *value); ///< callback prototype for convertion error
|
||||
|
||||
/** Properties of config file settings. */
|
||||
struct SettingDescBase {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/** @file table/settings.h Settings to save in the savegame and config file. */
|
||||
|
||||
/* Callback function used in _settings[] as well as _company_settings[] */
|
||||
static int32 ConvertLandscape(const char *value);
|
||||
static size_t ConvertLandscape(const char *value);
|
||||
|
||||
|
||||
/****************************
|
||||
|
|
Loading…
Reference in New Issue