Changeset - r2923:9acf8efb78dc
[Not reviewed]
master
0 1 0
truelight - 18 years ago 2006-01-29 20:32:30
truelight@openttd.org
(svn r3479) -Fix: fixed warnings on 64bit platforms (anyway, most 64bit platforms)
(tnx to qball and DarkVater for testing)
1 file changed with 10 insertions and 10 deletions:
settings.c
10
10
0 comments (0 inline, 0 general)
settings.c
Show inline comments
 
@@ -488,29 +488,29 @@ static void make_manyofmany(char *buf, c
 
	} while (++i, x>>=1);
 
	*buf = 0;
 
}
 

	
 
static const void *string_to_val(const SettingDesc *desc, const char *str)
 
{
 
	uint32 val;
 
	unsigned long val;
 
	char *end;
 

	
 
	switch(desc->flags & 0xF) {
 
	case SDT_INTX:
 
		val = strtoul(str, &end, 0);
 
		if (*end != 0) ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name);
 
		return (void*)val;
 
	case SDT_ONEOFMANY: {
 
		int r = lookup_oneofmany((const char*)desc->b, str, -1);
 
		long r = lookup_oneofmany((const char*)desc->b, str, -1);
 
		if (r != -1) return (void*)r;
 
		ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name);
 
		return 0;
 
	}
 
	case SDT_MANYOFMANY: {
 
		uint32 r = lookup_manyofmany(desc->b, str);
 
		if (r != (uint32)-1) return (void*)r;
 
		unsigned long r = lookup_manyofmany(desc->b, str);
 
		if (r != (unsigned long)-1) return (void*)r;
 
		ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name);
 
		return 0;
 
	}
 
	case SDT_BOOLX:
 
		if (!strcmp(str, "true") || !strcmp(str, "on") || !strcmp(str, "1"))
 
			return (void*)true;
 
@@ -564,21 +564,21 @@ static void load_setting_desc(IniFile *i
 
		case SDT_ONEOFMANY:
 
		case SDT_MANYOFMANY:
 
		case SDT_BOOLX:
 
			switch(desc->flags >> 4 & 7) {
 
			case SDT_INT8 >> 4:
 
			case SDT_UINT8 >> 4:
 
				*(byte*)ptr = (byte)(uint)p;
 
				*(byte*)ptr = (byte)(unsigned long)p;
 
				break;
 
			case SDT_INT16 >> 4:
 
			case SDT_UINT16 >> 4:
 
				*(uint16*)ptr = (uint16)(uint)p;
 
				*(uint16*)ptr = (uint16)(unsigned long)p;
 
				break;
 
			case SDT_INT32 >> 4:
 
			case SDT_UINT32 >> 4:
 
				*(uint32*)ptr = (uint32)p;
 
				*(uint32*)ptr = (uint32)(unsigned long)p;
 
				break;
 
			default:
 
				NOT_REACHED();
 
			}
 
			break;
 
		case SDT_STRING:
 
@@ -645,23 +645,23 @@ static void save_setting_desc(IniFile *i
 
			case SDT_ONEOFMANY:
 
			case SDT_MANYOFMANY:
 
			case SDT_BOOLX:
 
				switch(desc->flags >> 4 & 7) {
 
				case SDT_INT8 >> 4:
 
				case SDT_UINT8 >> 4:
 
					if (*(byte*)ptr == (byte)(uint)p)
 
					if (*(byte*)ptr == (byte)(unsigned long)p)
 
						continue;
 
					break;
 
				case SDT_INT16 >> 4:
 
				case SDT_UINT16 >> 4:
 
					if (*(uint16*)ptr == (uint16)(uint)p)
 
					if (*(uint16*)ptr == (uint16)(unsigned long)p)
 
						continue;
 
					break;
 
				case SDT_INT32 >> 4:
 
				case SDT_UINT32 >> 4:
 
					if (*(uint32*)ptr == (uint32)p)
 
					if (*(uint32*)ptr == (uint32)(unsigned long)p)
 
						continue;
 
					break;
 
				default:
 
					NOT_REACHED();
 
				}
 
				break;
0 comments (0 inline, 0 general)