1
0
Fork 0
forked from len0rd/rockbox

Get malloc() and friends out of the way for the cygwin linker (and maybe others), to make plugins work properly in the simulator.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6086 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-02-28 20:55:31 +00:00
parent c080f7e19e
commit b363d65625
43 changed files with 95 additions and 49 deletions

View file

@ -18,8 +18,8 @@
/* We're 'LSb' endian; if we write a word but read individual bits,
then we'll read the lsb first */
#include "config-tremor.h"
#include <string.h>
#include <stdlib.h>
#include "ogg.h"
static unsigned long mask[]=

View file

@ -15,8 +15,8 @@
********************************************************************/
#include "config-tremor.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ogg.h"
#include "ivorbiscodec.h"

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include <math.h>
#include "ogg.h"

View file

@ -1,3 +1,5 @@
#include "../codec.h"
#define BIG_ENDIAN 1
#define LITTLE_ENDIAN 0
#define _LOW_ACCURACY_

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include <math.h>
#include "ogg.h"

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include <math.h>
#include "ogg.h"

View file

@ -19,7 +19,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include "ogg.h"
#include "misc.h"

View file

@ -18,7 +18,7 @@
/* general handling of the header and the vorbis_info structure (and
substructures) */
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include <ctype.h>
#include "ogg.h"

View file

@ -19,8 +19,8 @@
stdout using vorbisfile. Using vorbisfile is much simpler than
dealing with libvorbis. */
#include "config-tremor.h"
#include <stdio.h>
#include <stdlib.h>
#include <vorbis/ivorbiscodec.h>
#include <vorbis/ivorbisfile.h>

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <stdio.h>
#include <string.h>
#include <math.h>

View file

@ -26,7 +26,6 @@
/* Some prototypes that were not defined elsewhere */
#include <stdlib.h>
void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
void _vorbis_block_ripcord(vorbis_block *vb);
extern int _ilog(unsigned int v);

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <string.h>
#include <math.h>
#include "ogg.h"

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <math.h>
#include <string.h>
#include "ogg.h"

View file

@ -16,7 +16,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>

View file

@ -15,7 +15,7 @@
********************************************************************/
#include <stdlib.h>
#include "config-tremor.h"
#include <math.h>
#include "os.h"
#include "misc.h"

43
apps/codecs/codec.h Normal file
View file

@ -0,0 +1,43 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 Jens Arnold
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
/* Global declarations to be used in rockbox software codecs */
#include <sys/types.h>
/* Get these functions 'out of the way' of the standard functions. Not doing
* so confuses the cygwin linker, and maybe others. These functions need to
* 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);
#define abs(x) ((x)>0?(x):-(x))
#define labs(x) abs(x)
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));

View file

@ -29,7 +29,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for memcpy(), memset() */
#include "private/bitbuffer.h"
#include "private/bitmath.h"

View file

@ -30,7 +30,7 @@
*/
#include "private/cpu.h"
#include <stdlib.h>
#include "global.h"
#include <stdio.h>
#ifdef HAVE_CONFIG_H

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for strcmp() */
#include <sys/stat.h> /* for stat() */
#if defined _MSC_VER || defined __MINGW32__

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for strlen(), strcpy() */
#include "FLAC/assert.h"
#include "protected/file_encoder.h"

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for qsort() */
#include "global.h" /* for qsort() */
#include "FLAC/assert.h"
#include "FLAC/format.h"
#include "private/format.h"

View file

@ -33,7 +33,7 @@
#define FLAC__CALLBACK_H
#include "ordinals.h"
#include <stdlib.h> /* for size_t */
#include <sys/types.h> /* for size_t */
/** \file include/FLAC/callback.h
*

View file

@ -0,0 +1,3 @@
/* global include file for libFLAC/rockbox */
#include "../../codec.h"

View file

@ -36,7 +36,7 @@
#include <config.h>
#endif
#include <stdlib.h> /* for size_t */
#include <sys/types.h> /* for size_t */
#include "private/float.h"
#include "FLAC/ordinals.h" /* for FLAC__bool */

