CINE: Fix GCC Compiler Warnings

These are mainly signed vs. unsigned comparison warnings apart from
a set, but unused variable in the main loop code which can be removed.
This commit is contained in:
D G Turner 2021-03-17 21:53:28 +00:00
parent 1e678f136c
commit f8f0f09ef2
4 changed files with 7 additions and 10 deletions

View File

@ -199,7 +199,7 @@ int loadSet(const char *resourceName, int16 idx, int16 frameIndex = -1);
void checkAnimDataTableBounds(int entry) {
if (entry < 0) {
error("Out of free animation space");
} else if (entry >= g_cine->_animDataTable.size()) {
} else if (entry >= (int)g_cine->_animDataTable.size()) {
error("Animation entry (%d) out of bounds", entry);
}
}
@ -209,7 +209,7 @@ int16 fixAnimDataTableEndFrame(int entry, int16 startFrame, int16 endFrame) {
// Ensure that a non-empty range [entry, entry + endFrame - startFrame) stays in bounds
if (endFrame > startFrame &&
entry + (endFrame - startFrame - 1) >= g_cine->_animDataTable.size()) {
entry + (endFrame - startFrame - 1) >= (int)g_cine->_animDataTable.size()) {
warning("Restricting out of bounds animation data table write to in bounds");
return (int16)(g_cine->_animDataTable.size() - entry + startFrame);
} else {

View File

@ -410,7 +410,6 @@ void purgeSeqList() {
}
void CineEngine::mainLoop(int bootScriptIdx) {
bool playerAction;
byte di;
if (_preLoad == false) {
@ -540,8 +539,6 @@ void CineEngine::mainLoop(int bootScriptIdx) {
removeMessages();
if (waitForPlayerClick) {
playerAction = false;
_messageLen <<= 3;
if (_messageLen < 800)
_messageLen = 800;

View File

@ -225,7 +225,7 @@ int16 findFileInBundle(const char *fileName) {
// Prefer current disk's resource file
Common::Array<VolumeResource> volRes = it->_value;
VolumeResource match = volRes[0];
for (int i = 0; i < volRes.size(); i++) {
for (uint i = 0; i < volRes.size(); i++) {
if (volRes[i].diskNum == currentDisk) {
match = volRes[i];
break;

View File

@ -833,7 +833,7 @@ void MidiSoundDriverH32::selectInstrument2(int channel, int timbreGroup, int tim
byte checkSum = 0;
for (int i = 4; i < sizeof(sysEx) - 1; ++i)
for (uint i = 4; i < sizeof(sysEx) - 1; ++i)
checkSum += sysEx[i];
sysEx[sizeof(sysEx) - 1] = 0x80 - (checkSum & 0x7F);
@ -872,7 +872,7 @@ void MidiSoundDriverH32::selectInstrument3(int channel, int offsetMode, int timb
byte checkSum = 0;
for (int i = 4; i < sizeof(sysEx) - 1; ++i)
for (uint i = 4; i < sizeof(sysEx) - 1; ++i)
checkSum += sysEx[i];
sysEx[sizeof(sysEx) - 1] = 0x80 - (checkSum & 0x7F);
@ -934,7 +934,7 @@ void MidiSoundDriverH32::selectInstrument5(int messageNum) {
memset(sysEx + 7, 0x20, 20);
if (messageNum >= 0 && messageNum < g_cine->_messageTable.size()) {
if (messageNum >= 0 && messageNum < (int)g_cine->_messageTable.size()) {
Common::String msg = g_cine->_messageTable[messageNum];
memcpy(sysEx + 7, msg.c_str(), MIN<int>(20, msg.size()));
}
@ -945,7 +945,7 @@ void MidiSoundDriverH32::selectInstrument5(int messageNum) {
byte checkSum = 0;
for (int i = 4; i < sizeof(sysEx) - 1; ++i)
for (uint i = 4; i < sizeof(sysEx) - 1; ++i)
checkSum += sysEx[i];
sysEx[sizeof(sysEx) - 1] = 0x80 - (checkSum & 0x7F);