From f5ec0fa592f9e23625de38673d22c4c7ee0fdfad Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sun, 18 Sep 2005 12:44:27 +0000 Subject: iriver: fix problem with playing some long vorbis files (e.g., this week in tech, #21); the decoder would run out of memory and freeze rockbox. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7526 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/codec.h | 9 +++++++-- apps/codecs/lib/codeclib.h | 6 +++++- apps/codecs/lib/xxx2wav.c | 2 ++ apps/codecs/lib/xxx2wav.h | 6 +++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/codecs/codec.h b/apps/codecs/codec.h index 0da653cf04..f954d1bc4d 100644 --- a/apps/codecs/codec.h +++ b/apps/codecs/codec.h @@ -29,16 +29,21 @@ * be implemented elsewhere */ #define malloc(x) codec_malloc(x) #define calloc(x,y) codec_calloc(x,y) -#define alloca(x) codec_alloca(x) #define realloc(x,y) codec_realloc(x,y) #define free(x) codec_free(x) void* codec_malloc(size_t size); void* codec_calloc(size_t nmemb, size_t size); -void* codec_alloca(size_t size); void* codec_realloc(void* ptr, size_t size); void codec_free(void* ptr); +#if !defined(SIMULATOR) +#define alloca __builtin_alloca +#else +#define alloca(x) codec_alloca(x) +void* codec_alloca(size_t size); +#endif + #define abs(x) ((x)>0?(x):-(x)) #define labs(x) abs(x) diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h index 3fc03bd122..d6bbfd3888 100644 --- a/apps/codecs/lib/codeclib.h +++ b/apps/codecs/lib/codeclib.h @@ -28,9 +28,13 @@ extern unsigned char* mallocbuf; /* 512K from the start of MP3 buffer */ void* codec_malloc(size_t size); void* codec_calloc(size_t nmemb, size_t size); -void* codec_alloca(size_t size); void* codec_realloc(void* ptr, size_t size); void codec_free(void* ptr); + +#if defined(SIMULATOR) +void* codec_alloca(size_t size); +#endif + void *memcpy(void *dest, const void *src, size_t n); void *memset(void *s, int c, size_t n); int memcmp(const void *s1, const void *s2, size_t n); diff --git a/apps/codecs/lib/xxx2wav.c b/apps/codecs/lib/xxx2wav.c index cd09d32450..776b29acfd 100644 --- a/apps/codecs/lib/xxx2wav.c +++ b/apps/codecs/lib/xxx2wav.c @@ -56,12 +56,14 @@ void* codec_calloc(size_t nmemb, size_t size) return(x); } +#if defined(SIMULATOR) void* codec_alloca(size_t size) { void* x; x = codec_malloc(size); return(x); } +#endif void codec_free(void* ptr) { (void)ptr; diff --git a/apps/codecs/lib/xxx2wav.h b/apps/codecs/lib/xxx2wav.h index 2c9a73729c..e1e76078f2 100644 --- a/apps/codecs/lib/xxx2wav.h +++ b/apps/codecs/lib/xxx2wav.h @@ -46,9 +46,13 @@ extern unsigned char* filebuf; // The rest of the MP3 buffer void* codec_malloc(size_t size); void* codec_calloc(size_t nmemb, size_t size); -void* codec_alloca(size_t size); void* codec_realloc(void* ptr, size_t size); void codec_free(void* ptr); + +#if defined(SIMULATOR) +void* codec_alloca(size_t size); +#endif + size_t strlen(const char *s); char *strcpy(char *dest, const char *src); char *strcat(char *dest, const char *src); -- cgit v1.2.3