View file

@ -23,7 +23,7 @@
* Still in the public domain.
*/
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for memcpy() */
#include "private/md5.h"

View file

@ -29,6 +29,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "global.h" /* for malloc() */
#include "private/memory.h"
#include "FLAC/assert.h"

View file

@ -31,7 +31,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "global.h"
#include <string.h>
#if defined _MSC_VER || defined __MINGW32__

View file

@ -29,7 +29,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include "global.h"
#include <string.h>
#include "private/metadata.h"

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for calloc() */
#include "global.h" /* for calloc() */
#include <string.h> /* for memcpy()/memcmp() */
#include "FLAC/assert.h"
#include "protected/seekable_stream_decoder.h"

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for calloc() */
#include "global.h" /* for calloc() */
#include <string.h> /* for memcpy() */
#include "FLAC/assert.h"
#include "protected/seekable_stream_encoder.h"

View file

@ -30,7 +30,7 @@
*/
#include <stdio.h>
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for memset/memcpy() */
#include "FLAC/assert.h"
#include "protected/stream_decoder.h"

View file

@ -31,7 +31,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h> /* for malloc() */
#include "global.h" /* for malloc() */
#include <string.h> /* for memcpy() */
#include "FLAC/assert.h"
#include "FLAC/stream_decoder.h"

View file

@ -1,3 +1,5 @@
#include "../codec.h"
/* a52dec profiling */
/* #undef A52DEC_GPROF */

View file

@ -23,7 +23,6 @@
#include "config-a52.h"
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>

View file

@ -41,8 +41,6 @@
# include <fcntl.h>
# endif
# include <stdlib.h>
# ifdef HAVE_ERRNO_H
# include <errno.h>
# endif

View file

@ -25,8 +25,6 @@
# include "global.h"
# include <stdlib.h>
# include "bit.h"
# include "stream.h"
# include "frame.h"

View file

@ -19,6 +19,8 @@
* $Id$
*/
#include "../codec.h"
# ifndef LIBMAD_GLOBAL_H
# define LIBMAD_GLOBAL_H

View file

@ -25,7 +25,6 @@
# include "global.h"
# include <stdlib.h>
# include <string.h>
# ifdef HAVE_ASSERT_H

View file

@ -25,8 +25,6 @@
# include "global.h"
# include <stdlib.h>
# include "bit.h"
# include "stream.h"

View file

@ -17,7 +17,6 @@
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define LOSSY_MUTE

View file

@ -8,6 +8,8 @@
// wavpack.h
#include "../codec.h"
#include <inttypes.h>
// This header file contains all the definitions required by WavPack.

View file

@ -33,7 +33,7 @@ unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
unsigned char* mallocbuf; // 512K from the start of MP3 buffer
unsigned char* filebuf; // The rest of the MP3 buffer
void* malloc(size_t size) {
void* codec_malloc(size_t size) {
void* x;
char s[32];
@ -46,27 +46,27 @@ void* malloc(size_t size) {
return(x);
}
void* calloc(size_t nmemb, size_t size) {
void* codec_calloc(size_t nmemb, size_t size) {
void* x;
x=malloc(nmemb*size);
x = codec_malloc(nmemb*size);
local_rb->memset(x,0,nmemb*size);
return(x);
}
void* alloca(size_t size) {
void* codec_alloca(size_t size) {
void* x;
x=malloc(size);
x = codec_malloc(size);
return(x);
}
void free(void* ptr) {
void codec_free(void* ptr) {
(void)ptr;
}
void* realloc(void* ptr, size_t size) {
void* codec_realloc(void* ptr, size_t size) {
void* x;
(void)ptr;
x=malloc(size);
x = codec_malloc(size);
return(x);
}

View file

@ -42,10 +42,11 @@ extern unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer
extern unsigned char* filebuf; // The rest of the MP3 buffer
void* malloc(size_t size);
void* calloc(size_t nmemb, size_t size);
void free(void* ptr);
void* realloc(void* ptr, size_t size);
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);
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);