diff options
Diffstat (limited to 'apps/plugins/mpegplayer/alloc.c')
-rw-r--r-- | apps/plugins/mpegplayer/alloc.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/alloc.c b/apps/plugins/mpegplayer/alloc.c index 0a3568ae5b..d406947a58 100644 --- a/apps/plugins/mpegplayer/alloc.c +++ b/apps/plugins/mpegplayer/alloc.c | |||
@@ -46,6 +46,7 @@ void * mpeg2_malloc (unsigned size, mpeg2_alloc_t reason) | |||
46 | 46 | ||
47 | (void)reason; | 47 | (void)reason; |
48 | 48 | ||
49 | DEBUGF("mpeg2_malloc(%d,%d)\n",size,reason); | ||
49 | if (mem_ptr + (long)size > bufsize) { | 50 | if (mem_ptr + (long)size > bufsize) { |
50 | DEBUGF("OUT OF MEMORY\n"); | 51 | DEBUGF("OUT OF MEMORY\n"); |
51 | return NULL; | 52 | return NULL; |
@@ -74,3 +75,45 @@ void *memcpy(void *dest, const void *src, size_t n) { | |||
74 | 75 | ||
75 | return dest; | 76 | return dest; |
76 | } | 77 | } |
78 | |||
79 | |||
80 | /* The following are expected by libmad */ | ||
81 | void* codec_malloc(size_t size) | ||
82 | { | ||
83 | return mpeg2_malloc(size,-3); | ||
84 | } | ||
85 | |||
86 | void* codec_calloc(size_t nmemb, size_t size) | ||
87 | { | ||
88 | void* ptr; | ||
89 | |||
90 | ptr = mpeg2_malloc(nmemb*size,-3); | ||
91 | |||
92 | if (ptr) | ||
93 | rb->memset(ptr,0,size); | ||
94 | |||
95 | return ptr; | ||
96 | } | ||
97 | |||
98 | void codec_free(void* ptr) { | ||
99 | (void)ptr; | ||
100 | } | ||
101 | |||
102 | void *memmove(void *dest, const void *src, size_t n) | ||
103 | { | ||
104 | return rb->memmove(dest,src,n); | ||
105 | } | ||
106 | |||
107 | void *memset(void *s, int c, size_t n) | ||
108 | { | ||
109 | return rb->memset(s,c,n); | ||
110 | } | ||
111 | |||
112 | void abort(void) | ||
113 | { | ||
114 | rb->lcd_putsxy(0,0,"ABORT!"); | ||
115 | rb->lcd_update(); | ||
116 | |||
117 | while (1); | ||
118 | /* Let's hope this is never called */ | ||
119 | } | ||