From ac3bcc3fa94028029b20af6385a26af9823ed52e Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sat, 27 Dec 2008 18:53:56 +0000 Subject: [PATCH] * src/bin/evil_test_environment.c: check returned value * src/bin/evil_test_memcpy.c: define getpagesize() for vc++ * src/lib/evil_unistd.c: move inclusion of time.h after windsock2.h include direct.h for vc++ use _WIN32_WCE for Windows CE compilers in evil_getcwd() * src/lib/Evil.h: * src/lib/evil_unistd.h: move getcwd() define from Evil.h to evil_unistd.h add some C99 types to Evil.h for vc++ (will be used in eina) * src/lib/evil_fcntl.c: include io.h for vc++ * src/lib/evil_link_xp.cpp: use full name for symlink(). Fix symlink on Windows XP with the DOS prompt or the debugger of Visual Studio. * src/lib/evil_mman.c: don't include unistd.h if vc++ is used * src/lib/evil_stdio.h: formatting * src/lib/evil_stdlib.h: * src/lib/evil_stdlib.c: define putenv only for mingw32ce move the returned value of setenv() SVN revision: 38333 --- legacy/evil/ChangeLog | 36 +++++++++++++++++++++ legacy/evil/src/bin/evil_test_environment.c | 2 ++ legacy/evil/src/bin/evil_test_memcpy.c | 4 +-- legacy/evil/src/lib/Evil.h | 6 +++- legacy/evil/src/lib/evil_fcntl.c | 4 +++ legacy/evil/src/lib/evil_link_xp.cpp | 5 ++- legacy/evil/src/lib/evil_mman.c | 5 ++- legacy/evil/src/lib/evil_stdio.h | 5 +-- legacy/evil/src/lib/evil_stdlib.c | 12 +++---- legacy/evil/src/lib/evil_stdlib.h | 4 +-- legacy/evil/src/lib/evil_unistd.c | 12 ++++--- legacy/evil/src/lib/evil_unistd.h | 1 + 12 files changed, 73 insertions(+), 23 deletions(-) diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 60fac3e491..7685b0e226 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,39 @@ +2008-12-27 Vincent Torri + + * src/bin/evil_test_environment.c: + check returned value + + * src/bin/evil_test_memcpy.c: + define getpagesize() for vc++ + + * src/lib/evil_unistd.c: + move inclusion of time.h after windsock2.h + include direct.h for vc++ + use _WIN32_WCE for Windows CE compilers in evil_getcwd() + + * src/lib/Evil.h: + * src/lib/evil_unistd.h: + move getcwd() define from Evil.h to evil_unistd.h + add some C99 types to Evil.h for vc++ (will be used in eina) + + * src/lib/evil_fcntl.c: + include io.h for vc++ + + * src/lib/evil_link_xp.cpp: + use full name for symlink(). Fix symlink on Windows XP with + the DOS prompt or the debugger of Visual Studio. + + * src/lib/evil_mman.c: + don't include unistd.h if vc++ is used + + * src/lib/evil_stdio.h: + formatting + + * src/lib/evil_stdlib.h: + * src/lib/evil_stdlib.c: + define putenv only for mingw32ce + move the returned value of setenv() + 2008-12-13 Vincent Torri * src/bin/Makefile.am: diff --git a/legacy/evil/src/bin/evil_test_environment.c b/legacy/evil/src/bin/evil_test_environment.c index 07ba484f37..e7139a1843 100644 --- a/legacy/evil/src/bin/evil_test_environment.c +++ b/legacy/evil/src/bin/evil_test_environment.c @@ -22,6 +22,8 @@ test_env_tests_run(suite *s) return 0; val = getenv("EVIL_TEST_ENV"); + if (!val) + return 0; if (strcmp(val, "val1")) return 0; diff --git a/legacy/evil/src/bin/evil_test_memcpy.c b/legacy/evil/src/bin/evil_test_memcpy.c index fdd93efe82..9dca042e32 100644 --- a/legacy/evil/src/bin/evil_test_memcpy.c +++ b/legacy/evil/src/bin/evil_test_memcpy.c @@ -24,13 +24,13 @@ static unsigned char *buf2 = NULL; static size_t page_size = 0; -#ifdef __MINGW32CE__ +#if defined (__MINGW32CE__) || defined (_MSC_VER) static int getpagesize() { return 1024; } -#endif /* __MINGW32CE__ */ +#endif /* __MINGW32CE__ || _MSC_VER */ static void diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index da8d9bf949..28777611b6 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -92,6 +92,11 @@ typedef int pid_t; typedef SSIZE_T ssize_t; typedef unsigned short mode_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef signed int int32_t; +typedef unsigned __int64 uint64_t; + #endif /* _MSC_VER */ @@ -142,7 +147,6 @@ typedef unsigned long gid_t; # define write(fd,buffer,count) _write((fd),(buffer),(count)) # define unlink(filename) _unlink((filename)) # define mkdir(p,m) _mkdir(p) -# define getcwd(b,s) evil_getcwd((b),(s)) # define lstat(f,s) _stat((f),(s)) # define strdup(s) _strdup(s) diff --git a/legacy/evil/src/lib/evil_fcntl.c b/legacy/evil/src/lib/evil_fcntl.c index 4d0c7196e7..603fd1aaab 100644 --- a/legacy/evil/src/lib/evil_fcntl.c +++ b/legacy/evil/src/lib/evil_fcntl.c @@ -1,6 +1,10 @@ #include +#ifdef _MSC_VER +# include /* for _get_osfhandle _lseek and _locking */ +#endif + #ifndef __CEGCC__ # include #endif /* __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_link_xp.cpp b/legacy/evil/src/lib/evil_link_xp.cpp index d0bac6454b..820bea1cb5 100644 --- a/legacy/evil/src/lib/evil_link_xp.cpp +++ b/legacy/evil/src/lib/evil_link_xp.cpp @@ -25,12 +25,15 @@ int symlink(const char *oldpath, const char *newpath) { + char fullname[PATH_MAX]; wchar_t *wnewpath; IShellLink *pISL; IPersistFile *pIPF; HRESULT res; size_t size; + realpath(oldpath, fullname); + res = CoInitialize(NULL); if (FAILED(res)) { @@ -46,7 +49,7 @@ symlink(const char *oldpath, const char *newpath) (void **)&pISL))) goto no_instance; - if (FAILED(pISL->SetPath(oldpath))) + if (FAILED(pISL->SetPath(fullname))) goto no_setpath; if (FAILED(pISL->QueryInterface(IID_IPersistFile, (void **)&pIPF))) diff --git a/legacy/evil/src/lib/evil_mman.c b/legacy/evil/src/lib/evil_mman.c index 424cdfa731..0223a6b197 100644 --- a/legacy/evil/src/lib/evil_mman.c +++ b/legacy/evil/src/lib/evil_mman.c @@ -1,6 +1,9 @@ #include #include -#include + +#ifndef _MSC_VER +# include +#endif #define WIN32_LEAN_AND_MEAN #include diff --git a/legacy/evil/src/lib/evil_stdio.h b/legacy/evil/src/lib/evil_stdio.h index e3924cf427..d68cca347c 100644 --- a/legacy/evil/src/lib/evil_stdio.h +++ b/legacy/evil/src/lib/evil_stdio.h @@ -4,9 +4,6 @@ #if defined (_WIN32_WCE) && ! defined (__CEGCC__) - -# include - /* * Error related functions * @@ -25,7 +22,7 @@ EAPI FILE *evil_fopen(const char *path, const char *mode); EAPI void evil_rewind(FILE *stream); -#define rewind(f) evil_rewind(f) +# define rewind(f) evil_rewind(f) #endif /* _WIN32_WCE && ! __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c index 7a19cf3676..0f6d72742d 100644 --- a/legacy/evil/src/lib/evil_stdlib.c +++ b/legacy/evil/src/lib/evil_stdlib.c @@ -93,14 +93,11 @@ getenv(const char *name) #endif /* __CEGCC__ || __MINGW32CE__ */ -#if ! defined(__CEGCC__) +#ifdef __MINGW32CE__ int putenv(const char *string) { -#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) - return _putenv(string); -#else char *str; char *egal; char *name; @@ -120,10 +117,9 @@ putenv(const char *string) free(str); return 0; -#endif /* __CEGCC__ || __MINGW32CE__ */ } -#endif /* ! __CEGCC__ */ +#endif /* __MINGW32CE__ */ @@ -233,9 +229,9 @@ setenv(const char *name, return -1; } -#endif /* __CEGCC__ || __MINGW32CE__ */ - return 0; + +#endif /* __CEGCC__ || __MINGW32CE__ */ } #if ! defined(__CEGCC__) diff --git a/legacy/evil/src/lib/evil_stdlib.h b/legacy/evil/src/lib/evil_stdlib.h index a0120972b4..36f300fbd1 100644 --- a/legacy/evil/src/lib/evil_stdlib.h +++ b/legacy/evil/src/lib/evil_stdlib.h @@ -14,11 +14,11 @@ EAPI char *getenv(const char *name); #endif /* __CEGCC__ || __MINGW32CE__ */ -#if ! defined(__CEGCC__) +#ifdef __MINGW32CE__ EAPI int putenv(const char *string); -#endif /* ! __CEGCC__ */ +#endif /* __MINGW32CE__ */ /** * @brief Create, modify, or remove environment variables. diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c index 5e62233324..6dd97a548f 100644 --- a/legacy/evil/src/lib/evil_unistd.c +++ b/legacy/evil/src/lib/evil_unistd.c @@ -7,12 +7,16 @@ #include #endif /* HAVE_ERRNO_H */ -#include - #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN +# include + +#ifdef _MSC_VER +# include /* for _getcwd */ +#endif + #include "Evil.h" #include "evil_private.h" @@ -89,7 +93,7 @@ getpid(void) char * evil_getcwd(char *buffer, size_t size) { -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef _WIN32_WCE wchar_t wpath[PATH_MAX]; char *cpath; char *delim; @@ -136,7 +140,7 @@ evil_getcwd(char *buffer, size_t size) return buffer; #else return _getcwd(buffer, size); -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ +#endif /* ! _WIN32_WCE */ } #if defined (_WIN32_WCE) && ! defined (__CEGCC__) diff --git a/legacy/evil/src/lib/evil_unistd.h b/legacy/evil/src/lib/evil_unistd.h index 0e494c6a8c..4d558a5b2e 100644 --- a/legacy/evil/src/lib/evil_unistd.h +++ b/legacy/evil/src/lib/evil_unistd.h @@ -149,6 +149,7 @@ EAPI int evil_stat(const char *file_name, struct stat *st); */ EAPI char *evil_getcwd(char *buffer, size_t size); +#define getcwd(b,s) evil_getcwd((b),(s)) /* * Sockets and pipe related functions