From a8d33a4d89f11c45b9690481b08df3c800292005 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 12 Nov 2011 07:58:22 +0000 Subject: (svn r23192) -Codechange: don't cast away const needlessly --- src/saveload/saveload.cpp | 24 ++++++++++++------------ 1 file 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 *l = (std::list *) list; + const std::list *l = (const std::list *) 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 -- cgit v1.2.3-70-g09d2