* src/lib/Evil.h:

add strdup define
* src/lib/evil.c: (evil_tmpdir_get), (evil_homedir_get):
include stdlib.h to define MB_CUR_MAX
On Windows CE, tmpdir and homedir are defined as "\windows"
* src/lib/mman/mman.c: (mmap), (munmap):
compile the big fat hack of mmap only on Windows CE


SVN revision: 34784
This commit is contained in:
doursse 2008-06-09 18:35:49 +00:00 committed by doursse
parent d2c2490440
commit 98a11ae8cf
4 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2008-06-09 Vincent Torri <doursse at users dot sf dot net>
* src/lib/Evil.h:
add strdup define
* src/lib/evil.c: (evil_tmpdir_get), (evil_homedir_get):
include stdlib.h to define MB_CUR_MAX
On Windows CE, tmpdir and homedir are defined as "\windows"
* src/lib/mman/mman.c: (mmap), (munmap):
compile the big fat hack of mmap only on Windows CE
2008-06-08 Vincent Torri <doursse at users dot sf dot net>
* src/lib/Evil.h:

View File

@ -380,6 +380,7 @@ EAPI int unsetenv(const char *name);
# define mkdir(p,m) _mkdir(p)
# define getcwd(b,s) _getcwd((b),(s))
# define lstat(f,s) _stat((f),(s))
# define strdup(s) _strdup(s)
# endif
#endif

View File

@ -2,6 +2,7 @@
#include <winsock2.h>
#undef WIN32_LEAN_AND_MEAN
#include <stdlib.h>
#include <stdio.h>
#ifndef __CEGCC__
@ -423,6 +424,9 @@ evil_sockets_shutdown(void)
const char *
evil_tmpdir_get(void)
{
#ifdef _WIN32_WCE
return "\\windows";
#else
char *tmpdir;
tmpdir = getenv("TMP");
@ -432,11 +436,15 @@ evil_tmpdir_get(void)
if (!tmpdir) tmpdir="C:\\";
return tmpdir;
#endif /* ! _WIN32_WCE */
}
const char *
evil_homedir_get(void)
{
#ifdef _WIN32_WCE
return "\\windows";
#else
char *homedir;
homedir = getenv("HOME");
@ -445,6 +453,7 @@ evil_homedir_get(void)
if (!homedir) homedir="C:\\";
return homedir;
#endif /* ! _WIN32_WCE */
}
char *

View File

@ -43,7 +43,6 @@ mmap(void *addr __UNUSED__,
off_t offset)
{
OSVERSIONINFO os_version;
void *data;
os_version.dwOSVersionInfoSize = sizeof(os_version);
if (!GetVersionEx(&os_version))
@ -57,9 +56,11 @@ mmap(void *addr __UNUSED__,
return MAP_FAILED;
}
#ifdef _WIN32_WCE
if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_CE) &&
(os_version.dwMajorVersion < 5))
{
void *data;
size_t size;
data = malloc(len);
@ -83,13 +84,17 @@ mmap(void *addr __UNUSED__,
free(data);
return MAP_FAILED;
}
return data;
}
else
#endif /* ! _WIN32_WCE */
{
HANDLE fm;
DWORD protect = PAGE_NOACCESS;
DWORD access = 0;
HANDLE handle;
void *data;
/* support only MAP_SHARED */
if (!(flags & MAP_SHARED))
@ -178,15 +183,16 @@ mmap(void *addr __UNUSED__,
return MAP_FAILED;
}
}
return data;
return data;
}
}
int
munmap(void *addr,
size_t len __UNUSED__)
{
#ifdef _WIN32_WCE
OSVERSIONINFO os_version;
os_version.dwOSVersionInfoSize = sizeof(os_version);
@ -210,6 +216,7 @@ munmap(void *addr,
return 0;
}
else
#endif /* ! _WIN32_WCE */
{
BOOL res;