1
0
Fork 0
forked from len0rd/rockbox

Fix sims: sim_codec_load_ram() needed an update

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15411 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-11-02 17:43:37 +00:00
parent dd12c6c13e
commit c70671b652

View file

@ -650,13 +650,11 @@ int sim_fsync(int fd)
#define TEMP_CODEC_FILE "archos/_temp_codec%d.dll" #define TEMP_CODEC_FILE "archos/_temp_codec%d.dll"
void *sim_codec_load_ram(char* codecptr, int size, void *sim_codec_load_ram(char* codecptr, int size, void **pd)
void* ptr2, int bufwrap, void **pd)
{ {
void *hdr; void *hdr;
char path[MAX_PATH]; char path[MAX_PATH];
int fd; int fd;
int copy_n;
int codec_count; int codec_count;
#ifdef WIN32 #ifdef WIN32
char buf[MAX_PATH]; char buf[MAX_PATH];
@ -682,21 +680,10 @@ void *sim_codec_load_ram(char* codecptr, int size,
return NULL; return NULL;
} }
if (bufwrap == 0) if (write(fd, codecptr, size) != size) {
bufwrap = size;
copy_n = bufwrap < size ? bufwrap : size;
if (write(fd, codecptr, copy_n) != copy_n) {
DEBUGF("write failed"); DEBUGF("write failed");
return NULL; return NULL;
} }
size -= copy_n;
if (size > 0) {
if (write(fd, ptr2, size) != size) {
DEBUGF("write failed [2]");
return NULL;
}
}
close(fd); close(fd);
/* Now load the library. */ /* Now load the library. */