From 24ef4ce560cc3e0b4e45fe15fae839ce8071bec9 Mon Sep 17 00:00:00 2001 From: KUDr Date: Tue, 18 Apr 2006 18:02:52 +0000 Subject: [PATCH] =?UTF-8?q?(svn=20r4470)=20-Fix:=20FS#97=20=E2=80=94=20Pos?= =?UTF-8?q?sible=20bug=20in=20Win64=20versions=20(by=20michi=5Fcc)=20=20?= =?UTF-8?q?=20Doesn't=20fix=20any=20known=20bug,=20but=20the=20code=20is?= =?UTF-8?q?=20now=20bit=20cleaner.=20The=20proper=20result=20of=20subtract?= =?UTF-8?q?ion=20of=20two=20pointers=20is=20ptrdiff=5Ft.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- saveload.c | 2 +- settings.h | 2 +- stdafx.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/saveload.c b/saveload.c index 39e3d2591c..4a5470cb95 100644 --- a/saveload.c +++ b/saveload.c @@ -722,7 +722,7 @@ void SlObject(void *object, const SaveLoad *sld) } for (; sld->cmd != SL_END; sld++) { - void *ptr = (byte*)object + (unsigned long)sld->address; + void *ptr = (byte*)object + (ptrdiff_t)sld->address; SlObjectMember(ptr, sld); } } diff --git a/settings.h b/settings.h index 1c95601da1..d8d83c6e29 100644 --- a/settings.h +++ b/settings.h @@ -71,7 +71,7 @@ typedef enum { * to add this to the address of the object */ static inline void *ini_get_variable(const SaveLoad *sld, const void *object) { - return (object == NULL) ? sld->address : (byte*)object + (unsigned long)sld->address; + return (object == NULL) ? sld->address : (byte*)object + (ptrdiff_t)sld->address; } void IConsoleSetPatchSetting(const char *name, const char *value); diff --git a/stdafx.h b/stdafx.h index 21444ef703..a8600d9b58 100644 --- a/stdafx.h +++ b/stdafx.h @@ -3,6 +3,7 @@ #ifndef STDAFX_H #define STDAFX_H +#include #include #include #include