From a233696212c1707be4c993de8c36228137475af1 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 30 Mar 2017 14:02:27 -0500 Subject: [PATCH] SCI: Update formatting strings to match updated Span API --- engines/sci/console.cpp | 6 +++--- engines/sci/engine/message.cpp | 8 ++++---- engines/sci/engine/script.cpp | 2 +- engines/sci/graphics/palette.cpp | 2 +- engines/sci/parser/vocabulary.cpp | 4 ++-- engines/sci/resource.cpp | 6 +++--- engines/sci/resource_audio.cpp | 6 +++--- engines/sci/sound/drivers/midi.cpp | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index eed0be1a8286..16f59523b49c 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -954,7 +954,7 @@ bool Console::cmdResourceInfo(int argc, const char **argv) { else { Resource *resource = _engine->getResMan()->findResource(ResourceId(res, resNum), 0); if (resource) { - debugPrintf("Resource size: %lu\n", resource->size()); + debugPrintf("Resource size: %u\n", resource->size()); debugPrintf("Resource location: %s\n", resource->getResourceLocation().c_str()); } else { debugPrintf("Resource %s.%03d not found\n", argv[1], resNum); @@ -1067,11 +1067,11 @@ bool Console::cmdVerifyScripts(int argc, const char **argv) { debugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber()); if (script && heap && (script->size() + heap->size() > 65535)) - debugPrintf("Error: script and heap %d together are larger than 64KB (%lu bytes)\n", + debugPrintf("Error: script and heap %d together are larger than 64KB (%u bytes)\n", itr->getNumber(), script->size() + heap->size()); } else { // SCI3 if (script && script->size() > 65535) - debugPrintf("Error: script %d is larger than 64KB (%lu bytes)\n", + debugPrintf("Error: script %d is larger than 64KB (%u bytes)\n", itr->getNumber(), script->size()); } } diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index c30ad3aee440..baa926166a11 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -82,7 +82,7 @@ class MessageReaderV2 : public MessageReader { record.string = (const char *)_data.getUnsafeDataAt(stringOffset, maxSize); record.length = Common::strnlen(record.string, maxSize); if (record.length == maxSize) { - warning("Message %s from %s appears truncated at %ld", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); + warning("Message %s from %s appears truncated at %d", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); } return true; } @@ -110,7 +110,7 @@ class MessageReaderV3 : public MessageReader { record.string = (const char *)_data.getUnsafeDataAt(stringOffset, maxSize); record.length = Common::strnlen(record.string, maxSize); if (record.length == maxSize) { - warning("Message %s from %s appears truncated at %ld", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); + warning("Message %s from %s appears truncated at %d", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); } return true; } @@ -138,7 +138,7 @@ class MessageReaderV4 : public MessageReader { record.string = (const char *)_data.getUnsafeDataAt(stringOffset, maxSize); record.length = Common::strnlen(record.string, maxSize); if (record.length == maxSize) { - warning("Message %s from %s appears truncated at %ld", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); + warning("Message %s from %s appears truncated at %d", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); } return true; } @@ -169,7 +169,7 @@ class MessageReaderV4_MacSCI32 : public MessageReader { record.string = (const char *)_data.getUnsafeDataAt(stringOffset, maxSize); record.length = Common::strnlen(record.string, maxSize); if (record.length == maxSize) { - warning("Message %s from %s appears truncated at %ld", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); + warning("Message %s from %s appears truncated at %d", tuple.toString().c_str(), _data.name().c_str(), recordPtr - _data); } return true; } diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp index e1ab6ea77e7f..a13565c3bd3d 100644 --- a/engines/sci/engine/script.cpp +++ b/engines/sci/engine/script.cpp @@ -881,7 +881,7 @@ bool Script::isValidOffset(uint16 offset) const { SegmentRef Script::dereference(reg_t pointer) { if (pointer.getOffset() > _buf->size()) { - error("Script::dereference(): Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%lu)", + error("Script::dereference(): Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%u)", PRINT_REG(pointer), _buf->size()); return SegmentRef(); } diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 307c8aedde0c..e36028d984df 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -151,7 +151,7 @@ void GfxPalette::createFromData(const SciSpan &data, Palette *palett if (data.size() < 37) { // This happens when loading palette of picture 0 in sq5 - the resource is broken and doesn't contain a full // palette - debugC(kDebugLevelResMan, "GfxPalette::createFromData() - not enough bytes in resource (%lu), expected palette header", data.size()); + debugC(kDebugLevelResMan, "GfxPalette::createFromData() - not enough bytes in resource (%u), expected palette header", data.size()); return; } diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp index 4fefff6e3bcd..1f062c63637e 100644 --- a/engines/sci/parser/vocabulary.cpp +++ b/engines/sci/parser/vocabulary.cpp @@ -299,7 +299,7 @@ bool Vocabulary::loadAltInputs() { uint32 maxSize = end - it; uint32 l = Common::strnlen(t._input, maxSize); if (l == maxSize) { - error("Alt input from %s appears truncated at %ld", resource->name().c_str(), it - resource->cbegin()); + error("Alt input from %s appears truncated at %d", resource->name().c_str(), it - resource->cbegin()); } t._inputLength = l; it += l + 1; @@ -308,7 +308,7 @@ bool Vocabulary::loadAltInputs() { maxSize = end - it; l = Common::strnlen(t._replacement, maxSize); if (l == maxSize) { - error("Alt input replacement from %s appears truncated at %ld", resource->name().c_str(), it - resource->cbegin()); + error("Alt input replacement from %s appears truncated at %d", resource->name().c_str(), it - resource->cbegin()); } it += l + 1; diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 6f4248e09452..6aaf51b166e2 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -309,7 +309,7 @@ bool Resource::loadPatch(Common::SeekableReadStream *file) { _header = new byte[_headerSize]; if (data() == nullptr || (_headerSize > 0 && _header == nullptr)) { - error("Can't allocate %lu bytes needed for loading %s", size() + _headerSize, _id.toString().c_str()); + error("Can't allocate %u bytes needed for loading %s", size() + _headerSize, _id.toString().c_str()); } uint32 bytesRead; @@ -321,7 +321,7 @@ bool Resource::loadPatch(Common::SeekableReadStream *file) { bytesRead = file->read(ptr, size()); if (bytesRead != size()) - error("Read %d bytes from %s but expected %lu", bytesRead, _id.toString().c_str(), size()); + error("Read %d bytes from %s but expected %u", bytesRead, _id.toString().c_str(), size()); _status = kResStatusAllocated; return true; @@ -1028,7 +1028,7 @@ void ResourceManager::printLRU() { while (it != _LRU.end()) { res = *it; - debug("\t%s: %lu bytes", res->_id.toString().c_str(), res->size()); + debug("\t%s: %u bytes", res->_id.toString().c_str(), res->size()); mem += res->size(); ++entries; ++it; diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 0125a0e19be4..7423890903c4 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -85,7 +85,7 @@ bool Resource::loadFromWaveFile(Common::SeekableReadStream *file) { uint32 bytesRead = file->read(ptr, _size); if (bytesRead != _size) - error("Read %d bytes from %s but expected %lu", bytesRead, _id.toString().c_str(), _size); + error("Read %d bytes from %s but expected %u", bytesRead, _id.toString().c_str(), _size); _status = kResStatusAllocated; return true; @@ -139,12 +139,12 @@ bool Resource::loadFromAudioVolumeSCI1(Common::SeekableReadStream *file) { _data = ptr; if (!ptr) { - error("Can't allocate %lu bytes needed for loading %s", _size, _id.toString().c_str()); + error("Can't allocate %u bytes needed for loading %s", _size, _id.toString().c_str()); } uint32 bytesRead = file->read(ptr, size()); if (bytesRead != size()) - warning("Read %d bytes from %s but expected %lu", bytesRead, _id.toString().c_str(), _size); + warning("Read %d bytes from %s but expected %u", bytesRead, _id.toString().c_str(), _size); _status = kResStatusAllocated; return true; diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp index b9035b07eab5..a7039aa33576 100644 --- a/engines/sci/sound/drivers/midi.cpp +++ b/engines/sci/sound/drivers/midi.cpp @@ -1025,7 +1025,7 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) { error("MT-32 patch has wrong type"); } else { // Happens in the SCI3 interactive demo of Lighthouse - warning("TODO: Ignoring new SCI3 type of MT-32 patch for now (size = %lu)", res->size()); + warning("TODO: Ignoring new SCI3 type of MT-32 patch for now (size = %u)", res->size()); } } } else {