Skip to content

Commit

Permalink
SCI: Update formatting strings to match updated Span API
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Mar 30, 2017
1 parent 993d83f commit a233696
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions engines/sci/console.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
}
Expand Down
8 changes: 4 additions & 4 deletions engines/sci/engine/message.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/engine/script.cpp
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/graphics/palette.cpp
Expand Up @@ -151,7 +151,7 @@ void GfxPalette::createFromData(const SciSpan<const byte> &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;
}

Expand Down
4 changes: 2 additions & 2 deletions engines/sci/parser/vocabulary.cpp
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions engines/sci/resource.cpp
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions engines/sci/resource_audio.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion engines/sci/sound/drivers/midi.cpp
Expand Up @@ -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 {
Expand Down

0 comments on commit a233696

Please sign in to comment.