From cbbaae5684b0fd0be3671e98168941c79ac4d476 Mon Sep 17 00:00:00 2001 From: gevaerts Date: Fri, 14 May 2010 22:57:52 +0000 Subject: [PATCH] Make the sim buildable with mingw again git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26037 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 2 +- apps/plugin.h | 2 +- apps/plugins/frotz/frotzplugin.h | 1 + apps/plugins/lua/rockaux.c | 2 +- firmware/SOURCES | 2 +- firmware/include/string-extra.h | 1 + firmware/include/{string-extra.h => strtok_r.h} | 11 ++++++----- 7 files changed, 12 insertions(+), 9 deletions(-) copy firmware/include/{string-extra.h => strtok_r.h} (85%) diff --git a/apps/plugin.c b/apps/plugin.c index 1ab15f82f..b60e2d676 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -598,7 +598,7 @@ static const struct plugin_api rockbox_api = { #endif /* misc */ -#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) +#if !defined(SIMULATOR) &errno, #endif srand, diff --git a/apps/plugin.h b/apps/plugin.h index 584c146b9..5aaa6380b 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -737,7 +737,7 @@ struct plugin_api { #endif /* misc */ -#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) +#if !defined(SIMULATOR) int* __errno; #endif void (*srand)(unsigned int seed); diff --git a/apps/plugins/frotz/frotzplugin.h b/apps/plugins/frotz/frotzplugin.h index 1a52bdb91..f975fc8c2 100644 --- a/apps/plugins/frotz/frotzplugin.h +++ b/apps/plugins/frotz/frotzplugin.h @@ -27,6 +27,7 @@ * pretend stdio.h is implemented. references to FILE * still have to be * changed to int, and references to NULL into -1, but there are less of those */ +#undef ferror #define fread(ptr, size, nmemb, stream) rb->read(stream, ptr, size*nmemb) #define fwrite(ptr, size, nmemb, stream) rb->write(stream, ptr, size*nmemb) #define fclose(stream) rb->close(stream) diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c index ea95f232a..1f832d4cc 100644 --- a/apps/plugins/lua/rockaux.c +++ b/apps/plugins/lua/rockaux.c @@ -24,7 +24,7 @@ #define _ROCKCONF_H_ /* Protect against unwanted include */ #include "lua.h" -#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) +#if !defined(SIMULATOR) int errno = 0; #endif diff --git a/firmware/SOURCES b/firmware/SOURCES index 16dc9ca60..68074dbbe 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -24,6 +24,7 @@ debug.c /* Standard library */ #if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__) libc/errno.c +libc/strtok.c /* alsa on linux requires a more advanced sprintf, i.e. not ours */ libc/sprintf.c #endif /* !SIMULATOR || __MINGW32__ || __CYGWIN__ */ @@ -40,7 +41,6 @@ libc/strcmp.c libc/strcpy.c libc/strncmp.c libc/strrchr.c -libc/strtok.c libc/strstr.c libc/mktime.c #endif /* !defined(SIMULATOR)*/ diff --git a/firmware/include/string-extra.h b/firmware/include/string-extra.h index 5fe5ab811..16dd2fdcc 100644 --- a/firmware/include/string-extra.h +++ b/firmware/include/string-extra.h @@ -25,3 +25,4 @@ #include "strlcat.h" #include "strcasecmp.h" #include "strcasestr.h" +#include "strtok_r.h" diff --git a/firmware/include/string-extra.h b/firmware/include/strtok_r.h similarity index 85% copy from firmware/include/string-extra.h copy to firmware/include/strtok_r.h index 5fe5ab811..f4727630f 100644 --- a/firmware/include/string-extra.h +++ b/firmware/include/strtok_r.h @@ -20,8 +20,9 @@ ****************************************************************************/ -#include -#include "strlcpy.h" -#include "strlcat.h" -#include "strcasecmp.h" -#include "strcasestr.h" +#ifndef __STRTOK_R_H__ +#define __STRTOK_R_H__ +#if defined(__MINGW32__) || defined(__CYGWIN__) +char *strtok_r(char *, const char *, char **); +#endif +#endif -- 2.11.4.GIT