1
0
Fork 0
forked from len0rd/rockbox

Fix simulator builds, and some debugf() format strings.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12817 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-03-17 09:54:28 +00:00
parent 75e1fd718f
commit f68362ad6f
14 changed files with 37 additions and 36 deletions

View file

@ -92,8 +92,8 @@ next_track:
/* useful for seeking and reporting current playback position */ /* useful for seeking and reporting current playback position */
avgbytespersec = ci->id3->frequency * 18 * channels / 32; avgbytespersec = ci->id3->frequency * 18 * channels / 32;
DEBUGF("avgbytespersec=%d\n",avgbytespersec); DEBUGF("avgbytespersec=%ld\n",avgbytespersec);
/* Get loop data */ /* Get loop data */
looping = 0; start_adr = 0; end_adr = 0; looping = 0; start_adr = 0; end_adr = 0;
@ -146,14 +146,14 @@ next_track:
} }
if (looping) { if (looping) {
DEBUGF("ADX: looped, start: %x end: %x\n",start_adr,end_adr); DEBUGF("ADX: looped, start: %lx end: %lx\n",start_adr,end_adr);
} else { } else {
DEBUGF("ADX: not looped\n"); DEBUGF("ADX: not looped\n");
} }
/* advance to first frame */ /* advance to first frame */
/*ci->seek_buffer(chanstart);*/ /*ci->seek_buffer(chanstart);*/
DEBUGF("ADX: first frame at %x\n",chanstart); DEBUGF("ADX: first frame at %lx\n",chanstart);
bufoff = chanstart; bufoff = chanstart;
/* setup pcm buffer format */ /* setup pcm buffer format */
@ -205,7 +205,7 @@ next_track:
if (ci->seek_time) { if (ci->seek_time) {
uint32_t newpos; uint32_t newpos;
DEBUGF("ADX: seek to %dms\n",ci->seek_time); DEBUGF("ADX: seek to %ldms\n",ci->seek_time);
endofstream = 0; endofstream = 0;
loop_count = 0; loop_count = 0;
@ -227,7 +227,7 @@ next_track:
/* dance with the devil in the pale moonlight */ /* dance with the devil in the pale moonlight */
if ((bufoff > ci->curpos + (off_t)bufsize - channels*18) || if ((bufoff > ci->curpos + (off_t)bufsize - channels*18) ||
bufoff < ci->curpos) { bufoff < ci->curpos) {
DEBUGF("ADX: requesting another buffer at %x size %x\n", DEBUGF("ADX: requesting another buffer at %lx size %lx\n",
bufoff,ci->filesize-bufoff); bufoff,ci->filesize-bufoff);
ci->seek_buffer(bufoff); ci->seek_buffer(bufoff);
buf = ci->request_buffer(&n, ci->filesize-bufoff); buf = ci->request_buffer(&n, ci->filesize-bufoff);
@ -236,13 +236,13 @@ next_track:
if ((off_t)bufsize < channels*18) { if ((off_t)bufsize < channels*18) {
/* if we can't get a full frame, just request a single /* if we can't get a full frame, just request a single
frame (should be able to fit it in the guard buffer) */ frame (should be able to fit it in the guard buffer) */
DEBUGF("ADX: requesting single frame at %x\n",bufoff); DEBUGF("ADX: requesting single frame at %lx\n",bufoff);
buf = ci->request_buffer(&n, channels*18); buf = ci->request_buffer(&n, channels*18);
bufsize=n; bufsize=n;
DEBUGF("ADX: read size = %x\n",bufsize); DEBUGF("ADX: read size = %x\n",bufsize);
} }
if (!buf) { if (!buf) {
DEBUGF("ADX: couldn't get buffer at %x size %x\n", DEBUGF("ADX: couldn't get buffer at %lx size %lx\n",
bufoff,ci->filesize-bufoff); bufoff,ci->filesize-bufoff);
return CODEC_ERROR; return CODEC_ERROR;
} }

View file

@ -112,7 +112,7 @@ next_track:
sample_size = ((buf[14]<<8)|buf[15]); sample_size = ((buf[14]<<8)|buf[15]);
/* sample_rate (don't use last 4 bytes, only integer fs) */ /* sample_rate (don't use last 4 bytes, only integer fs) */
if (buf[16] != 0x40) { if (buf[16] != 0x40) {
DEBUGF("CODEC_ERROR: weird sampling rate (no @)\n", i); DEBUGF("CODEC_ERROR: weird sampling rate (no @)\n");
i = CODEC_ERROR; i = CODEC_ERROR;
goto done; goto done;
} }

View file

@ -139,7 +139,7 @@ static bool read_chunk_esds(qtmovie_t *qtmovie, size_t chunk_len)
temp=stream_read_int32(qtmovie->stream);//0x15000414 ???? temp=stream_read_int32(qtmovie->stream);//0x15000414 ????
maxBitrate = stream_read_int32(qtmovie->stream); maxBitrate = stream_read_int32(qtmovie->stream);
avgBitrate = stream_read_int32(qtmovie->stream); avgBitrate = stream_read_int32(qtmovie->stream);
DEBUGF("audioType=%d, maxBitrate=%d, avgBitrate=%d\n",audioType,maxBitrate,avgBitrate); DEBUGF("audioType=%d, maxBitrate=%ld, avgBitrate=%ld\n",audioType,maxBitrate,avgBitrate);
/* get and verify DecSpecificInfoTag */ /* get and verify DecSpecificInfoTag */
if (stream_read_uint8(qtmovie->stream) != 0x05) if (stream_read_uint8(qtmovie->stream) != 0x05)
@ -272,7 +272,7 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
j=qtmovie->stream->ci->curpos+sub_chunk_len-8; j=qtmovie->stream->ci->curpos+sub_chunk_len-8;
if (read_chunk_esds(qtmovie,sub_chunk_len)) { if (read_chunk_esds(qtmovie,sub_chunk_len)) {
if (j!=qtmovie->stream->ci->curpos) { if (j!=qtmovie->stream->ci->curpos) {
DEBUGF("curpos=%d, j=%d - Skipping %d bytes\n",qtmovie->stream->ci->curpos,j,j-qtmovie->stream->ci->curpos); DEBUGF("curpos=%ld, j=%d - Skipping %ld bytes\n",qtmovie->stream->ci->curpos,j,j-qtmovie->stream->ci->curpos);
stream_skip(qtmovie->stream,j-qtmovie->stream->ci->curpos); stream_skip(qtmovie->stream,j-qtmovie->stream->ci->curpos);
} }
entry_remaining-=sub_chunk_len; entry_remaining-=sub_chunk_len;
@ -281,7 +281,7 @@ static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
return false; return false;
} }
DEBUGF("entry_remaining=%d\n",entry_remaining); DEBUGF("entry_remaining=%ld\n",entry_remaining);
stream_skip(qtmovie->stream,entry_remaining); stream_skip(qtmovie->stream,entry_remaining);
} else { } else {
@ -379,7 +379,7 @@ static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len)
if (v > 0x0000ffff) if (v > 0x0000ffff)
{ {
DEBUGF("stsz[%d] > 65 kB (%d)\n", i, v); DEBUGF("stsz[%d] > 65 kB (%ld)\n", i, v);
return false; return false;
} }
@ -545,7 +545,7 @@ static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
if ((i = stream_read_uint32(qtmovie->stream)) != 16) if ((i = stream_read_uint32(qtmovie->stream)) != 16)
{ {
DEBUGF("unexpected size in media info: %d\n",i); DEBUGF("unexpected size in media info: %ld\n",i);
stream_skip(qtmovie->stream, size_remaining-4); stream_skip(qtmovie->stream, size_remaining-4);
return true; return true;
} }

View file

@ -759,7 +759,7 @@ static int play_track( void )
if (ci->seek_time) { if (ci->seek_time) {
int curtime = sampleswritten*1000LL/sample_rate; int curtime = sampleswritten*1000LL/sample_rate;
DEBUGF("seek to %d\ncurrently at %d\n",ci->seek_time,curtime); DEBUGF("seek to %ld\ncurrently at %d\n",ci->seek_time,curtime);
if (ci->seek_time < curtime) { if (ci->seek_time < curtime) {
DEBUGF("seek backwards = reset\n"); DEBUGF("seek backwards = reset\n");
ci->seek_complete(); ci->seek_complete();

View file

@ -297,7 +297,7 @@ next_track:
/* this is not a fatal error with some formats, /* this is not a fatal error with some formats,
* we'll see later if we can't decode it */ * we'll see later if we can't decode it */
DEBUGF("CODEC_WARNING: non-PCM WAVE (formattag=0x%x) " DEBUGF("CODEC_WARNING: non-PCM WAVE (formattag=0x%x) "
"doesn't have ext. fmt descr (chunksize=%d<18).\n", "doesn't have ext. fmt descr (chunksize=%ld<18).\n",
formattag, i); formattag, i);
} }
size = buf[24]|(buf[25]<<8); size = buf[24]|(buf[25]<<8);

View file

@ -1611,13 +1611,13 @@ static bool get_mp4_metadata(int fd, struct mp3entry* id3)
} }
id3->bitrate = ((int64_t) id3->filesize * 8) / id3->length; id3->bitrate = ((int64_t) id3->filesize * 8) / id3->length;
DEBUGF("MP4 bitrate %d, frequency %d Hz, length %d ms\n", DEBUGF("MP4 bitrate %d, frequency %ld Hz, length %ld ms\n",
id3->bitrate, id3->frequency, id3->length); id3->bitrate, id3->frequency, id3->length);
} }
else else
{ {
logf("MP4 metadata error"); logf("MP4 metadata error");
DEBUGF("MP4 metadata error. errno %d, length %d, frequency %d, filesize %d\n", DEBUGF("MP4 metadata error. errno %d, length %ld, frequency %ld, filesize %ld\n",
errno, id3->length, id3->frequency, id3->filesize); errno, id3->length, id3->frequency, id3->filesize);
return false; return false;
} }

View file

@ -217,7 +217,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return PLUGIN_OK; return PLUGIN_OK;
} }
DEBUGF("Found %s at offset %d\n", word.word, reverse(word.offset)); DEBUGF("Found %s at offset %ld\n", word.word, reverse(word.offset));
/* now open the description file */ /* now open the description file */
fData = rb->open(DICT_DESC, O_RDONLY); fData = rb->open(DICT_DESC, O_RDONLY);

