diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 427e32deb39f..5ba88d94173e 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -467,7 +467,7 @@ void HunkTable::saveLoadWithSerializer(Common::Serializer &s) { void Script::syncStringHeap(Common::Serializer &s) { if (getSciVersion() < SCI_VERSION_1_1) { // Sync all of the SCI_OBJ_STRINGS blocks - SciSpan buf = (SciSpan &)*_buf; + SciSpan buf = *_buf; bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY); if (oldScriptHeader) @@ -490,7 +490,7 @@ void Script::syncStringHeap(Common::Serializer &s) { } else if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1_LATE){ // Strings in SCI1.1 come after the object instances - SciSpan buf = _heap.subspan(4 + _heap.getUint16SEAt(2) * 2); + SciSpan buf = _heap.subspan(4 + _heap.getUint16SEAt(2) * 2); // Skip all of the objects while (buf.getUint16SEAt(0) == SCRIPT_OBJECT_MAGIC_NUMBER) @@ -502,8 +502,7 @@ void Script::syncStringHeap(Common::Serializer &s) { } else if (getSciVersion() == SCI_VERSION_3) { const int stringOffset = _buf->getInt32SEAt(4); const int length = _buf->getInt32SEAt(8) - stringOffset; - SciSpan buf = _buf->subspan(stringOffset, length); - s.syncBytes(buf.getUnsafeDataAt(0, length), length); + s.syncBytes(_buf->getUnsafeDataAt(stringOffset, length), length); } } diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index 8cf6ad0c901e..7e3a66150185 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -882,7 +882,7 @@ SegmentRef Script::dereference(reg_t pointer) { SegmentRef ret; ret.isRaw = true; ret.maxSize = _buf->size() - pointer.getOffset(); - ret.raw = const_cast(_buf->getUnsafeDataAt(pointer.getOffset(), ret.maxSize)); + ret.raw = _buf->getUnsafeDataAt(pointer.getOffset(), ret.maxSize); return ret; } diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h index e0faa115753d..f9b3845f6a99 100644 --- a/engines/sci/engine/script.h +++ b/engines/sci/engine/script.h @@ -68,9 +68,9 @@ typedef Common::Array offsetLookupArrayType; class Script : public SegmentObj { private: int _nr; /**< Script number */ - Common::SpanOwner > _buf; /**< Static data buffer, or NULL if not used */ - SciSpan _script; /**< Script size includes alignment byte */ - SciSpan _heap; /**< Start of heap if SCI1.1, NULL otherwise */ + Common::SpanOwner > _buf; /**< Static data buffer, or NULL if not used */ + SciSpan _script; /**< Script size includes alignment byte */ + SciSpan _heap; /**< Start of heap if SCI1.1, NULL otherwise */ int _lockers; /**< Number of classes and objects that require this script */