Update the discussion of themeing in the manual, and put a note in the wps tags appen...
[kugel-rb.git] / apps / plugins / zxbox / helpers.c
blobdb57ea8e02f9bf0b1165e60e4444625369fe7ab7
1 #include "zxconfig.h"
2 #include "helpers.h"
4 int my_getc(int fd){
5 unsigned char c;
6 if ( rb->read(fd, &c, 1) )
7 return c;
8 else
9 return EOF;
12 off_t my_ftell(int fd){
13 return rb->lseek(fd, 0, SEEK_CUR);
16 int my_putc(char c , int fd){
17 return rb->write(fd,&c,1);
20 void *my_malloc(size_t size)
22 static char *offset = NULL;
23 static size_t totalSize = 0;
24 char *ret;
26 int remainder = size % 4;
28 size = size + 4-remainder;
30 if (offset == NULL)
32 offset = rb->plugin_get_audio_buffer(&totalSize);
35 if (size + 4 > totalSize)
37 /* We've made our point. */
38 return NULL;
41 ret = offset + 4;
42 *((unsigned int *)offset) = size;
44 offset += size + 4;
45 totalSize -= size + 4;
46 return ret;