View file

@ -830,7 +830,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
/* Grab most of the buffer for the compressed video - leave some for /* Grab most of the buffer for the compressed video - leave some for
PCM audio data and some for libmpeg2 malloc use. */ PCM audio data and some for libmpeg2 malloc use. */
buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE); buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE);
DEBUGF("audiosize=%d, buffer_size=%d\n",audiosize,buffer_size); DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
buffer = mpeg2_malloc(buffer_size,-1); buffer = mpeg2_malloc(buffer_size,-1);
if (buffer == NULL) if (buffer == NULL)

View file

@ -154,7 +154,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb = api; rb = api;
DEBUGF("%s - %s\n", parameter, &filename[rb->strlen(filename)-4]); DEBUGF("%s - %s\n", (char *)parameter, &filename[rb->strlen(filename)-4]);
/* Check the extension. We only allow .m3u files. */ /* Check the extension. We only allow .m3u files. */
if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") && if(rb->strcasecmp(&filename[rb->strlen(filename)-4], ".m3u") &&
rb->strcasecmp(&filename[rb->strlen(filename)-5], ".m3u8")) { rb->strcasecmp(&filename[rb->strlen(filename)-5], ".m3u8")) {

View file

@ -219,7 +219,7 @@ static int wpsscrn(void* param)
} }
else if ( global_status.resume_index != -1 ) else if ( global_status.resume_index != -1 )
{ {
DEBUGF("Resume index %X offset %X\n", DEBUGF("Resume index %X offset %lX\n",
global_status.resume_index, global_status.resume_index,
global_status.resume_offset); global_status.resume_offset);
if (playlist_resume() != -1) if (playlist_resume() != -1)
@ -229,7 +229,7 @@ static int wpsscrn(void* param)
ret_val = gui_wps_show(); ret_val = gui_wps_show();
} }
} }
else else
{ {
gui_syncsplash(HZ*2, str(LANG_NOTHING_TO_RESUME)); gui_syncsplash(HZ*2, str(LANG_NOTHING_TO_RESUME));
} }

