summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-12 07:58:22 +0000
committerrubidium <rubidium@openttd.org>2011-11-12 07:58:22 +0000
commita8d33a4d89f11c45b9690481b08df3c800292005 (patch)
treeed178877ec978927ff4ed60c4787425641533bf5 /src
parent39263445b07e10256a1f232fc7f58a341bec3cbf (diff)
downloadopenttd-a8d33a4d89f11c45b9690481b08df3c800292005.tar.xz
(svn r23192) -Codechange: don't cast away const needlessly
Diffstat (limited to 'src')
-rw-r--r--src/saveload/saveload.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 5b5c69ae7..c2c158824 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -884,15 +884,15 @@ size_t SlGetFieldLength()
int64 ReadValue(const void *ptr, VarType conv)
{
switch (GetVarMemType(conv)) {
- case SLE_VAR_BL: return (*(bool *)ptr != 0);
- case SLE_VAR_I8: return *(int8 *)ptr;
- case SLE_VAR_U8: return *(byte *)ptr;
- case SLE_VAR_I16: return *(int16 *)ptr;
- case SLE_VAR_U16: return *(uint16*)ptr;
- case SLE_VAR_I32: return *(int32 *)ptr;
- case SLE_VAR_U32: return *(uint32*)ptr;
- case SLE_VAR_I64: return *(int64 *)ptr;
- case SLE_VAR_U64: return *(uint64*)ptr;
+ case SLE_VAR_BL: return (*(const bool *)ptr != 0);
+ case SLE_VAR_I8: return *(const int8 *)ptr;
+ case SLE_VAR_U8: return *(const byte *)ptr;
+ case SLE_VAR_I16: return *(const int16 *)ptr;
+ case SLE_VAR_U16: return *(const uint16*)ptr;
+ case SLE_VAR_I32: return *(const int32 *)ptr;
+ case SLE_VAR_U32: return *(const uint32*)ptr;
+ case SLE_VAR_I64: return *(const int64 *)ptr;
+ case SLE_VAR_U64: return *(const uint64*)ptr;
case SLE_VAR_NULL:return 0;
default: NOT_REACHED();
}
@@ -1012,12 +1012,12 @@ static inline size_t SlCalcStringLen(const void *ptr, size_t length, VarType con
default: NOT_REACHED();
case SLE_VAR_STR:
case SLE_VAR_STRQ:
- str = *(const char**)ptr;
+ str = *(const char * const *)ptr;
len = SIZE_MAX;
break;
case SLE_VAR_STRB:
case SLE_VAR_STRBQ:
- str = (const char*)ptr;
+ str = (const char *)ptr;
len = length;
break;
}
@@ -1265,7 +1265,7 @@ static void *IntToReference(size_t index, SLRefType rt)
*/
static inline size_t SlCalcListLen(const void *list)
{
- std::list<void *> *l = (std::list<void *> *) list;
+ const std::list<void *> *l = (const std::list<void *> *) list;
int type_size = IsSavegameVersionBefore(69) ? 2 : 4;
/* Each entry is saved as type_size bytes, plus type_size bytes are used for the length