diff options
author | Max Horn | 2010-11-05 10:31:36 +0000 |
---|---|---|
committer | Max Horn | 2010-11-05 10:31:36 +0000 |
commit | daf3fb0df7996b95a376080d8112b09a97b52266 (patch) | |
tree | 5bb991dc83b0b01c4a21f3cadab8252d27184948 /backends/platform/wince | |
parent | 7c8470255c5e1b53b7462cdb09d8df61c554849e (diff) | |
download | scummvm-rg350-daf3fb0df7996b95a376080d8112b09a97b52266.tar.gz scummvm-rg350-daf3fb0df7996b95a376080d8112b09a97b52266.tar.bz2 scummvm-rg350-daf3fb0df7996b95a376080d8112b09a97b52266.zip |
WINCE: Remove tons of obsolete workaround code for 'missing' headers and funcs
svn-id: r54089
Diffstat (limited to 'backends/platform/wince')
-rw-r--r-- | backends/platform/wince/missing/conio.h | 2 | ||||
-rw-r--r-- | backends/platform/wince/missing/dir.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/missing/direct.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/missing/dirent.h | 52 | ||||
-rw-r--r-- | backends/platform/wince/missing/fcntl.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/missing/gcc/assert.h | 9 | ||||
-rw-r--r-- | backends/platform/wince/missing/gcc/direct.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/missing/gcc/errno.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/missing/gcc/sys/stat.h | 23 | ||||
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 151 | ||||
-rw-r--r-- | backends/platform/wince/missing/signal.h | 3 | ||||
-rw-r--r-- | backends/platform/wince/missing/sys/stat.h | 25 | ||||
-rw-r--r-- | backends/platform/wince/missing/sys/time.h | 10 | ||||
-rw-r--r-- | backends/platform/wince/missing/sys/types.h | 5 | ||||
-rw-r--r-- | backends/platform/wince/missing/unistd.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/portdefs.h | 4 |
16 files changed, 1 insertions, 289 deletions
diff --git a/backends/platform/wince/missing/conio.h b/backends/platform/wince/missing/conio.h deleted file mode 100644 index 0cb5c297ea..0000000000 --- a/backends/platform/wince/missing/conio.h +++ /dev/null @@ -1,2 +0,0 @@ -/* Header is not present in Windows CE SDK */ - diff --git a/backends/platform/wince/missing/dir.h b/backends/platform/wince/missing/dir.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/dir.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/missing/direct.h b/backends/platform/wince/missing/direct.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/direct.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/missing/dirent.h b/backends/platform/wince/missing/dirent.h deleted file mode 100644 index 07e54bbb9d..0000000000 --- a/backends/platform/wince/missing/dirent.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Header is not present in Windows CE SDK */ -/* It would not be a bad idea to take this thing from gcc distro and port - it properly. For now only required part is ported. */ - -struct dirent -{ - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - char* d_name; /* File name. */ - /* NOTE: The name in the dirent structure points to the name in the - * finddata_t structure in the DIR. */ -}; - -/* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - */ -typedef struct -{ - /* disk transfer area for this dir */ -/* struct _finddata_t dd_dta; */ - - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct dirent dd_dir; - - /* _findnext handle */ - long dd_handle; - - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - short dd_stat; - - /* given path for dir with search pattern (struct is extended) */ - char dd_name[1]; -} DIR; - - -DIR* opendir (const char*); -struct dirent* readdir (DIR*); -int closedir (DIR*); -/* -void rewinddir (DIR*); -long telldir (DIR*); -void seekdir (DIR*, long); -*/ diff --git a/backends/platform/wince/missing/fcntl.h b/backends/platform/wince/missing/fcntl.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/fcntl.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/missing/gcc/assert.h b/backends/platform/wince/missing/gcc/assert.h deleted file mode 100644 index d52adb8c2c..0000000000 --- a/backends/platform/wince/missing/gcc/assert.h +++ /dev/null @@ -1,9 +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) ? (void) 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/gcc/direct.h b/backends/platform/wince/missing/gcc/direct.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/gcc/direct.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/missing/gcc/errno.h b/backends/platform/wince/missing/gcc/errno.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/gcc/errno.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/missing/gcc/sys/stat.h b/backends/platform/wince/missing/gcc/sys/stat.h deleted file mode 100644 index d9eef1318d..0000000000 --- a/backends/platform/wince/missing/gcc/sys/stat.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Header is not present in Windows CE SDK */ - -#include <sys/types.h> - -struct stat { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; -}; - - -#define _S_IFDIR 0040000 /* directory */ -#define S_IFDIR _S_IFDIR - -int stat(const char *, struct stat *); diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index 3233a04aa1..92af3e6961 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -36,14 +36,7 @@ #include <tchar.h> #include <string.h> #include <stdlib.h> -#include "sys/stat.h" -#ifndef __GNUC__ -#include "sys/time.h" -#else #include <stdio.h> -#endif -#include "time.h" -#include "dirent.h" #include "common/debug.h" char *strdup(const char *strSource); @@ -76,44 +69,8 @@ void *bsearch(const void *key, const void *base, size_t nmemb, return NULL; } -static WIN32_FIND_DATA wfd; - -int stat(const char *fname, struct stat *ss) { - TCHAR fnameUnc[MAX_PATH+1]; - HANDLE handle; - int len; - - if (fname == NULL || ss == NULL) - return -1; - - /* Special case (dummy on WinCE) */ - len = strlen(fname); - if (len >= 2 && fname[len-1] == '.' && fname[len-2] == '.' && - (len == 2 || fname[len-3] == '\\')) { - /* That's everything implemented so far */ - memset(ss, 0, sizeof(struct stat)); - ss->st_size = 1024; - ss->st_mode |= S_IFDIR; - return 0; - } - - MultiByteToWideChar(CP_ACP, 0, fname, -1, fnameUnc, MAX_PATH); - handle = FindFirstFile(fnameUnc, &wfd); - FindClose(handle); - if (handle == INVALID_HANDLE_VALUE) - return -1; - else - { - /* That's everything implemented so far */ - memset(ss, 0, sizeof(struct stat)); - ss->st_size = wfd.nFileSizeLow; - if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ss->st_mode |= S_IFDIR; - } - return 0; -} +static char cwd[MAX_PATH+1] = ""; -char cwd[MAX_PATH+1] = ""; EXT_C char *getcwd(char *buffer, int maxlen) { TCHAR fileUnc[MAX_PATH+1]; char* plast; @@ -228,112 +185,6 @@ int _access(const char *path, int mode) { // evc only functions follow #ifndef __GNUC__ -/* Limited dirent implementation. Used by UI.C and DEVICES.C */ -DIR* opendir(const char* fname) { - DIR* pdir; - char fnameMask[MAX_PATH+1]; - TCHAR fnameUnc[MAX_PATH+1]; - char nameFound[MAX_PATH+1]; - - if (fname == NULL) - return NULL; - - strcpy(fnameMask, fname); - if (!strlen(fnameMask) || fnameMask[strlen(fnameMask)-1] != '\\') - strncat(fnameMask, "\\", MAX_PATH-strlen(fnameMask)-1); - strncat(fnameMask, "*.*", MAX_PATH-strlen(fnameMask)-4); - - pdir = (DIR*)malloc(sizeof(DIR)+strlen(fname)); - pdir->dd_dir.d_ino = 0; - pdir->dd_dir.d_reclen = 0; - pdir->dd_dir.d_name = 0; - pdir->dd_dir.d_namlen = 0; - - pdir->dd_handle = 0; - pdir->dd_stat = 0; - strcpy(pdir->dd_name, fname); /* it has exactly enough space for fname and nul char */ - - MultiByteToWideChar(CP_ACP, 0, fnameMask, -1, fnameUnc, MAX_PATH); - if ((pdir->dd_handle = (long)FindFirstFile(fnameUnc, &wfd)) == (long)INVALID_HANDLE_VALUE) { - free(pdir); - return NULL; - } else { - WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL); - - pdir->dd_dir.d_name = strdup(nameFound); - pdir->dd_dir.d_namlen = strlen(nameFound); - } - return pdir; -} - -struct dirent* readdir(DIR* dir) { - char nameFound[MAX_PATH+1]; - static struct dirent dummy; - - if (dir->dd_stat == 0) { - dummy.d_name = "."; - dummy.d_namlen = 1; - dir->dd_stat ++; - return &dummy; - } else if (dir->dd_stat == 1) { - dummy.d_name = ".."; - dummy.d_namlen = 2; - dir->dd_stat ++; - return &dummy; - } else if (dir->dd_stat == 2) { - dir->dd_stat++; - return &dir->dd_dir; - } else { - if (FindNextFile((HANDLE)dir->dd_handle, &wfd) == 0) { - dir->dd_stat = -1; - return NULL; - } - WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, -1, nameFound, MAX_PATH, NULL, NULL); - - free(dir->dd_dir.d_name); - - dir->dd_dir.d_name = strdup(nameFound); - dir->dd_dir.d_namlen = strlen(nameFound); - - dir->dd_stat ++; - - return &dir->dd_dir; - } -} - -int closedir(DIR* dir) { - if (dir == NULL) - return 0; - - if (dir->dd_handle) - FindClose((HANDLE)dir->dd_handle); - - free(dir->dd_dir.d_name); - free(dir); - return 1; -} - -/* Make directory, Unix style */ -void mkdir(char* dirname, int mode) { - char path[MAX_PATH+1]; - TCHAR pathUnc[MAX_PATH+1]; - char *ptr; - strncpy(path, dirname, MAX_PATH); - if (*path == '/') - *path = '\\'; - /* Run through the string and attempt creating all subdirs on the path */ - for (ptr = path+1; *ptr; ptr ++) { - if (*ptr == '\\' || *ptr == '/') { - *ptr = 0; - MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); - CreateDirectory(pathUnc, 0); - *ptr = '\\'; - } - } - MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); - CreateDirectory(pathUnc, 0); -} - char *strdup(const char *strSource) { char *buffer; size_z len = strlen(strSource) + 1; diff --git a/backends/platform/wince/missing/signal.h b/backends/platform/wince/missing/signal.h deleted file mode 100644 index 128d6bf1db..0000000000 --- a/backends/platform/wince/missing/signal.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Header is not present in Windows CE SDK */ -/* Functionality is not critical -- Pocket PC devices do not have Ctrl+C */ -#define signal(a,b) diff --git a/backends/platform/wince/missing/sys/stat.h b/backends/platform/wince/missing/sys/stat.h deleted file mode 100644 index 8f5bda59e1..0000000000 --- a/backends/platform/wince/missing/sys/stat.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Header is not present in Windows CE SDK */ - -#include <sys/types.h> - -#ifndef __MINGW32CE__ -struct stat { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; -}; - -int stat(const char *, struct stat *); - -#endif - -#define _S_IFDIR 0040000 /* directory */ -#define S_IFDIR _S_IFDIR diff --git a/backends/platform/wince/missing/sys/time.h b/backends/platform/wince/missing/sys/time.h deleted file mode 100644 index ded29bb009..0000000000 --- a/backends/platform/wince/missing/sys/time.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Header is not present in Windows CE SDK */ - -struct timeval -{ - int tv_sec; - int tv_usec; -}; - -void gettimeofday(struct timeval* tp, void* dummy); -void usleep(long usec); diff --git a/backends/platform/wince/missing/sys/types.h b/backends/platform/wince/missing/sys/types.h deleted file mode 100644 index b6c05e3958..0000000000 --- a/backends/platform/wince/missing/sys/types.h +++ /dev/null @@ -1,5 +0,0 @@ -/* Header is not present in Windows CE SDK */ - -typedef unsigned short _ino_t; -typedef unsigned int _dev_t; -typedef long _off_t; diff --git a/backends/platform/wince/missing/unistd.h b/backends/platform/wince/missing/unistd.h deleted file mode 100644 index 7ee9f5e5ba..0000000000 --- a/backends/platform/wince/missing/unistd.h +++ /dev/null @@ -1 +0,0 @@ -/* Header is not present in Windows CE SDK */ diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h index 4b9c53e707..cbf2006be2 100644 --- a/backends/platform/wince/portdefs.h +++ b/backends/platform/wince/portdefs.h @@ -69,14 +69,10 @@ char *strpbrk(const char *s, const char *accept); #include <string.h> #include <io.h> #include <stdarg.h> -#include <fcntl.h> -#include <conio.h> -#include <malloc.h> #include <assert.h> #include <mmsystem.h> #include <ctype.h> //#include <direct.h> -#include <time.h> #ifdef __MINGW32CE__ void *bsearch(const void *, const void *, size_t, size_t, int (*x) (const void *, const void *)); |