View file

@ -19,7 +19,7 @@
#ifndef DEBUG_H #ifndef DEBUG_H
#define DEBUG_H #define DEBUG_H
#include <_ansi.h> #include "../include/_ansi.h"
extern void debug_init(void); extern void debug_init(void);
extern void debugf(const char* fmt,...) ATTRIBUTE_PRINTF(1, 2); extern void debugf(const char* fmt,...) ATTRIBUTE_PRINTF(1, 2);

View file

@ -20,7 +20,7 @@
#define LOGF_H #define LOGF_H
#include <config.h> #include <config.h>
#include <stdbool.h> #include <stdbool.h>
#include "_ansi.h" #include "../include/_ansi.h"
#ifdef ROCKBOX_HAS_LOGF #ifdef ROCKBOX_HAS_LOGF

View file

@ -768,7 +768,7 @@ static void setid3v2title(int fd, struct mp3entry *entry)
/* Keep track of the total size */ /* Keep track of the total size */
totframelen = framelen; totframelen = framelen;
DEBUGF("framelen = %d\n", framelen); DEBUGF("framelen = %ld\n", framelen);
if(framelen == 0){ if(framelen == 0){
if (header[0] == 0 && header[1] == 0 && header[2] == 0) if (header[0] == 0 && header[1] == 0 && header[2] == 0)
return; return;
@ -1000,7 +1000,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
bytecount = get_mp3file_info(fd, &info); bytecount = get_mp3file_info(fd, &info);
DEBUGF("Space between ID3V2 tag and first audio frame: 0x%x bytes\n", DEBUGF("Space between ID3V2 tag and first audio frame: 0x%lx bytes\n",
bytecount); bytecount);
if(bytecount < 0) if(bytecount < 0)
@ -1021,7 +1021,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
|| (info.byte_count < expected - diff)) || (info.byte_count < expected - diff))
{ {
DEBUGF("Note: info.byte_count differs from expected value by " DEBUGF("Note: info.byte_count differs from expected value by "
"%d bytes\n", labs((long) (expected - info.byte_count))); "%ld bytes\n", labs((long) (expected - info.byte_count)));
info.byte_count = 0; info.byte_count = 0;
info.frame_count = 0; info.frame_count = 0;
info.file_time = 0; info.file_time = 0;
@ -1085,7 +1085,7 @@ static int getsonglength(int fd, struct mp3entry *entry)
/* Update the seek point for the first playable frame */ /* Update the seek point for the first playable frame */
entry->first_frame_offset = bytecount; entry->first_frame_offset = bytecount;
DEBUGF("First frame is at %x\n", entry->first_frame_offset); DEBUGF("First frame is at %lx\n", entry->first_frame_offset);
return filetime; return filetime;
} }

