diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 52fba7995a..4f858b86a6 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,61 @@ +2008-09-15 Vincent Torri + + * Makefile.am: + add autogen.sh in archive distribution + + * configure.ac: + remove useless defines + first support of mingw32msvc compiler + + * src/lib/Evil.h: + move some macro definitions + + * src/lib/Makefile.am: + add evil_(fcntl/langinfo).(c/h) and install pwd.h + + * src/lib/dlfcn/dlfcn.h: + remove useless ifdef + + * src/lib/evil.c: + comment all code for now. It will be deleted later + + * src/lib/evil_fcntl.c: + * src/lib/evil_fcntl.h: + * src/lib/evil_langinfo.c: + * src/lib/evil_langinfo.h: + move fcntl and langinfo related code to their own files + + * src/lib/evil_mman.c: + remove useless inclusion + + * src/lib/evil_pwd.c: + pw var is not needed with cegcc + + * src/lib/evil_stdlib.c: + fix bugs, formatting + + * src/lib/evil_unistd.c: + add missing declarations and fix header files + + * src/lib/evil_unistd.h: + move pid_t typedef to Evil.h + + * src/lib/evil_util.c: + additional include and fix a bug in output + + * src/lib/pwd.h: + use EAPI from Evil.h, define struct passwd when not using cegcc + + * src/lib/sys/mman.h: + use EAPI from Evil.h + + * win32/common/fnmatch.c: + * win32/common/fnmatch.h: + * win32/common/fnmatch_list_of_states.c: + * win32/vs8/evil.sln: + fix and cleanup with vc++ compilation + Based on patch by Dmitriy Mazovka + 2008-09-14 Vincent Torri Fix compilation with vc++. Based on patch by Dmitriy Mazovka diff --git a/legacy/evil/Makefile.am b/legacy/evil/Makefile.am index 24ac9cb9a7..18e70d3ffa 100644 --- a/legacy/evil/Makefile.am +++ b/legacy/evil/Makefile.am @@ -24,6 +24,7 @@ EXTRA_DIST = \ COPYING \ COPYING-PLAIN \ Doxyfile \ +autogen.sh \ evil.pc.in pkgconfigdir = $(libdir)/pkgconfig diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index 0418e9a289..24dbb2c890 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -11,7 +11,7 @@ dnl for each platform. win32_libs="" win32_cflags="" case "$host_os" in - mingw|mingw32) + mingw | mingw32 | mingw32msvc) win32_libs="-lole32 -luuid -lws2_32" ;; cegcc) @@ -30,9 +30,7 @@ AC_SUBST(win32_libs) dnl needed for correct definition of EAPI AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) -AC_DEFINE(EFL_EVIL_MMAN_BUILD, 1, [Define to mention that evil mman is built]) AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil dlfcn is built]) -AC_DEFINE(EFL_EVIL_PWD_BUILD, 1, [Define to mention that evil pwd is built]) AM_INIT_AUTOMAKE(1.6 dist-bzip2) diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index ffdae28154..004e2daa6b 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -76,151 +76,6 @@ extern "C" { #define PATH_MAX MAX_PATH -#ifdef _MSC_VER - -typedef SSIZE_T ssize_t; -typedef unsigned short mode_t; - -#endif /* _MSC_VER */ - - -#include "evil_stdlib.h" -#include "evil_unistd.h" -#include "evil_util.h" - - -#ifndef __CEGCC__ - -# include - -/** - * @def FD_CLOEXEC - * Specifies that the file descriptor should be closed when an exec() - * function is invoked. - */ -# define FD_CLOEXEC 1 - -/** - * @def F_SETFD - * Specifies that fcntl() should set the file descriptor flags - * associated with the filedes argument. - */ - -/** - * @def F_SETLK - * Specifies that fcntl() should set or clear a file segment lock - * according to the lock description pointed to by the third argument. - */ - -/** - * @def F_SETLKW - * Equivalent to F_SETLK except that if a shared or exclusive lock - * is blocked by other locks, the thread shall wait until the request - * can be satisfied. - */ - -# define F_SETFD 2 -# define F_SETLK 6 -# define F_SETLKW 7 - -/** - * @def F_RDLCK - * Read (or shared) lock - */ - -/** - * @def F_WRLCK - * Write (or exclusive) lock - */ - -/** - * @def F_UNLCK - * Remove lock - */ - -# ifndef F_RDLCK -# define F_RDLCK 0 -# define F_WRLCK 1 -# define F_UNLCK 2 -# endif /* ! F_RDLCK */ - -/** - * @struct flock - * @brief A structure that control the lock of a file descriptor. - */ -struct flock -{ - short int l_type; /**< lock type: read, write, ... */ - short int l_whence; /**< type of l_start */ - off_t l_start; /**< starting offset */ - off_t l_len; /**< 0 means end of the file */ - pid_t l_pid; /**< lock owner */ -}; - - -/** - * @brief Provide control over file descriptors. - * - * @param fd The file descriptor. - * @param cmd The type of control. - * @return 0 on success, -1 otherwise. - * - * Performs one of various miscellaneous operations on @p fd. - * The operation in question is determined by @p cmd: - * - * - F_SETFD: Set the close-on-exec flag to the value specified - * by the argument after command (only the least significant - * bit is used). - * - F_SETLK and F_SETLKW: used to manage discretionary file locks. - * The third argument must be a pointer to a struct flock (that - * may be overwritten by this call). - * - * This function returns 0 on success, -1 otherwise. - * - * Conformity: None. - * - * Supported OS: Windows Vista, Windows XP or Windows 2000 - * Professional. - * - * @ingroup Evil - */ -EAPI int fcntl(int fd, int cmd, ...); - - -#endif /* ! __CEGCC__ */ - -typedef int nl_item; - -#define __NL_ITEM( CATEGORY, INDEX ) ((CATEGORY << 16) | INDEX) -#define __NL_ITEM_CATEGORY( ITEM ) (ITEM >> 16) -#define __NL_ITEM_INDEX( ITEM ) (ITEM & 0xffff) - -enum { - /* - * LC_CTYPE category... - * Character set classification items. - */ - _NL_CTYPE_CODESET = __NL_ITEM( LC_CTYPE, 0 ), - - /* - * Dummy entry, to terminate the list. - */ - _NL_ITEM_CLASSIFICATION_END -}; - -/* - * Define the public aliases for the enumerated classification indices... - */ -# define CODESET _NL_CTYPE_CODESET - -EAPI char *nl_langinfo(nl_item index); - - -#ifndef __CEGCC__ -typedef unsigned long uid_t; -typedef unsigned long gid_t; -#endif /* ! __CEGCC__ */ - #ifdef _MSC_VER #define F_OK 0 /* Check for file existence */ @@ -233,9 +88,28 @@ typedef unsigned long gid_t; #define _S_IWUSR _S_IWRITE #define _S_IRUSR _S_IREAD +typedef int pid_t; +typedef SSIZE_T ssize_t; +typedef unsigned short mode_t; + #endif /* _MSC_VER */ +#ifndef __CEGCC__ + +typedef unsigned long uid_t; +typedef unsigned long gid_t; + +#endif /* ! __CEGCC__ */ + + +#include "evil_fcntl.h" +#include "evil_langinfo.h" +#include "evil_stdlib.h" +#include "evil_unistd.h" +#include "evil_util.h" + + #if defined(__MSDOS__) || defined(__EMX__) || \ (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__) && !defined(__CEGCC__)) # if defined(_MSC_VER) || defined(__MINGW32__) diff --git a/legacy/evil/src/lib/Makefile.am b/legacy/evil/src/lib/Makefile.am index f66c565821..7df63b3524 100644 --- a/legacy/evil/src/lib/Makefile.am +++ b/legacy/evil/src/lib/Makefile.am @@ -5,11 +5,20 @@ SUBDIRS = . dlfcn lib_LTLIBRARIES = libevil.la -include_HEADERS = Evil.h evil_stdlib.h evil_unistd.h evil_util.h -nobase_include_HEADERS = sys/mman.h +include_HEADERS = \ +Evil.h \ +evil_fcntl.h \ +evil_langinfo.h \ +evil_stdlib.h \ +evil_unistd.h \ +evil_util.h + +nobase_include_HEADERS = pwd.h sys/mman.h libevil_la_SOURCES = \ evil.c \ +evil_fcntl.c \ +evil_langinfo.c \ evil_mman.c \ evil_pwd.c \ evil_stdlib.c \ diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.h b/legacy/evil/src/lib/dlfcn/dlfcn.h index 4848459ec8..296f8f7fa1 100644 --- a/legacy/evil/src/lib/dlfcn/dlfcn.h +++ b/legacy/evil/src/lib/dlfcn/dlfcn.h @@ -8,7 +8,7 @@ # undef _POSIX_ #endif /* _MSC_VER */ -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#if defined(__CEGCC__) # include #else # include diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c index 874e48d912..422b65a7c4 100644 --- a/legacy/evil/src/lib/evil.c +++ b/legacy/evil/src/lib/evil.c @@ -1,141 +1,38 @@ -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN +/* #define WIN32_LEAN_AND_MEAN */ +/* #include */ +/* #undef WIN32_LEAN_AND_MEAN */ -#include -#include +/* #include */ +/* #include */ -#ifndef __CEGCC__ -# include -# include -# include -# include -# include -#else -# include -#endif /* __CEGCC__ */ +/* #ifndef __CEGCC__ */ +/* # include */ +/* # include */ +/* # include */ +/* # include */ +/* # include */ +/* #else */ +/* # include */ +/* #endif /\* __CEGCC__ *\/ */ -#ifdef UNICODE -# include -#endif /* UNICODE */ +/* #ifdef UNICODE */ +/* # include */ +/* #endif /\* UNICODE *\/ */ -#include -#include -#include -#include +/* #include */ +/* #include */ +/* #include */ +/* #include */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif /* HAVE_CONFIG_H */ +/* #ifdef HAVE_CONFIG_H */ +/* # include "config.h" */ +/* #endif /\* HAVE_CONFIG_H *\/ */ -#if HAVE___ATTRIBUTE__ -# define __UNUSED__ __attribute__((unused)) -#else -# define __UNUSED__ -#endif /* HAVE___ATTRIBUTE__ */ +/* #if HAVE___ATTRIBUTE__ */ +/* # define __UNUSED__ __attribute__((unused)) */ +/* #else */ +/* # define __UNUSED__ */ +/* #endif /\* HAVE___ATTRIBUTE__ *\/ */ -#include "Evil.h" +/* #include "Evil.h" */ - -#ifndef __CEGCC__ - -int fcntl(int fd, int cmd, ...) -{ - va_list va; - HANDLE h; - int res = -1; - - va_start (va, cmd); - - h = (HANDLE)_get_osfhandle(fd); - if (h == INVALID_HANDLE_VALUE) - return -1; - - if (cmd == F_SETFD) - { - long flag; - - flag = va_arg(va, long); - if (flag == FD_CLOEXEC) - { - if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0)) - res = 0; - } - } - else if ((cmd == F_SETLK) || (cmd == F_SETLKW)) - { - struct flock fl; - off_t length = 0; - long pos; - - fl = va_arg(va, struct flock); - - if (fl.l_len == 0) - { - length = _lseek(fd, 0L, SEEK_END); - if (length != -1L) - res = 0; - } - fl.l_len = length - fl.l_start - 1; - - pos = _lseek(fd, fl.l_start, fl.l_whence); - if (pos != -1L) - res = 0; - - if ((fl.l_type == F_RDLCK) || (fl.l_type == F_WRLCK)) - { - if (cmd == F_SETLK) - res = _locking(fd, _LK_NBLCK, fl.l_len); /* if cannot be locked, we return immediatly */ - else /* F_SETLKW */ - res = _locking(fd, _LK_LOCK, fl.l_len); /* otherwise, we try several times */ - } - - if (fl.l_type == F_UNLCK) - res = _locking(fd, _LK_UNLCK, fl.l_len); - } - - va_end(va); - - return res; -} - -#endif /* ! __CEGCC__ */ - -static char * -replace(char *prev, char *value) -{ - if (value == NULL) - return prev; - - if (prev) - free (prev); - return strdup (value); -} - -char * -nl_langinfo(nl_item index) -{ - static char *result = NULL; - static char *nothing = ""; - - switch (index) - { - case CODESET: - { - char *p; - result = replace(result, setlocale(LC_CTYPE, NULL)); - if ((p = strrchr(result, '.' )) == NULL) - return nothing; - - if ((++p - result) > 2) - strcpy(result, "cp"); - else - *result = '\0'; - strcat(result, p); - - return result; - } - } - - return nothing; -} diff --git a/legacy/evil/src/lib/evil_fcntl.c b/legacy/evil/src/lib/evil_fcntl.c new file mode 100644 index 0000000000..1cd61eddb2 --- /dev/null +++ b/legacy/evil/src/lib/evil_fcntl.c @@ -0,0 +1,82 @@ + +#include + +#ifndef __CEGCC__ +# include +#endif /* __CEGCC__ */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include "Evil.h" + + +/* + * port of fcntl function + * + */ + +#ifndef __CEGCC__ + +int fcntl(int fd, int cmd, ...) +{ + va_list va; + HANDLE h; + int res = -1; + + va_start (va, cmd); + + h = (HANDLE)_get_osfhandle(fd); + if (h == INVALID_HANDLE_VALUE) + return -1; + + if (cmd == F_SETFD) + { + long flag; + + flag = va_arg(va, long); + if (flag == FD_CLOEXEC) + { + if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0)) + res = 0; + } + } + else if ((cmd == F_SETLK) || (cmd == F_SETLKW)) + { + struct flock fl; + off_t length = 0; + long pos; + + fl = va_arg(va, struct flock); + + if (fl.l_len == 0) + { + length = _lseek(fd, 0L, SEEK_END); + if (length != -1L) + res = 0; + } + fl.l_len = length - fl.l_start - 1; + + pos = _lseek(fd, fl.l_start, fl.l_whence); + if (pos != -1L) + res = 0; + + if ((fl.l_type == F_RDLCK) || (fl.l_type == F_WRLCK)) + { + if (cmd == F_SETLK) + res = _locking(fd, _LK_NBLCK, fl.l_len); /* if cannot be locked, we return immediatly */ + else /* F_SETLKW */ + res = _locking(fd, _LK_LOCK, fl.l_len); /* otherwise, we try several times */ + } + + if (fl.l_type == F_UNLCK) + res = _locking(fd, _LK_UNLCK, fl.l_len); + } + + va_end(va); + + return res; +} + +#endif /* ! __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h new file mode 100644 index 0000000000..cedeffb6e8 --- /dev/null +++ b/legacy/evil/src/lib/evil_fcntl.h @@ -0,0 +1,106 @@ +#ifndef __EVIL_FCNTL_H__ +#define __EVIL_FCNTL_H__ + + +#ifndef __CEGCC__ + +# include + +/** + * @def FD_CLOEXEC + * Specifies that the file descriptor should be closed when an exec() + * function is invoked. + */ +# define FD_CLOEXEC 1 + +/** + * @def F_SETFD + * Specifies that fcntl() should set the file descriptor flags + * associated with the filedes argument. + */ + +/** + * @def F_SETLK + * Specifies that fcntl() should set or clear a file segment lock + * according to the lock description pointed to by the third argument. + */ + +/** + * @def F_SETLKW + * Equivalent to F_SETLK except that if a shared or exclusive lock + * is blocked by other locks, the thread shall wait until the request + * can be satisfied. + */ + +# define F_SETFD 2 +# define F_SETLK 6 +# define F_SETLKW 7 + +/** + * @def F_RDLCK + * Read (or shared) lock + */ + +/** + * @def F_WRLCK + * Write (or exclusive) lock + */ + +/** + * @def F_UNLCK + * Remove lock + */ + +# ifndef F_RDLCK +# define F_RDLCK 0 +# define F_WRLCK 1 +# define F_UNLCK 2 +# endif /* ! F_RDLCK */ + +/** + * @struct flock + * @brief A structure that control the lock of a file descriptor. + */ +struct flock +{ + short int l_type; /**< lock type: read, write, ... */ + short int l_whence; /**< type of l_start */ + off_t l_start; /**< starting offset */ + off_t l_len; /**< 0 means end of the file */ + pid_t l_pid; /**< lock owner */ +}; + + +/** + * @brief Provide control over file descriptors. + * + * @param fd The file descriptor. + * @param cmd The type of control. + * @return 0 on success, -1 otherwise. + * + * Performs one of various miscellaneous operations on @p fd. + * The operation in question is determined by @p cmd: + * + * - F_SETFD: Set the close-on-exec flag to the value specified + * by the argument after command (only the least significant + * bit is used). + * - F_SETLK and F_SETLKW: used to manage discretionary file locks. + * The third argument must be a pointer to a struct flock (that + * may be overwritten by this call). + * + * This function returns 0 on success, -1 otherwise. + * + * Conformity: None. + * + * Supported OS: Windows Vista, Windows XP or Windows 2000 + * Professional. + * + * @ingroup Evil + */ +EAPI int fcntl(int fd, int cmd, ...); + + +#endif /* ! __CEGCC__ */ + + +#endif /* __EVIL_FCNTL_H__ */ diff --git a/legacy/evil/src/lib/evil_langinfo.c b/legacy/evil/src/lib/evil_langinfo.c new file mode 100644 index 0000000000..d478b0d028 --- /dev/null +++ b/legacy/evil/src/lib/evil_langinfo.c @@ -0,0 +1,50 @@ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include "Evil.h" + + +#ifndef __CEGCC__ + +static char * +replace(char *prev, char *value) +{ + if (value == NULL) + return prev; + + if (prev) + free (prev); + return strdup (value); +} + +char * +nl_langinfo(nl_item index) +{ + static char *result = NULL; + static char *nothing = ""; + + switch (index) + { + case CODESET: + { + char *p; + result = replace(result, setlocale(LC_CTYPE, NULL)); + if ((p = strrchr(result, '.' )) == NULL) + return nothing; + + if ((++p - result) > 2) + strcpy(result, "cp"); + else + *result = '\0'; + strcat(result, p); + + return result; + } + } + + return nothing; +} + +#endif /* ! __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_langinfo.h b/legacy/evil/src/lib/evil_langinfo.h new file mode 100644 index 0000000000..6cfcaa45a7 --- /dev/null +++ b/legacy/evil/src/lib/evil_langinfo.h @@ -0,0 +1,39 @@ +#ifndef __EVIL_LANGINFO_H__ +#define __EVIL_LANGINFO_H__ + + +#ifndef __CEGCC__ + +#include + + +typedef int nl_item; + +#define __NL_ITEM( CATEGORY, INDEX ) ((CATEGORY << 16) | INDEX) +#define __NL_ITEM_CATEGORY( ITEM ) (ITEM >> 16) +#define __NL_ITEM_INDEX( ITEM ) (ITEM & 0xffff) + +enum { + /* + * LC_CTYPE category... + * Character set classification items. + */ + _NL_CTYPE_CODESET = __NL_ITEM( LC_CTYPE, 0 ), + + /* + * Dummy entry, to terminate the list. + */ + _NL_ITEM_CLASSIFICATION_END +}; + +/* + * Define the public aliases for the enumerated classification indices... + */ +# define CODESET _NL_CTYPE_CODESET + +EAPI char *nl_langinfo(nl_item index); + +#endif /* ! __CEGCC__ */ + + +#endif /*__EVIL_LANGINFO_H__ */ diff --git a/legacy/evil/src/lib/evil_mman.c b/legacy/evil/src/lib/evil_mman.c index b196de435b..313e185c2e 100644 --- a/legacy/evil/src/lib/evil_mman.c +++ b/legacy/evil/src/lib/evil_mman.c @@ -10,8 +10,6 @@ # include #endif /* ! __CEGCC__ */ -#include "Evil.h" - #ifdef HAVE_CONFIG_H # include "config.h" #endif /* HAVE_CONFIG_H */ diff --git a/legacy/evil/src/lib/evil_pwd.c b/legacy/evil/src/lib/evil_pwd.c index 45d7380e60..d8977eda44 100644 --- a/legacy/evil/src/lib/evil_pwd.c +++ b/legacy/evil/src/lib/evil_pwd.c @@ -7,11 +7,11 @@ #include "pwd.h" -static struct passwd pw; - - #ifndef __CEGCC__ + +static struct passwd pw; + struct passwd * getpwuid (uid_t uid) { @@ -39,4 +39,5 @@ getpwuid (uid_t uid) return &pw; } + #endif /* ! __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c index 4d1d136293..84a4c51c4c 100644 --- a/legacy/evil/src/lib/evil_stdlib.c +++ b/legacy/evil/src/lib/evil_stdlib.c @@ -26,7 +26,7 @@ _evil_stdlib_error_display(const char *fct, char *error; error = evil_format_message(res); - fprintf(stderr, "[Evil] [%s] ERROR: %ld\n", fct, error); + fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, error); free(error); } @@ -191,11 +191,11 @@ setenv(const char *name, if (!overwrite && (disposition == REG_OPENED_EXISTING_KEY)) return 0; - if ((res = RegSetValueEx (key, - (LPCWSTR)name, - 0, REG_SZ, - value, - strlen(value) + 1)) != ERROR_SUCCESS) + if ((res = RegSetValueEx(key, + (LPCWSTR)name, + 0, REG_SZ, + (const BYTE *)value, + strlen(value) + 1)) != ERROR_SUCCESS) { _evil_stdlib_error_display("setenv", res); if ((res = RegCloseKey (key)) != ERROR_SUCCESS) @@ -219,7 +219,7 @@ setenv(const char *name, int unsetenv(const char *name) { - setenv(name, NULL, 1); + return setenv(name, NULL, 1); } #endif /* ! __CEGCC__ */ diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c index 866b15aa8e..e6b2238dd7 100644 --- a/legacy/evil/src/lib/evil_unistd.c +++ b/legacy/evil/src/lib/evil_unistd.c @@ -2,10 +2,11 @@ #include #undef WIN32_LEAN_AND_MEAN -#ifdef _MSC_VER -# include +#if defined(_MSC_VER) || \ + (defined(__MINGW32__) && ! defined(__MINGW32CE__)) +# include +# include # include -# include #endif #ifdef HAVE_CONFIG_H @@ -31,6 +32,20 @@ getpid(void) * */ +#if defined(__CEGCC__) || defined(__MINGW32CE__) + +DWORD SHCreateShortcutEx(LPTSTR lpszDir, + LPTSTR lpszTarget, + LPTSTR szShortcut, + LPDWORD lpcbShortcut); + +BOOL SHGetShortcutTarget(LPTSTR szShortcut, + LPTSTR szTarget, + int cbMax ); + +#endif /* __CEGCC__ || __MINGW32CE__ */ + + /* REMARK: Windows has no symbolic link. */ /* Nevertheless, it can create and read .lnk files */ int diff --git a/legacy/evil/src/lib/evil_unistd.h b/legacy/evil/src/lib/evil_unistd.h index c99d5e246d..b1907eeaf1 100644 --- a/legacy/evil/src/lib/evil_unistd.h +++ b/legacy/evil/src/lib/evil_unistd.h @@ -2,13 +2,6 @@ #define __EVIL_UNISTD_H__ -#ifdef _MSC_VER - -typedef int pid_t; - -#endif /* _MSC_VER */ - - /* * Process identifer related functions * diff --git a/legacy/evil/src/lib/evil_util.c b/legacy/evil/src/lib/evil_util.c index 1c53252171..fdd1fac61b 100644 --- a/legacy/evil/src/lib/evil_util.c +++ b/legacy/evil/src/lib/evil_util.c @@ -1,6 +1,7 @@ #include #include #include +#include #define WIN32_LEAN_AND_MEAN #include @@ -84,7 +85,7 @@ evil_format_message(long err) return NULL; snprintf(disp, strlen(str) + strlen("(00000) ") + 1, - "(%5d) %s", err, str); + "(%5ld) %s", err, str); free(str); diff --git a/legacy/evil/src/lib/pwd.h b/legacy/evil/src/lib/pwd.h index cfd211a83b..4a6b832a9a 100644 --- a/legacy/evil/src/lib/pwd.h +++ b/legacy/evil/src/lib/pwd.h @@ -7,28 +7,14 @@ #include -#ifdef EAPI -# undef EAPI -#endif /* EAPI */ - -#ifdef _WIN32 -# ifdef EFL_EVIL_PWD_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif /* ! DLL_EXPORT */ -# else -# define EAPI __declspec(dllimport) -# endif /* ! EFL_EVIL_PWD_BUILD */ -#endif /* _WIN32 */ - - #ifdef __cplusplus extern "C" { #endif +#ifndef __CEGCC__ + + struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* encrypted password */ @@ -46,6 +32,9 @@ struct passwd { EAPI struct passwd * getpwuid (uid_t uid); +#endif /* ! __CEGCC__ */ + + #ifdef __cplusplus } #endif diff --git a/legacy/evil/src/lib/sys/mman.h b/legacy/evil/src/lib/sys/mman.h index 40c0859dcb..885d8a6bc3 100644 --- a/legacy/evil/src/lib/sys/mman.h +++ b/legacy/evil/src/lib/sys/mman.h @@ -1,22 +1,8 @@ #ifndef __EVIL_SYS_MMAN_H__ #define __EVIL_SYS_MMAN_H__ +#include -#ifdef EAPI -# undef EAPI -#endif /* EAPI */ - -#ifdef _WIN32 -# ifdef EFL_EVIL_MMAN_BUILD -# ifdef DLL_EXPORT -# define EAPI __declspec(dllexport) -# else -# define EAPI -# endif /* ! DLL_EXPORT */ -# else -# define EAPI __declspec(dllimport) -# endif /* ! EFL_EVIL_MMAN_BUILD */ -#endif /* _WIN32 */ #ifdef __cplusplus extern "C" { diff --git a/legacy/evil/win32/common/fnmatch.c b/legacy/evil/win32/common/fnmatch.c index 1211fd5391..d8f8b862df 100644 --- a/legacy/evil/win32/common/fnmatch.c +++ b/legacy/evil/win32/common/fnmatch.c @@ -59,12 +59,14 @@ fnmatch_match_class(const char *class, char c) { const size_t complement = fnmatch_complement_class(class + 1); + enum fnmatch_status status; + size_t pos; if (complement == FNM_SYNTAXERR) return FNM_SYNTAXERR; - enum fnmatch_status status = fnmatch_not_found; - size_t pos = 1 + complement; + status = fnmatch_not_found; + pos = 1 + complement; do pos += fnmatch_match_class_token(&status, class + pos, c); @@ -136,11 +138,12 @@ size_t fnmatch_check_finals(const char *pattern, const struct list_of_states *states) { - for (size_t i = 0; i < states->size; ++i) + size_t i, j; + for (i = 0; i < states->size; ++i) { _Bool match = 1; - for (size_t j = states->states[i]; pattern[j]; ++j) + for (j = states->states[i]; pattern[j]; ++j) if (pattern[j] != '*') { match = 0; @@ -158,24 +161,29 @@ fnmatch(const char *pattern, const char *string, int flags) { + struct list_of_states *states; + struct list_of_states *new_states; + _Bool leading = 1; + char* c; + size_t r; + assert(pattern); assert(string); - struct list_of_states *states = - fnmatch_list_of_states_alloc(2, strlen(pattern)); - struct list_of_states *new_states = states + 1; + states = fnmatch_list_of_states_alloc(2, strlen(pattern)); + new_states = states + 1; if (! states) return FNM_NOMEM; fnmatch_init_states(states); - _Bool leading = 1; - for (const char* c = string; *c && states->size; ++c) + for (c = string; *c && states->size; ++c) { + size_t i; fnmatch_list_of_states_clear(new_states); - for (size_t i = 0; i < states->size; ++i) + for (i = 0; i < states->size; ++i) { const size_t pos = states->states[i]; @@ -212,7 +220,7 @@ fnmatch(const char *pattern, leading = *c == '/' && (flags & FNM_PATHNAME); } - const size_t r = fnmatch_check_finals(pattern, states); + r = fnmatch_check_finals(pattern, states); fnmatch_list_of_states_free(states < new_states ? states : new_states, 2); return r; } diff --git a/legacy/evil/win32/common/fnmatch.h b/legacy/evil/win32/common/fnmatch.h index d44a15467e..ec916faf9b 100644 --- a/legacy/evil/win32/common/fnmatch.h +++ b/legacy/evil/win32/common/fnmatch.h @@ -1,5 +1,5 @@ #ifndef _FNMATCH_H -#define _FNMATCH_H +#define _FNMATCH_H #ifdef EVIL_COMMON_API # undef EVIL_COMMON_API @@ -37,7 +37,9 @@ extern "C" { #endif /* Value returned by `fnmatch' if STRING does not match PATTERN. */ -#define FNM_NOMATCH 1 +#define FNM_NOMATCH 1 +#define FNM_SYNTAXERR 2 +#define FNM_NOMEM 3 /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ diff --git a/legacy/evil/win32/common/fnmatch_list_of_states.c b/legacy/evil/win32/common/fnmatch_list_of_states.c index 3400a9b95f..cfb3fa5911 100644 --- a/legacy/evil/win32/common/fnmatch_list_of_states.c +++ b/legacy/evil/win32/common/fnmatch_list_of_states.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "fnmatch_private.h" @@ -16,14 +15,14 @@ fnmatch_list_of_states_alloc(size_t n, size_t pattern_len) const size_t states_has_size = states_size + has_size; const size_t struct_size = sizeof (*l) + states_has_size; - uint8_t *states; - uint8_t *has; + unsigned char *states; + unsigned char *has; size_t i; if (! (l = malloc(n * struct_size))) return 0; - states = (uint8_t *) (l + n); + states = (unsigned char *) (l + n); has = states + states_size; for (i = 0; i < n; ++i) diff --git a/legacy/evil/win32/vs8/evil.sln b/legacy/evil/win32/vs8/evil.sln index 51f2c99233..578246f5a4 100644 --- a/legacy/evil/win32/vs8/evil.sln +++ b/legacy/evil/win32/vs8/evil.sln @@ -4,8 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libevil", "libevil.vcproj", "{689B4F2B-666D-439F-9BF3-1203D813DE3F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdlfcn", "libdlfcn.vcproj", "{2DAB1902-38E3-4F58-8403-C1BC7C077E1F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmman", "libmman.vcproj", "{799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}" + ProjectSection(ProjectDependencies) = postProject + {689B4F2B-666D-439F-9BF3-1203D813DE3F} = {689B4F2B-666D-439F-9BF3-1203D813DE3F} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,10 +22,6 @@ Global {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Debug|Win32.Build.0 = Debug|Win32 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.ActiveCfg = Release|Win32 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.Build.0 = Release|Win32 - {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Debug|Win32.ActiveCfg = Debug|Win32 - {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Debug|Win32.Build.0 = Debug|Win32 - {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Release|Win32.ActiveCfg = Release|Win32 - {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE