diff options
author | blythe%netscape.com <devnull@localhost> | 2002-07-30 19:06:55 +0000 |
---|---|---|
committer | blythe%netscape.com <devnull@localhost> | 2002-07-30 19:06:55 +0000 |
commit | 4269a9b4243621047f127402eeca45436323cfed (patch) | |
tree | b32c54ba4ae453f37ed114eda0c12e58f84cf800 | |
parent | 8ee798e93ad822d455804598c6bf40d7cd6218f8 (diff) | |
download | nspr-hg-4269a9b4243621047f127402eeca45436323cfed.tar.gz |
JS compiles.
Pull multibyte hacks back out of NSPR.
Pull stat out of NSPR.
Avoid stack walking mechanisms for WINCE build.
Various conversions to TCHAR for unicode handling.
-rw-r--r-- | pr/include/md/_wince.h | 51 | ||||
-rw-r--r-- | pr/src/md/windows/w95io.c | 102 |
2 files changed, 3 insertions, 150 deletions
diff --git a/pr/include/md/_wince.h b/pr/include/md/_wince.h index b734d613..bdb99379 100644 --- a/pr/include/md/_wince.h +++ b/pr/include/md/_wince.h @@ -501,57 +501,8 @@ extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap); /* - * WINCE LIBC support missing some integral parts + * Couple of missing functions for wince. */ - - -/* - * Missing types. - */ -typedef long _off_t; /* file offset value */ - -/* - * struct stat - * - * Assumed by NSPR in a place or two. - */ -struct stat { - unsigned short st_mode; - _off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; -}; - -/* - * Missing function oldnames. - */ -#define stricmp _stricmp -#define strcmpi _stricmp -#define strdup _strdup - -/* - * Missing constants. - */ -#define HINSTANCE_ERROR 1 /* LoadLibrary, NULL on failure for WinCE */ -#define _S_IFDIR 0040000 /* stat, is a directory */ -#define _S_IFREG 0100000 /* stat, is a normal file */ -#define _S_IREAD 0000400 /* stat, can read */ -#define _S_IWRITE 0000200 /* stat, can write */ -#define ENOMEM 12 /* errno, out of memory */ - -/* - * struct protoent is actually defined, but the functions that use it are not. - * - * And related windows specific functions to mimic these absent sockets funcs. - */ -#if 0 -struct protoent { - char* p_name; - char** p_aliases; - short p_proto; -}; -#endif extern struct protoent* Wingetprotobyname(const char* inName); extern struct protoent* Wingetprotobynumber(int inNumber); diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c index 2fcc8170..acc5e47b 100644 --- a/pr/src/md/windows/w95io.c +++ b/pr/src/md/windows/w95io.c @@ -39,10 +39,8 @@ */ #include "primpl.h" -#if !defined(WINCE) #include <direct.h> #include <mbstring.h> -#endif struct _MDLock _pr_ioq_lock; @@ -482,11 +480,7 @@ void FlipSlashes(char *cp, int len) if (cp[0] == '/') { cp[0] = PR_DIRECTORY_SEPARATOR; } -#if !defined(WINCE) cp = _mbsinc(cp); -#else - cp++; -#endif } } /* end FlipSlashes() */ @@ -681,7 +675,6 @@ _PR_MD_STAT(const char *fn, struct stat *info) { PRInt32 rv; -#if !defined(WINCE) rv = _stat(fn, (struct _stat *)info); if (-1 == rv) { /* @@ -710,85 +703,6 @@ _PR_MD_STAT(const char *fn, struct stat *info) if (-1 == rv) { _PR_MD_MAP_STAT_ERROR(errno); } -#else - HANDLE readHandle = NULL; - - /* - * Initialize the out arguments. - */ - memset(info, 0, sizeof(struct stat)); - rv = 0; - - /* - * Attempt to fill in relevant parts of the struct. - * In order to do this we'll need read access to the file. - * We won't mind sharing the file. - */ - readHandle = -#if !defined(WINCE) - CreateFile -#else - _MD_CreateFileA -#endif - ( - fn, - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if(NULL == readHandle) - { - rv = -1; - } - else - { - BOOL bRes = FALSE; - BY_HANDLE_FILE_INFORMATION fileInfo; - - bRes = GetFileInformationByHandle(readHandle, &fileInfo); - if(FALSE == bRes) - { - rv = -1; - } - else - { - /* - * Access Times - */ - _MD_FILETIME_2_time_t(info->st_ctime, fileInfo.ftCreationTime); - _MD_FILETIME_2_time_t(info->st_atime, fileInfo.ftLastAccessTime); - _MD_FILETIME_2_time_t(info->st_mtime, fileInfo.ftLastWriteTime); - - /* - * Size. - * Note, this is not stat64. - */ - info->st_size = (_off_t)fileInfo.nFileSizeLow; - - /* - * Mode. - */ - info->st_mode |= _S_IREAD; - if(0 == (FILE_ATTRIBUTE_READONLY & fileInfo.dwFileAttributes)) - { - info->st_mode |= _S_IWRITE; - } - if(FILE_ATTRIBUTE_DIRECTORY & fileInfo.dwFileAttributes) - { - info->st_mode |= _S_IFDIR; - } - else - { - info->st_mode |= _S_IFREG; - } - } - - CloseHandle(readHandle); - readHandle = NULL; - } -#endif return rv; } @@ -908,13 +822,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) * FindFirstFile() expands wildcard characters. So * we make sure the pathname contains no wildcard. */ - if (NULL != -#if !defined(WINCE) - _mbspbrk(fn, "?*") -#else - strpbrk(fn, "?*") -#endif - ) { + if (NULL != _mbspbrk(fn, "?*")) { PR_SetError(PR_FILE_NOT_FOUND_ERROR, 0); return -1; } @@ -954,13 +862,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) * If the pathname does not contain ., \, and /, it cannot be * a root directory or a pathname that ends in a slash. */ - if (NULL == -#if !defined(WINCE) - _mbspbrk(fn, ".\\/") -#else - strpbrk(fn, ".\\/") -#endif - ) { + if (NULL == _mbspbrk(fn, ".\\/")) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; } |