[Scummvm-git-logs] scummvm master -> e03736a7276b430e47d8c78b10aef1401a744a50
dwatteau
noreply at scummvm.org
Fri Aug 9 23:07:22 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d59f66dfe1 DIRECTOR: Properly fix -Wformat warnings with PRId64
e03736a727 FREESCAPE: Properly fix -Wformat warnings with PRIx64
Commit: d59f66dfe1981688ce7948e3b5cfacb95d214779
https://github.com/scummvm/scummvm/commit/d59f66dfe1981688ce7948e3b5cfacb95d214779
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2024-08-10T01:01:16+02:00
Commit Message:
DIRECTOR: Properly fix -Wformat warnings with PRId64
As discussed in Discord, in PR#5998 and other places, we can just use PRId64
from <inttypes.h> as a reliable way of printing int64 values on all
platforms, now that this header is guaranteed to be available everywhere.
Fixes build warnings on some 64-bit platforms, which were introduced by my
own previous commit 6ce2ba98f8844d004241726a71346f00525e07aa.
Changed paths:
engines/director/frame.cpp
engines/director/score.cpp
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index e1a68c8c903..c7327d4afcc 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -247,14 +247,14 @@ void Frame::readMainChannelsD2(Common::MemoryReadStreamEndian &stream, uint16 of
break;
default:
// This means that a `case` label has to be split at this position
- error("Frame::readMainChannelsD2(): Miscomputed field position: %lld", stream.pos() - initPos + offset);
+ error("Frame::readMainChannelsD2(): Miscomputed field position: %" PRId64, stream.pos() - initPos + offset);
break;
}
}
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readMainChannelsD2(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readMainChannelsD2(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
_mainChannels.transChunkSize = CLIP<byte>(_mainChannels.transChunkSize, 0, 128);
@@ -281,7 +281,7 @@ void Frame::readSpriteD2(Common::MemoryReadStreamEndian &stream, uint16 offset,
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readSpriteD2(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readSpriteD2(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
}
@@ -376,7 +376,7 @@ void readSpriteDataD2(Common::SeekableReadStreamEndian &stream, Sprite &sprite,
break;
default:
// This means that a `case` label has to be split at this position
- error("readSpriteDataD2(): Miscomputed field position: %lld", stream.pos() - startPosition);
+ error("readSpriteDataD2(): Miscomputed field position: %" PRId64, stream.pos() - startPosition);
}
}
@@ -555,14 +555,14 @@ void Frame::readMainChannelsD4(Common::MemoryReadStreamEndian &stream, uint16 of
break;
default:
// This means that a `case` label has to be split at this position
- error("Frame::readMainChannelsD4(): Miscomputed field position: %lld", stream.pos() - initPos + offset);
+ error("Frame::readMainChannelsD4(): Miscomputed field position: %" PRId64, stream.pos() - initPos + offset);
break;
}
}
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readMainChannelsD4(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readMainChannelsD4(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
_mainChannels.transChunkSize = CLIP<byte>(_mainChannels.transChunkSize, 0, 128);
@@ -589,7 +589,7 @@ void Frame::readSpriteD4(Common::MemoryReadStreamEndian &stream, uint16 offset,
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readSpriteD4(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readSpriteD4(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
}
@@ -706,7 +706,7 @@ void readSpriteDataD4(Common::SeekableReadStreamEndian &stream, Sprite &sprite,
break;
default:
// This means that a `case` label has to be split at this position
- error("readSpriteDataD4(): Miscomputed field position: %lld", stream.pos() - startPosition);
+ error("readSpriteDataD4(): Miscomputed field position: %" PRId64, stream.pos() - startPosition);
}
}
@@ -857,14 +857,14 @@ void Frame::readMainChannelsD5(Common::MemoryReadStreamEndian &stream, uint16 of
break;
default:
// This means that a `case` label has to be split at this position
- error("Frame::readMainChannelsD5(): Miscomputed field position: %lld", stream.pos() - initPos + offset);
+ error("Frame::readMainChannelsD5(): Miscomputed field position: %" PRId64, stream.pos() - initPos + offset);
break;
}
}
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readMainChannelsD5(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readMainChannelsD5(): Read %" PRId64 "extra bytes", stream.pos() - finishPosition);
}
_mainChannels.transChunkSize = CLIP<byte>(_mainChannels.transChunkSize, 0, 128);
@@ -891,7 +891,7 @@ void Frame::readSpriteD5(Common::MemoryReadStreamEndian &stream, uint16 offset,
if (fieldPosition > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readSpriteD5(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readSpriteD5(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
// Sometimes removed sprites leave garbage in the channel
@@ -1026,7 +1026,7 @@ void readSpriteDataD5(Common::SeekableReadStreamEndian &stream, Sprite &sprite,
break;
default:
// This means that a `case` label has to be split at this position
- error("readSpriteDataD5(): Miscomputed field position: %lld", stream.pos() - startPosition);
+ error("readSpriteDataD5(): Miscomputed field position: %" PRId64, stream.pos() - startPosition);
}
}
@@ -1089,7 +1089,7 @@ void Frame::readSpriteD6(Common::MemoryReadStreamEndian &stream, uint16 offset,
if (stream.pos() > finishPosition) {
// This means that the relevant `case` label reads too many bytes and must be split
- error("Frame::readSpriteD6(): Read %lld extra bytes", stream.pos() - finishPosition);
+ error("Frame::readSpriteD6(): Read %" PRId64 " extra bytes", stream.pos() - finishPosition);
}
// Sometimes removed sprites leave garbage in the channel
@@ -1226,7 +1226,7 @@ void readSpriteDataD6(Common::SeekableReadStreamEndian &stream, Sprite &sprite,
break;
default:
// This means that a `case` label has to be split at this position
- error("readSpriteDataD6(): Miscomputed field position: %lld", stream.pos() - startPosition);
+ error("readSpriteDataD6(): Miscomputed field position: %" PRId64, stream.pos() - startPosition);
}
}
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 42f9d8390c6..dc070c57bcb 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1677,13 +1677,13 @@ void Score::loadFrames(Common::SeekableReadStreamEndian &stream, uint16 version)
}
bool Score::loadFrame(int frameNum, bool loadCast) {
- debugC(7, kDebugLoading, "****** Frame request %d, current pos: %lld, current frame number: %d", frameNum, _framesStream->pos(), _curFrameNumber);
+ debugC(7, kDebugLoading, "****** Frame request %d, current pos: %" PRId64 ", current frame number: %d", frameNum, _framesStream->pos(), _curFrameNumber);
int sourceFrame = _curFrameNumber;
int targetFrame = frameNum;
if (frameNum <= (int)_curFrameNumber) {
- debugC(7, kDebugLoading, "****** Resetting frame %d to start %lld", sourceFrame, _framesStream->pos());
+ debugC(7, kDebugLoading, "****** Resetting frame %d to start %" PRId64, sourceFrame, _framesStream->pos());
// If we are going back, we need to rebuild frames from start
_currentFrame->reset();
sourceFrame = 0;
@@ -1696,7 +1696,7 @@ bool Score::loadFrame(int frameNum, bool loadCast) {
it->reset();
}
- debugC(7, kDebugLoading, "****** Source frame %d to Destination frame %d, current offset %lld", sourceFrame, targetFrame, _framesStream->pos());
+ debugC(7, kDebugLoading, "****** Source frame %d to Destination frame %d, current offset %" PRId64, sourceFrame, targetFrame, _framesStream->pos());
while (sourceFrame < targetFrame - 1 && readOneFrame()) {
sourceFrame++;
Commit: e03736a7276b430e47d8c78b10aef1401a744a50
https://github.com/scummvm/scummvm/commit/e03736a7276b430e47d8c78b10aef1401a744a50
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2024-08-10T01:05:16+02:00
Commit Message:
FREESCAPE: Properly fix -Wformat warnings with PRIx64
As discussed in Discord, in PR#5998 and other places, we can just use PRIx64
from <inttypes.h> as a reliable way of printing int64 values on all
platforms, now that this header is guaranteed to be available everywhere.
Fixes build warnings on some 64-bit platforms, which were introduced by my
own previous commit 0b47206b1a96b89ed52f89bd1e230e6530ee55fc.
Changed paths:
engines/freescape/games/castle/dos.cpp
engines/freescape/games/palettes.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
engines/freescape/loaders/8bitImage.cpp
engines/freescape/sound.cpp
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index 56104a627ff..e0b1aa7366f 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -72,7 +72,7 @@ void CastleEngine::loadDOSFonts(Common::SeekableReadStream *file, int pos) {
}
//debugN("\n");
}
- debug("%llx", file->pos());
+ debug("%" PRIx64, file->pos());
_fontPlane1.set_size(64 * 59);
_fontPlane1.set_bits(bufferPlane1);
diff --git a/engines/freescape/games/palettes.cpp b/engines/freescape/games/palettes.cpp
index f3849469e13..a6ed950a0cc 100644
--- a/engines/freescape/games/palettes.cpp
+++ b/engines/freescape/games/palettes.cpp
@@ -145,7 +145,7 @@ void FreescapeEngine::loadPalettes(Common::SeekableReadStream *file, int offset)
if (label == 255)
break;
auto palette = new byte[16][3];
- debugC(1, kFreescapeDebugParser, "Loading palette for area: %d at %llx", label, file->pos());
+ debugC(1, kFreescapeDebugParser, "Loading palette for area: %d at %" PRIx64, label, file->pos());
for (int c = 0; c < 16; c++) {
int v = file->readUint16BE();
r = (v & 0xf00) >> 8;
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 14521b344c1..e2db32671d5 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -664,7 +664,7 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
}
int64 endLastObject = file->pos();
- debugC(1, kFreescapeDebugParser, "Last position %llx", endLastObject);
+ debugC(1, kFreescapeDebugParser, "Last position %" PRIx64, endLastObject);
debugC(1, kFreescapeDebugParser, "endLastObject is supposed to be %x", base + cPtr);
if ((isDark() || isEclipse()) && (isAmiga() || isAtariST()))
assert(endLastObject <= static_cast<int64>(base + cPtr) + 4);
diff --git a/engines/freescape/loaders/8bitImage.cpp b/engines/freescape/loaders/8bitImage.cpp
index 8694fbb2f13..f5f28d79cd4 100644
--- a/engines/freescape/loaders/8bitImage.cpp
+++ b/engines/freescape/loaders/8bitImage.cpp
@@ -105,7 +105,7 @@ Graphics::ManagedSurface *FreescapeEngine::load8bitBinImage(Common::SeekableRead
load8bitBinImageRow(file, surface, row);
assert(startImage + imageSize == file->pos());
- debugC(1, kFreescapeDebugParser, "Last position: %llx", file->pos());
+ debugC(1, kFreescapeDebugParser, "Last position: %" PRIx64, file->pos());
return surface;
}
diff --git a/engines/freescape/sound.cpp b/engines/freescape/sound.cpp
index a450506379b..c0c2dabbe48 100644
--- a/engines/freescape/sound.cpp
+++ b/engines/freescape/sound.cpp
@@ -535,7 +535,7 @@ void FreescapeEngine::loadSoundsFx(Common::SeekableReadStream *file, int offset,
assert(zero == 0);
int size = file->readUint16BE();
int sampleRate = file->readUint16BE();
- debugC(1, kFreescapeDebugParser, "Loading sound: %d (size: %d, sample rate: %d) at %llx", i, size, sampleRate, file->pos());
+ debugC(1, kFreescapeDebugParser, "Loading sound: %d (size: %d, sample rate: %d) at %" PRIx64, i, size, sampleRate, file->pos());
byte *data = (byte *)malloc(size * sizeof(byte));
file->read(data, size);
sound->sampleRate = sampleRate;
More information about the Scummvm-git-logs
mailing list