diff options
author | Cameron Cawley | 2019-03-31 19:07:40 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-04-15 08:06:39 +0300 |
commit | bcef809e612177c2bcb7ca3f8682ea96d38c4cdc (patch) | |
tree | 14bc067ff02ef2e1aabd19360db67e22deb8704f /backends/platform/wince/missing | |
parent | 82f4ee86a9824a9cdfd5060d7bab23be381a46df (diff) | |
download | scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.gz scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.bz2 scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.zip |
WINCE: Fix compilation
Diffstat (limited to 'backends/platform/wince/missing')
-rw-r--r-- | backends/platform/wince/missing/assert.h | 8 | ||||
-rw-r--r-- | backends/platform/wince/missing/errno.h | 3 | ||||
-rw-r--r-- | backends/platform/wince/missing/fopen.h (renamed from backends/platform/wince/missing/io.h) | 4 | ||||
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 28 | ||||
-rw-r--r-- | backends/platform/wince/missing/time.h | 4 |
5 files changed, 17 insertions, 30 deletions
diff --git a/backends/platform/wince/missing/assert.h b/backends/platform/wince/missing/assert.h deleted file mode 100644 index e9c871da60..0000000000 --- a/backends/platform/wince/missing/assert.h +++ /dev/null @@ -1,8 +0,0 @@ -/* Header is not present in Windows CE SDK */ - -// defined in common/util.h -void CDECL _declspec(noreturn) error(const char *s, ...); - -#define assert(e) ((e) ? 0 : (::error("Assertion failed %s (%s, %d)", #e, __FILE__, __LINE__))) - -#define abort() ::error("Abort (%s, %d)", __FILE__, __LINE__) diff --git a/backends/platform/wince/missing/errno.h b/backends/platform/wince/missing/errno.h index 7ee9f5e5ba..1d13c5d7d8 100644 --- a/backends/platform/wince/missing/errno.h +++ b/backends/platform/wince/missing/errno.h @@ -1 +1,4 @@ /* Header is not present in Windows CE SDK */ + +extern int errno; +#define EINTR 4 diff --git a/backends/platform/wince/missing/io.h b/backends/platform/wince/missing/fopen.h index b2cb2abd8e..b4f7d03129 100644 --- a/backends/platform/wince/missing/io.h +++ b/backends/platform/wince/missing/fopen.h @@ -1,11 +1,11 @@ /* Header is not present in Windows CE SDK */ +extern "C" { /* This stuff will live here until port configuration file is in place */ -#define strdup _strdup - #ifndef _FILE_DEFINED typedef void FILE; #define _FILE_DEFINED #endif FILE *wce_fopen(const char *fname, const char *fmode); #define fopen wce_fopen +} diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index 0355f35a69..ab193a198b 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -36,8 +36,6 @@ #include <stdio.h> #include "common/debug.h" -char *strdup(const char *strSource); - #ifdef __GNUC__ #define EXT_C extern "C" #else @@ -46,6 +44,10 @@ char *strdup(const char *strSource); // common missing functions required by both gcc and evc +#ifndef USE_ZLIB +int errno = 0; +#endif + void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { // Perform binary search @@ -68,7 +70,7 @@ void *bsearch(const void *key, const void *base, size_t nmemb, static char cwd[MAX_PATH + 1] = ""; -EXT_C char *getcwd(char *buffer, int maxlen) { +EXT_C char *wce_getcwd(char *buffer, int maxlen) { TCHAR fileUnc[MAX_PATH + 1]; char *plast; @@ -91,7 +93,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) { #undef GetCurrentDirectory #endif EXT_C void GetCurrentDirectory(int len, char *buf) { - getcwd(buf, len); + wce_getcwd(buf, len); } /* @@ -106,7 +108,7 @@ EXT_C FILE *wce_fopen(const char *fname, const char *fmode) { if (!fname || fname[0] == '\0') return NULL; if (fname[0] != '\\' && fname[0] != '/') { - getcwd(fullname, MAX_PATH); + wce_getcwd(fullname, MAX_PATH); strcat(fullname, "\\"); strcat(fullname, fname); return fopen(fullname, fmode); @@ -128,7 +130,7 @@ int _access(const char *path, int mode) { char fullname[MAX_PATH + 1]; if (path[0] != '\\' && path[0] != '/') { - getcwd(fullname, MAX_PATH); + wce_getcwd(fullname, MAX_PATH); strcat(fullname, "\\"); strcat(fullname, path); MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR)); @@ -179,20 +181,8 @@ int _access(const char *path, int mode) { return -1; } -// evc only functions follow -#ifndef __GNUC__ - -char *strdup(const char *strSource) { - char *buffer; - size_z len = strlen(strSource) + 1; - buffer = (char *)malloc(len); - if (buffer) - memcpy(buffer, strSource, len); - return buffer; -} - // gcc build only functions follow -#else // defined(__GNUC__) +#if defined(__GNUC__) #ifndef __MINGW32CE__ int islower(int c) { diff --git a/backends/platform/wince/missing/time.h b/backends/platform/wince/missing/time.h index a0ba6c246e..156d2f6a36 100644 --- a/backends/platform/wince/missing/time.h +++ b/backends/platform/wince/missing/time.h @@ -5,7 +5,9 @@ #include <stdlib.h> -#ifndef __MINGW32CE__ +#ifdef __MINGW32CE__ +#include_next <time.h> +#else struct tm { short tm_year; short tm_mon; |