summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pdbox
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-05-26 21:07:40 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-05-26 21:07:40 +0000
commit3ca0614de9a3c4dc633e4c9f9ba459d89e44dd92 (patch)
tree167e53fa944537c46c61fbe1aa35e3b387f19921 /apps/plugins/pdbox
parent84ea60781319324521d4b5e85a13b0a9e964f7b8 (diff)
downloadrockbox-3ca0614de9a3c4dc633e4c9f9ba459d89e44dd92.tar.gz
rockbox-3ca0614de9a3c4dc633e4c9f9ba459d89e44dd92.tar.bz2
rockbox-3ca0614de9a3c4dc633e4c9f9ba459d89e44dd92.zip
Next round of pdbox patches from Wincent Balin: adapt dbestfit to rockbox, ifdef some printfs, and more
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21095 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox')
-rw-r--r--apps/plugins/pdbox/SOURCES2
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/bmalloc.c2
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/bmalloc.h2
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/bysize.c4
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/dmalloc.c24
-rw-r--r--apps/plugins/pdbox/dbestfit-3.3/dmalloc.h5
-rw-r--r--apps/plugins/pdbox/pdbox.c4
-rw-r--r--apps/plugins/pdbox/pdbox.h2
8 files changed, 35 insertions, 10 deletions
diff --git a/apps/plugins/pdbox/SOURCES b/apps/plugins/pdbox/SOURCES
index 0eb24e1311..70a50d1941 100644
--- a/apps/plugins/pdbox/SOURCES
+++ b/apps/plugins/pdbox/SOURCES
@@ -1,11 +1,9 @@
pdbox.c
pdbox-net.c
-/*
dbestfit-3.3/bmalloc.c
dbestfit-3.3/bysize.c
dbestfit-3.3/dmalloc.c
-*/
/*
PDa/src/g_canvas.c
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c
index 35cafb8f96..f0ac7312a4 100644
--- a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c
+++ b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.c
@@ -236,6 +236,7 @@ static void bmalloc_failed(size_t size)
#define bmalloc_failed(x)
#endif
+#ifdef DEBUG
void print_lists()
{
struct BlockInfo *block = blockHead;
@@ -252,6 +253,7 @@ void print_lists()
#endif
print_sizes();
}
+#endif /* DEBUG */
void *bmalloc(size_t size)
{
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h
index 550aa5a010..ab7215af0a 100644
--- a/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h
+++ b/apps/plugins/pdbox/dbestfit-3.3/bmalloc.h
@@ -1,5 +1,5 @@
int add_pool(void *start, size_t size);
-void print_lists();
+void print_lists(void);
void *bmalloc(size_t size);
void bfree(void *ptr);
diff --git a/apps/plugins/pdbox/dbestfit-3.3/bysize.c b/apps/plugins/pdbox/dbestfit-3.3/bysize.c
index 85dc327491..8728e247b9 100644
--- a/apps/plugins/pdbox/dbestfit-3.3/bysize.c
+++ b/apps/plugins/pdbox/dbestfit-3.3/bysize.c
@@ -366,6 +366,7 @@ Tree *removebyaddr(Tree *t, Tree *remove)
return x;
}
+#ifdef DEBUG
int printtree(Tree * t, int d, char output)
{
int distance=0;
@@ -395,6 +396,7 @@ int printtree(Tree * t, int d, char output)
distance += printtree(t->smaller, d+1, output);
return distance;
}
+#endif /* DEBUG */
/* Here follow the look-alike interface so that the tree-function names are
the same as the list-ones to enable easy interchange */
@@ -416,9 +418,11 @@ char *obtainbysize( size_t size)
return (char *)receive;
}
+#ifdef DEBUG
void print_sizes(void)
{
printtree(chunkHead, 0, 1);
}
+#endif /* DEBUG */
#endif
diff --git a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c
index 6ce38cced0..bfc6bdb356 100644
--- a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c
+++ b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c
@@ -23,8 +23,13 @@
*
*****************************************************************************/
+#ifdef ROCKBOX
+#include "plugin.h"
+#define memset rb->memset
+#else /* ROCKBOX */
#include <stdio.h>
#include <string.h>
+#endif /* ROCKBOX */
#ifdef DEBUG
#include <stdarg.h>
@@ -156,15 +161,23 @@ struct MemInfo {
happy with us.
*/
-#if BIGBLOCKS==4060 /* previously */
+#if defined(BIGBLOCKS) && BIGBLOCKS==4060 /* previously */
+#ifdef ROCKBOX
+unsigned
+#endif /* ROCKBOX */
short qinfo[]= { 20, 28, 52, 116, 312, 580, 812, 2028 };
#else
+#ifdef ROCKBOX
+unsigned
+#endif /* ROCKBOX */
short qinfo[]= { 20, 28, 52, 116, 312, 580, 1016, 2032};
/* 52 and 312 only make use of 4056 bytes, but without them there are too
wide gaps */
#endif
+#ifndef ROCKBOX
#define MIN(x,y) ((x)<(y)?(x):(y))
+#endif /* ROCKBOX */
/* ---------------------------------------------------------------------- */
/* Globals */
@@ -335,6 +348,9 @@ static void FragBlock(char *memp, int size)
**************************************************************************/
static void initialize(void)
{
+#ifdef ROCKBOX
+ unsigned
+#endif /* ROCKBOX */
int i;
/* Setup the nmax and fragsize fields of the top structs */
for(i=0; i< sizeof(qinfo)/sizeof(qinfo[0]); i++) {
@@ -421,7 +437,11 @@ void *dmalloc(size_t size)
struct MemTop *memtop=NULL; /* SAFE */
/* Determine which queue to use */
+#ifdef ROCKBOX
+ unsigned
+#endif /* ROCKBOX */
int queue;
+
for(queue=0; size > qinfo[queue]; queue++)
;
do {
@@ -622,7 +642,7 @@ void *drealloc(char *ptr, size_t size)
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
void *mem=NULL; /* SAFE */
- size_t prevsize;
+ size_t prevsize = 0;
/* NOTE that this is only valid if BLOCK_BIT isn't set: */
struct MemBlock *block;
diff --git a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h
index 9921e3b94a..6a0c993815 100644
--- a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h
+++ b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.h
@@ -5,3 +5,8 @@ void *drealloc(void *, size_t);
#define malloc(x) dmalloc(x)
#define free(x) dfree(x)
#define realloc(x,y) drealloc(x,y)
+
+#ifdef ROCKBOX
+void *dcalloc(size_t, size_t);
+#define calloc(x,y) dcalloc(x,y)
+#endif
diff --git a/apps/plugins/pdbox/pdbox.c b/apps/plugins/pdbox/pdbox.c
index c3fb4499e1..d6e25ca3fa 100644
--- a/apps/plugins/pdbox/pdbox.c
+++ b/apps/plugins/pdbox/pdbox.c
@@ -105,7 +105,6 @@ enum plugin_status plugin_start(const void* parameter)
/* Get the file name. */
const char* filename = (const char*) parameter;
-#if 0
/* Allocate memory; check it's size; add to the pool. */
mem_pool = rb->plugin_get_audio_buffer(&mem_size);
if(mem_size < MIN_MEM_SIZE)
@@ -114,9 +113,8 @@ enum plugin_status plugin_start(const void* parameter)
return PLUGIN_ERROR;
}
add_pool(mem_pool, mem_size);
-#endif
- /* Initialze net. */
+ /* Initialize net. */
net_init();
/* Start threads. */
diff --git a/apps/plugins/pdbox/pdbox.h b/apps/plugins/pdbox/pdbox.h
index eda3245258..640bc43aca 100644
--- a/apps/plugins/pdbox/pdbox.h
+++ b/apps/plugins/pdbox/pdbox.h
@@ -22,11 +22,9 @@
#ifndef PDBOX_H
#define PDBOX_H
-#if 0
/* Use dbestfit. */
#include "bmalloc.h"
#include "dmalloc.h"
-#endif
/* Minimal memory size. */
#define MIN_MEM_SIZE (4 * 1024 * 1024)