From cf202049ff85bb63fcb0990f81ba173d1ab4d7c8 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 12 Apr 2006 14:54:12 +0000 Subject: Fixing mismatch between format strings and data on some systems svn-id: r21827 --- engines/kyra/sound_adlib.cpp | 14 +++++++------- engines/scumm/he/resource_he.cpp | 4 ++-- engines/scumm/player_v1.cpp | 10 +++++----- engines/scumm/player_v2.cpp | 12 ++++++------ engines/scumm/script_v6.cpp | 2 +- engines/scumm/scumm.cpp | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 0e823ed347..aef67e19ef 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -769,7 +769,7 @@ void AdlibDriver::writeOPL(byte reg, byte val) { } void AdlibDriver::initChannel(Channel &channel) { - debugC(9, kDebugLevelSound, "initChannel(%lu)", &channel - _channels); + debugC(9, kDebugLevelSound, "initChannel(%lu)", (long)(&channel - _channels)); memset(&channel.dataptr, 0, sizeof(Channel) - ((char*)&channel.dataptr - (char*)&channel)); channel.tempo = 0xFF; @@ -781,7 +781,7 @@ void AdlibDriver::initChannel(Channel &channel) { } void AdlibDriver::noteOff(Channel &channel) { - debugC(9, kDebugLevelSound, "noteOff(%lu)", &channel - _channels); + debugC(9, kDebugLevelSound, "noteOff(%lu)", (long)(&channel - _channels)); // The control channel has no corresponding Adlib channel @@ -860,7 +860,7 @@ uint16 AdlibDriver::getRandomNr() { } void AdlibDriver::setupDuration(uint8 duration, Channel &channel) { - debugC(9, kDebugLevelSound, "setupDuration(%d, %lu)", duration, &channel - _channels); + debugC(9, kDebugLevelSound, "setupDuration(%d, %lu)", duration, (long)(&channel - _channels)); if (channel.durationRandomness) { channel.duration = duration + (getRandomNr() & channel.durationRandomness); return; @@ -875,7 +875,7 @@ void AdlibDriver::setupDuration(uint8 duration, Channel &channel) { // to noteOn(), which will always play the current note. void AdlibDriver::setupNote(uint8 rawNote, Channel &channel, bool flag) { - debugC(9, kDebugLevelSound, "setupNote(%d, %lu)", rawNote, &channel - _channels); + debugC(9, kDebugLevelSound, "setupNote(%d, %lu)", rawNote, (long)(&channel - _channels)); channel.rawNote = rawNote; @@ -929,7 +929,7 @@ void AdlibDriver::setupNote(uint8 rawNote, Channel &channel, bool flag) { } void AdlibDriver::setupInstrument(uint8 regOffset, uint8 *dataptr, Channel &channel) { - debugC(9, kDebugLevelSound, "setupInstrument(%d, %p, %lu)", regOffset, (const void *)dataptr, &channel - _channels); + debugC(9, kDebugLevelSound, "setupInstrument(%d, %p, %lu)", regOffset, (const void *)dataptr, (long)(&channel - _channels)); // Amplitude Modulation / Vibrato / Envelope Generator Type / // Keyboard Scaling Rate / Modulator Frequency Multiple writeOPL(0x20 + regOffset, *dataptr++); @@ -976,7 +976,7 @@ void AdlibDriver::setupInstrument(uint8 regOffset, uint8 *dataptr, Channel &chan // primary effect 2. void AdlibDriver::noteOn(Channel &channel) { - debugC(9, kDebugLevelSound, "noteOn(%lu)", &channel - _channels); + debugC(9, kDebugLevelSound, "noteOn(%lu)", (long)(&channel - _channels)); // The "note on" bit is set, and the current note is played. @@ -990,7 +990,7 @@ void AdlibDriver::noteOn(Channel &channel) { } void AdlibDriver::adjustVolume(Channel &channel) { - debugC(9, kDebugLevelSound, "adjustVolume(%lu)", &channel - _channels); + debugC(9, kDebugLevelSound, "adjustVolume(%lu)", (long)(&channel - _channels)); // Level Key Scaling / Total Level writeOPL(0x43 + _regOffset[_curChannel], calculateOpLevel2(channel)); diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 5bc0352840..c4b81f8516 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -94,13 +94,13 @@ void ResExtractor::setCursor(int id) { int keycolor = 0; CachedCursor *cc = findCachedCursor(id); if (cc != NULL) { - debug(7, "Found cursor %d in cache slot %lu", id, cc - _cursorCache); + debug(7, "Found cursor %d in cache slot %lu", id, (long)(cc - _cursorCache)); } else { cc = getCachedCursorSlot(); assert(cc && !cc->valid); cursorsize = extractResource(id, &cursorRes); convertIcons(cursorRes, cursorsize, &cc->bitmap, &cc->w, &cc->h, &cc->hotspot_x, &cc->hotspot_y, &keycolor, &cc->palette, &cc->palSize); - debug(7, "Adding cursor %d to cache slot %lu", id, cc - _cursorCache); + debug(7, "Adding cursor %d to cache slot %lu", id, (long)(cc - _cursorCache)); free(cursorRes); cc->valid = true; cc->id = id; diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/player_v1.cpp index 03c3419502..0737bb5706 100644 --- a/engines/scumm/player_v1.cpp +++ b/engines/scumm/player_v1.cpp @@ -134,7 +134,7 @@ void Player_V1::parseSpeakerChunk() { parse_again: _chunk_type = READ_LE_UINT16(_next_chunk); debug(6, "parseSpeakerChunk: sound %d, offset %lx, chunk %x", - _current_nr, _next_chunk - _current_data, _chunk_type); + _current_nr, (long)(_next_chunk - _current_data), _chunk_type); _next_chunk += 2; switch (_chunk_type) { @@ -210,7 +210,7 @@ void Player_V1::nextSpeakerCmd() { _next_chunk += 2; } debug(7, "nextSpeakerCmd: chunk %d, offset %4lx: notelen %d", - _chunk_type, _next_chunk - 2 - _current_data, _time_left); + _chunk_type, (long)(_next_chunk - 2 - _current_data), _time_left); if (_time_left == 0) { parseSpeakerChunk(); } else { @@ -266,7 +266,7 @@ parse_again: _chunk_type = READ_LE_UINT16(_next_chunk); debug(6, "parsePCjrChunk: sound %d, offset %4lx, chunk %x", - _current_nr, _next_chunk - _current_data, _chunk_type); + _current_nr, (long)(_next_chunk - _current_data), _chunk_type); _next_chunk += 2; switch (_chunk_type) { @@ -352,8 +352,8 @@ parse_again: *_value_ptr_2 = _start_2; } debug(6, "chunk 1: %lu: %d step %d for %d, %lu: %d step %d for %d", - _value_ptr - (uint*)_channels, _start, _delta, _time_left, - _value_ptr_2 - (uint*)_channels, _start_2, _delta_2, _time_left_2); + (long)(_value_ptr - (uint*)_channels), _start, _delta, _time_left, + (long)(_value_ptr_2 - (uint*)_channels), _start_2, _delta_2, _time_left_2); break; case 2: diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/player_v2.cpp index 9423fb773c..e8abbe1e03 100644 --- a/engines/scumm/player_v2.cpp +++ b/engines/scumm/player_v2.cpp @@ -566,14 +566,14 @@ void Player_V2::execute_cmd(ChannelInfo *channel) { switch (opcode) { case 0xf8: // set hull curve debug(7, "channels[%lu]: hull curve %2d", - channel - _channels, *script_ptr); + (long)(channel - _channels), *script_ptr); channel->d.hull_curve = hull_offsets[*script_ptr / 2]; script_ptr++; break; case 0xf9: // set freqmod curve debug(7, "channels[%lu]: freqmod curve %2d", - channel - _channels, *script_ptr); + (long)(channel - _channels), *script_ptr); channel->d.freqmod_table = freqmod_offsets[*script_ptr / 4]; channel->d.freqmod_modulo = freqmod_lengths[*script_ptr / 4]; script_ptr++; @@ -644,7 +644,7 @@ void Player_V2::execute_cmd(ChannelInfo *channel) { value = READ_LE_UINT16 (script_ptr); channel->array[opcode / 2] = value; debug(7, "channels[%lu]: set param %2d = %5d", - channel - &_channels[0], opcode, value); + (long)(channel - _channels), opcode, value); script_ptr += 2; if (opcode == 14) { /* tempo var */ @@ -672,7 +672,7 @@ void Player_V2::execute_cmd(ChannelInfo *channel) { note &= 0x7f; if (note == 0x7f) { debug(8, "channels[%lu]: pause %d", - channel - _channels, channel->d.time_left); + (long)(channel - _channels), channel->d.time_left); goto end; } } else { @@ -681,7 +681,7 @@ void Player_V2::execute_cmd(ChannelInfo *channel) { if ((opcode & 0x10)) { debug(8, "channels[%lu]: pause %d", - channel - _channels, channel->d.time_left); + (long)(channel - _channels), channel->d.time_left); goto end; } @@ -690,7 +690,7 @@ void Player_V2::execute_cmd(ChannelInfo *channel) { } debug(8, "channels[%lu]: @%04lx note: %3d+%d len: %2d hull: %d mod: %d/%d/%d %s", - dest_channel - channel, script_ptr ? script_ptr - _current_data - 2 : 0, + (long)(dest_channel - channel), (long)(script_ptr ? script_ptr - _current_data - 2 : 0), note, (signed short) dest_channel->d.transpose, channel->d.time_left, dest_channel->d.hull_curve, dest_channel->d.freqmod_table, dest_channel->d.freqmod_incr,dest_channel->d.freqmod_multiplier, diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 5e6976fa8b..08aa7037a8 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -612,7 +612,7 @@ void ScummEngine_v6::o6_pushWordVar() { } void ScummEngine_v6::o6_invalid() { - error("Invalid opcode '%x' at %lx", _opcode, _scriptPointer - _scriptOrgPointer); + error("Invalid opcode '%x' at %lx", _opcode, (long)(_scriptPointer - _scriptOrgPointer)); } void ScummEngine_v6::o6_byteArrayRead() { diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 5cbb237854..042c589718 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1995,7 +1995,7 @@ void ScummEngine::errorString(const char *buf1, char *buf2) { if (_currentScript != 0xFF) { ScriptSlot *ss = &vm.slot[_currentScript]; sprintf(buf2, "(%d:%d:0x%lX): %s", _roomResource, - ss->number, _scriptPointer - _scriptOrgPointer, buf1); + ss->number, (long)(_scriptPointer - _scriptOrgPointer), buf1); } else { strcpy(buf2, buf1); } -- cgit v1.2.3