diff options
| author | Brandon Low <lostlogic@rockbox.org> | 2007-10-25 18:58:44 +0000 |
|---|---|---|
| committer | Brandon Low <lostlogic@rockbox.org> | 2007-10-25 18:58:44 +0000 |
| commit | 4bde8982f146f9866b4b78f7be5945c82c19d403 (patch) | |
| tree | 6fc56148834bfa20e9f8064b47e75f6c64ac7014 /apps/codecs/sid.c | |
| parent | 35f23267bfc97d070284a03e4adaa2c6b7bb6852 (diff) | |
| download | rockbox-4bde8982f146f9866b4b78f7be5945c82c19d403.zip rockbox-4bde8982f146f9866b4b78f7be5945c82c19d403.tar.gz rockbox-4bde8982f146f9866b4b78f7be5945c82c19d403.tar.bz2 rockbox-4bde8982f146f9866b4b78f7be5945c82c19d403.tar.xz | |
Fix a fixme in flac and make the usage of the read_filebuf codec api more consistent with its actual contract.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15303 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/sid.c')
| -rw-r--r-- | apps/codecs/sid.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/codecs/sid.c b/apps/codecs/sid.c index 1c98714..c6d3c43 100644 --- a/apps/codecs/sid.c +++ b/apps/codecs/sid.c @@ -1204,8 +1204,6 @@ unsigned short LoadSIDFromMemory(void *pSidData, unsigned short *load_addr, enum codec_status codec_main(void) { - size_t n, bytesfree; - unsigned char *p; unsigned int filesize; unsigned short load_addr, init_addr, play_addr; @@ -1229,20 +1227,16 @@ next_track: codec_set_replaygain(ci->id3); - /* Load SID file */ - p = sidfile; - bytesfree=sizeof(sidfile); - while ((n = ci->read_filebuf(p, bytesfree)) > 0) { - p += n; - bytesfree -= n; - } - filesize = p-sidfile; + /* Load SID file the read_filebuf callback will return the full requested + * size if at all possible, so there is no need to loop */ + filesize = ci->read_filebuf(sidfile, sizeof(sidfile)); if (filesize == 0) return CODEC_ERROR; c64Init(44100); - LoadSIDFromMemory(sidfile, &load_addr, &init_addr, &play_addr, &subSongsMax, &subSong, &song_speed, filesize); + LoadSIDFromMemory(sidfile, &load_addr, &init_addr, &play_addr, + &subSongsMax, &subSong, &song_speed, filesize); sidPoke(24, 15); /* Turn on full volume */ cpuJSR(init_addr, subSong); /* Start the song initialize */ |