View file

@ -185,7 +185,7 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header)
info->emphasis = header & EMPHASIS_MASK; info->emphasis = header & EMPHASIS_MASK;
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
DEBUGF( "Header: %08x, Ver %d, lay %d, bitr %d, freq %ld, " DEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, "
"chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n", "chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n",
header, info->version, info->layer+1, info->bitrate, header, info->version, info->layer+1, info->bitrate,
info->frequency, info->channel_mode, info->mode_extension, info->frequency, info->channel_mode, info->mode_extension,
@ -232,7 +232,7 @@ static unsigned long __find_next_frame(int fd, long *offset, long max_offset,
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
if(*offset) if(*offset)
DEBUGF("Warning: skipping %d bytes of garbage\n", *offset); DEBUGF("Warning: skipping %ld bytes of garbage\n", *offset);
#endif #endif
return header; return header;
@ -495,7 +495,8 @@ int get_mp3file_info(int fd, struct mp3info *info)
if(!mp3headerinfo(info, header)) if(!mp3headerinfo(info, header))
return -7; return -7;
DEBUGF("%04x: %04x %04x ", 0, header >> 16, header & 0xffff); DEBUGF("%04x: %04x %04x ", 0, (short)(header >> 16),
(short)(header & 0xffff));
for(i = 4;i < (int)sizeof(frame)-4;i+=2) { for(i = 4;i < (int)sizeof(frame)-4;i+=2) {
if(i % 16 == 0) { if(i % 16 == 0) {
DEBUGF("\n%04x: ", i-4); DEBUGF("\n%04x: ", i-4);
@ -529,8 +530,8 @@ int get_mp3file_info(int fd, struct mp3info *info)
frames_per_entry = bytes2int(0, 0, vbrheader[24], vbrheader[25]); frames_per_entry = bytes2int(0, 0, vbrheader[24], vbrheader[25]);
DEBUGF("Frame size (%dkpbs): %d bytes (0x%x)\n", DEBUGF("Frame size (%dkpbs): %d bytes (0x%x)\n",
info->bitrate, info->frame_size, info->frame_size); info->bitrate, info->frame_size, info->frame_size);
DEBUGF("Frame count: %x\n", info->frame_count); DEBUGF("Frame count: %lx\n", info->frame_count);
DEBUGF("Byte count: %x\n", info->byte_count); DEBUGF("Byte count: %lx\n", info->byte_count);
DEBUGF("Offsets: %d\n", num_offsets); DEBUGF("Offsets: %d\n", num_offsets);
DEBUGF("Frames/entry: %d\n", frames_per_entry); DEBUGF("Frames/entry: %d\n", frames_per_entry);
@ -540,7 +541,7 @@ int get_mp3file_info(int fd, struct mp3info *info)
{ {
j = bytes2int(0, 0, vbrheader[26+i*2], vbrheader[27+i*2]); j = bytes2int(0, 0, vbrheader[26+i*2], vbrheader[27+i*2]);
offset += j; offset += j;
DEBUGF("%03d: %x (%x)\n", i, offset - bytecount, j); DEBUGF("%03d: %lx (%x)\n", i, offset - bytecount, j);
} }
} }
@ -695,7 +696,7 @@ int create_xing_header(int fd, long startpos, long filesize,
toc[i] = filepos * 256 / filesize; toc[i] = filepos * 256 / filesize;
} }
DEBUGF("Pos %d: %d relpos: %d filepos: %x tocentry: %x\n", DEBUGF("Pos %d: %ld relpos: %ld filepos: %lx tocentry: %x\n",
i, pos, pos-last_pos, filepos, toc[i]); i, pos, pos-last_pos, filepos, toc[i]);
last_pos = pos; last_pos = pos;