diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 4f858b86a6..b1d52d0363 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,16 @@ +2008-09-28 Vincent Torri + + * configure.ac: + * src/bin/Makefile.am: + * src/bin/test_memcpy.c: + compile memcpy_glibc.S only if cegcc or mingw32ce is used + + * src/bin/test_pipe.c: + use evil_sockets_init and evil_sockets_shutdown. + + * src/lib/evil_unistd.c: + formatting + 2008-09-15 Vincent Torri * Makefile.am: diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index 24dbb2c890..6246327ff0 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -8,6 +8,7 @@ AC_CANONICAL_HOST dnl If the host is not windows, we exit, dnl otherwise, we set the correct flags dnl for each platform. +have_wince="no" win32_libs="" win32_cflags="" case "$host_os" in @@ -15,10 +16,12 @@ case "$host_os" in win32_libs="-lole32 -luuid -lws2_32" ;; cegcc) + have_wince="yes" win32_cflags="-mwin32" win32_libs="-lws2" ;; mingw32ce) + have_wince="yes" win32_libs="-lws2" ;; *) @@ -28,6 +31,12 @@ esac AC_SUBST(win32_cflags) AC_SUBST(win32_libs) +if test "x${have_wince}" = "xyes" ; then + AC_DEFINE(EVIL_HAVE_WINCE, 1, [Define to mention that Windows CE is the target]) +fi + +AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes") + dnl needed for correct definition of EAPI AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil dlfcn is built]) diff --git a/legacy/evil/src/bin/Makefile.am b/legacy/evil/src/bin/Makefile.am index 4b5c063db3..98a3b877eb 100644 --- a/legacy/evil/src/bin/Makefile.am +++ b/legacy/evil/src/bin/Makefile.am @@ -11,7 +11,14 @@ AM_CFLAGS = @win32_cflags@ bin_PROGRAMS = suite test_dlfcn test_pipe test_evil -suite_SOURCES = suite.c test_memcpy.c memcpy_glibc.S +suite_SOURCES = suite.c test_memcpy.c + +if EVIL_HAVE_WINCE + +suite_SOURCES += memcpy_glibc.S + +endif + suite_LDADD = $(top_builddir)/src/lib/libevil.la suite_LDFLAGS = -Wl,--enable-auto-import suite_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la diff --git a/legacy/evil/src/bin/test_memcpy.c b/legacy/evil/src/bin/test_memcpy.c index ea2bcacba0..1a91f5dc40 100644 --- a/legacy/evil/src/bin/test_memcpy.c +++ b/legacy/evil/src/bin/test_memcpy.c @@ -7,6 +7,10 @@ #include #undef WIN32_LEAN_AND_MEAN +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + #include "suite.h" #include "test_memcpy.h" @@ -70,7 +74,9 @@ test_memcpy_tests_run(size_t align1, size_t align2, size_t len) printf ("length: %6d, align %2d/%2d:", (int)len, align1, align2); test_memcpy_test_run(memcpy, s2, s1, len); +#ifdef EVIL_HAVE_WINCE test_memcpy_test_run(memcpy_glibc, s2, s1, len); +#endif /* EVIL_HAVE_WINCE */ printf ("\n"); } diff --git a/legacy/evil/src/bin/test_pipe.c b/legacy/evil/src/bin/test_pipe.c index 6f5d49d6b4..9ac8c3821d 100644 --- a/legacy/evil/src/bin/test_pipe.c +++ b/legacy/evil/src/bin/test_pipe.c @@ -1,9 +1,10 @@ +#include +#include + # define WIN32_LEAN_AND_MEAN # include # undef WIN32_LEAN_AND_MEAN -#include - #include "Evil.h" #define FDREAD 0 @@ -34,7 +35,6 @@ int main (int argc, char *argv[]) { int sockets[2]; - WSADATA version_data; int ret; fd_set rfds; struct timeval t; @@ -42,25 +42,28 @@ main (int argc, char *argv[]) DWORD thread_id; HANDLE h; + if (!evil_sockets_init()) + return EXIT_FAILURE; + FD_ZERO(&rfds); t.tv_sec = 5; t.tv_usec = 0; - WSAStartup(MAKEWORD(2, 2), &version_data); - if (pipe(sockets) < 0) { - printf ("error\n"); - return -1; + printf ("can not create sockets\n"); + evil_sockets_shutdown(); + return EXIT_FAILURE; } + FD_SET(sockets[FDREAD], &rfds); d = (data *)malloc(sizeof (data)); d->val = 14; d->fd_write = sockets[FDWRITE]; printf (" pointeur sent........: %p\n", d); - h = CreateThread (NULL, 0, thread, d, 0, &thread_id); + h = CreateThread(NULL, 0, thread, d, 0, &thread_id); ret = select(sockets[FDREAD] + 1, &rfds, NULL, NULL, &t); @@ -91,5 +94,7 @@ main (int argc, char *argv[]) CloseHandle (h); - return 0; + evil_sockets_shutdown(); + + return EXIT_SUCCESS; } diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c index e6b2238dd7..d6f7ca9b06 100644 --- a/legacy/evil/src/lib/evil_unistd.c +++ b/legacy/evil/src/lib/evil_unistd.c @@ -74,9 +74,9 @@ symlink(const char *oldpath, const char *newpath) return res ? 0 : -1; #else -#ifdef UNICODE +# ifdef UNICODE wchar_t new_path[MB_CUR_MAX]; -#endif /* UNICODE */ +# endif /* UNICODE */ IShellLink *pISL; IShellLink **shell_link; IPersistFile *pIPF; @@ -108,14 +108,14 @@ symlink(const char *oldpath, const char *newpath) if (FAILED(pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void **)persit_file))) goto no_queryinterface; -#ifdef UNICODE +# ifdef UNICODE mbstowcs(new_path, newpath, MB_CUR_MAX); if (FAILED(pIPF->lpVtbl->Save(pIPF, new_path, FALSE))) goto no_save; -#else +# else if (FAILED(pIPF->lpVtbl->Save(pIPF, newpath, FALSE))) goto no_save; -#endif /* ! UNICODE */ +# endif /* ! UNICODE */ pIPF->lpVtbl->Release(pIPF); pISL->lpVtbl->Release(pISL); @@ -169,9 +169,9 @@ readlink(const char *path, char *buf, size_t bufsiz) return length; #else -#ifdef UNICODE +# ifdef UNICODE wchar_t old_path[MB_CUR_MAX]; -#endif /* UNICODE */ +# endif /* UNICODE */ char new_path[PATH_MAX]; IShellLink *pISL; IShellLink **shell_link; @@ -197,14 +197,14 @@ readlink(const char *path, char *buf, size_t bufsiz) (void **)persit_file))) goto no_instance; -#ifdef UNICODE +# ifdef UNICODE mbstowcs(old_path, path, MB_CUR_MAX); if (FAILED(pIPF->lpVtbl->Load(pIPF, old_path, STGM_READWRITE))) goto no_load; -#else +# else if (FAILED(pIPF->lpVtbl->Load(pIPF, path, STGM_READWRITE))) goto no_load; -#endif /* ! UNICODE */ +# endif /* ! UNICODE */ shell_link = &pISL; if (FAILED(pIPF->lpVtbl->QueryInterface(pIPF, &IID_IShellLink, (void **)shell_link))) @@ -297,7 +297,7 @@ evil_sockets_init(void) { WSADATA wsa_data; - return (WSAStartup(MAKEWORD( 2, 2 ), &wsa_data) == 0) ? 1 : 0; + return (WSAStartup(MAKEWORD(2, 2), &wsa_data) == 0) ? 1 : 0; } void