From bd5c0ad7bb93a661ce284f427faab01513a1e28a Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 17 Mar 2007 10:50:58 +0000 Subject: [PATCH] Cast some more to keep both 32 bit and 64 bit simulator platforms happy. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12819 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/adx.c | 8 ++++---- apps/codecs/aiff.c | 5 +++-- apps/codecs/libm4a/demux.c | 27 +++++++++++++++++---------- apps/codecs/spc.c | 2 +- apps/codecs/spc/Spc_Dsp.h | 6 ++++-- apps/codecs/wav.c | 7 ++++--- apps/plugins/dict.c | 2 +- apps/plugins/wav2wv.c | 3 ++- apps/root_menu.c | 2 +- uisimulator/common/io.c | 4 ++-- 10 files changed, 39 insertions(+), 27 deletions(-) diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c index d85269f999..bf339675c7 100644 --- a/apps/codecs/adx.c +++ b/apps/codecs/adx.c @@ -83,7 +83,7 @@ next_track: } bufsize = n; bufoff = 0; - DEBUGF("ADX: read size = %x\n",bufsize); + DEBUGF("ADX: read size = %lx\n",(unsigned long)bufsize); /* Get file header for starting offset, channel count */ @@ -92,7 +92,7 @@ next_track: /* useful for seeking and reporting current playback position */ avgbytespersec = ci->id3->frequency * 18 * channels / 32; - DEBUGF("avgbytespersec=%ld\n",avgbytespersec); + DEBUGF("avgbytespersec=%ld\n",(unsigned long)avgbytespersec); /* Get loop data */ @@ -232,14 +232,14 @@ next_track: ci->seek_buffer(bufoff); buf = ci->request_buffer(&n, ci->filesize-bufoff); bufsize = n; - DEBUGF("ADX: read size = %x\n",bufsize); + DEBUGF("ADX: read size = %lx\n",(unsigned long)bufsize); if ((off_t)bufsize < channels*18) { /* if we can't get a full frame, just request a single frame (should be able to fit it in the guard buffer) */ DEBUGF("ADX: requesting single frame at %lx\n",bufoff); buf = ci->request_buffer(&n, channels*18); bufsize=n; - DEBUGF("ADX: read size = %x\n",bufsize); + DEBUGF("ADX: read size = %lx\n",(unsigned long)bufsize); } if (!buf) { DEBUGF("ADX: couldn't get buffer at %lx size %lx\n", diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c index e154bce583..4fed9c0c9e 100644 --- a/apps/codecs/aiff.c +++ b/apps/codecs/aiff.c @@ -99,7 +99,8 @@ next_track: i = ((buf[4]<<24)|(buf[5]<<16)|(buf[6]<<8)|buf[7]); if (memcmp(buf, "COMM", 4) == 0) { if (i != 18) { - DEBUGF("CODEC_ERROR: 'COMM' chunk size=%lu != 18\n", i); + DEBUGF("CODEC_ERROR: 'COMM' chunk size=%lu != 18\n", + (unsigned long)i); i = CODEC_ERROR; goto done; } @@ -136,7 +137,7 @@ next_track: i = 8 + offset2snd; /* advance to the beginning of data */ } else { DEBUGF("unsupported AIFF chunk: '%c%c%c%c', size=%lu\n", - buf[0], buf[1], buf[2], buf[3], i); + buf[0], buf[1], buf[2], buf[3], (unsigned long)i); } if (i & 0x01) /* odd chunk sizes must be padded */ diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c index 29cbba7402..634bb4ffca 100644 --- a/apps/codecs/libm4a/demux.c +++ b/apps/codecs/libm4a/demux.c @@ -139,7 +139,8 @@ static bool read_chunk_esds(qtmovie_t *qtmovie, size_t chunk_len) temp=stream_read_int32(qtmovie->stream);//0x15000414 ???? maxBitrate = stream_read_int32(qtmovie->stream); avgBitrate = stream_read_int32(qtmovie->stream); - DEBUGF("audioType=%d, maxBitrate=%ld, avgBitrate=%ld\n",audioType,maxBitrate,avgBitrate); + DEBUGF("audioType=%d, maxBitrate=%ld, avgBitrate=%ld\n",audioType, + (long)maxBitrate,(long)avgBitrate); /* get and verify DecSpecificInfoTag */ if (stream_read_uint8(qtmovie->stream) != 0x05) @@ -257,7 +258,8 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len) sub_chunk_len = stream_read_uint32(qtmovie->stream); if (sub_chunk_len <= 1 || sub_chunk_len > entry_remaining) { - DEBUGF("strange size (%u) for chunk inside mp4a\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside mp4a\n", + (unsigned long)sub_chunk_len); return false; } @@ -281,7 +283,7 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len) return false; } - DEBUGF("entry_remaining=%ld\n",entry_remaining); + DEBUGF("entry_remaining=%ld\n",(long)entry_remaining); stream_skip(qtmovie->stream,entry_remaining); } else { @@ -379,7 +381,7 @@ static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len) if (v > 0x0000ffff) { - DEBUGF("stsz[%d] > 65 kB (%ld)\n", i, v); + DEBUGF("stsz[%d] > 65 kB (%ld)\n", i, (long)v); return false; } @@ -488,7 +490,8 @@ static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len) sub_chunk_len = stream_read_uint32(qtmovie->stream); if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) { - DEBUGF("strange size (%u) for chunk inside stbl\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside stbl\n", + (unsigned long)sub_chunk_len); return false; } @@ -545,7 +548,7 @@ static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len) if ((i = stream_read_uint32(qtmovie->stream)) != 16) { - DEBUGF("unexpected size in media info: %ld\n",i); + DEBUGF("unexpected size in media info: %ld\n", (long)i); stream_skip(qtmovie->stream, size_remaining-4); return true; } @@ -569,7 +572,8 @@ static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len) if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) { - DEBUGF("strange size (%u) for chunk inside minf\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside minf\n", + (unsigned long)sub_chunk_len); return false; } @@ -606,7 +610,8 @@ static bool read_chunk_mdia(qtmovie_t *qtmovie, size_t chunk_len) sub_chunk_len = stream_read_uint32(qtmovie->stream); if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) { - DEBUGF("strange size (%u) for chunk inside mdia\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside mdia\n", + (unsigned long)sub_chunk_len); return false; } @@ -644,7 +649,8 @@ static bool read_chunk_trak(qtmovie_t *qtmovie, size_t chunk_len) sub_chunk_len = stream_read_uint32(qtmovie->stream); if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) { - DEBUGF("strange size (%u) for chunk inside trak\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside trak\n", + (unsigned long)sub_chunk_len); return false; } @@ -682,7 +688,8 @@ static bool read_chunk_moov(qtmovie_t *qtmovie, size_t chunk_len) sub_chunk_len = stream_read_uint32(qtmovie->stream); if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining) { - DEBUGF("strange size (%u) for chunk inside moov\n", sub_chunk_len); + DEBUGF("strange size (%lu) for chunk inside moov\n", + (unsigned long)sub_chunk_len); return false; } diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c index 61376a5770..6c791b46a1 100644 --- a/apps/codecs/spc.c +++ b/apps/codecs/spc.c @@ -859,7 +859,7 @@ enum codec_status codec_main(void) return CODEC_ERROR; } - DEBUGF("SPC: read size = 0x%x\n",buffersize); + DEBUGF("SPC: read size = 0x%lx\n",(unsigned long)buffersize); do { SPC_Init(&spc_emu); diff --git a/apps/codecs/spc/Spc_Dsp.h b/apps/codecs/spc/Spc_Dsp.h index 3f66919db2..d670b20c52 100644 --- a/apps/codecs/spc/Spc_Dsp.h +++ b/apps/codecs/spc/Spc_Dsp.h @@ -298,7 +298,8 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, if ( addr == loop_ptr ) { loop_start = out; - DEBUGF( "loop at %08x (wave #%d)\n", addr - RAM, raw_voice->waveform ); + DEBUGF( "loop at %08lx (wave #%d)\n", + (unsigned long)(addr - RAM), raw_voice->waveform ); } /* header */ @@ -398,7 +399,8 @@ static void decode_brr( struct Spc_Dsp* this, unsigned start_addr, } } - DEBUGF( "end at %08x (wave #%d)\n", addr - RAM, raw_voice->waveform ); + DEBUGF( "end at %08lx (wave #%d)\n", + (unsigned long)(addr - RAM), raw_voice->waveform ); /* add to cache */ this->wave_entry_old [this->oldsize++] = *wave_entry; diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c index f45953a118..ae29bdedc7 100644 --- a/apps/codecs/wav.c +++ b/apps/codecs/wav.c @@ -276,7 +276,8 @@ next_track: i = (buf[4]|(buf[5]<<8)|(buf[6]<<16)|(buf[7]<<24)); if (memcmp(buf, "fmt ", 4) == 0) { if (i < 16) { - DEBUGF("CODEC_ERROR: 'fmt ' chunk size=%lu < 16\n", i); + DEBUGF("CODEC_ERROR: 'fmt ' chunk size=%lu < 16\n", + (unsigned long)i); i = CODEC_ERROR; goto done; } @@ -298,7 +299,7 @@ next_track: * we'll see later if we can't decode it */ DEBUGF("CODEC_WARNING: non-PCM WAVE (formattag=0x%x) " "doesn't have ext. fmt descr (chunksize=%ld<18).\n", - formattag, i); + formattag, (long)i); } size = buf[24]|(buf[25]<<8); if (formattag == WAVE_FORMAT_DVI_ADPCM) { @@ -335,7 +336,7 @@ next_track: totalsamples = (buf[8]|(buf[9]<<8)|(buf[10]<<16)|(buf[11]<<24)); } else { DEBUGF("unknown WAVE chunk: '%c%c%c%c', size=%lu\n", - buf[0], buf[1], buf[2], buf[3], i); + buf[0], buf[1], buf[2], buf[3], (unsigned long)i); } /* go to next chunk (even chunk sizes must be padded) */ diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index 82c6afc906..cdb7c94a3a 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c @@ -179,7 +179,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) filesize = rb->filesize(fIndex); /* get filesize */ DEBUGF("Filesize: %d bytes = %d words \n", filesize, - (filesize / sizeof(struct stWord))); + (filesize / (int)sizeof(struct stWord))); /* for the searching algorithm */ high = filesize / sizeof( struct stWord ); diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index 69ccfa52a5..34f0317726 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c @@ -80,7 +80,8 @@ static void wvupdate (int32_t start_tick, compression = (int)(((int64_t)(bytes_read - bytes_written) * 100 + (bytes_read/2)) / bytes_read); - rb->snprintf(buf, 32, "elapsed time: %ld secs", (elapsed_ticks + (HZ/2)) / HZ); + rb->snprintf(buf, 32, "elapsed time: %ld secs", + (long)(elapsed_ticks + (HZ/2)) / HZ); rb->lcd_puts(0, 2, (unsigned char *)buf); rb->snprintf(buf, 32, "progress: %d%%", progress); diff --git a/apps/root_menu.c b/apps/root_menu.c index 45a9b72451..74b9df6ae8 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -221,7 +221,7 @@ static int wpsscrn(void* param) { DEBUGF("Resume index %X offset %lX\n", global_status.resume_index, - global_status.resume_offset); + (unsigned long)global_status.resume_offset); if (playlist_resume() != -1) { playlist_start(global_status.resume_index, diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index a91b70922c..b03dc01a64 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -331,8 +331,8 @@ void fat_size(unsigned int* size, unsigned int* free) struct statfs fs; if (!statfs(".", &fs)) { - DEBUGF("statfs: bsize=%d blocks=%d free=%d\n", - fs.f_bsize, fs.f_blocks, fs.f_bfree); + DEBUGF("statfs: bsize=%d blocks=%ld free=%ld\n", + (int)fs.f_bsize, fs.f_blocks, fs.f_bfree); if (size) *size = fs.f_blocks * (fs.f_bsize / 1024); if (free)