Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : proto/evil

Dir     : e17/proto/evil/src/lib/dlfcn


Modified Files:
        Makefile.am dlfcn.c 


Log Message:
reviewed by: <delete if not using a buddy>
* src/lib/Evil.h:
* src/lib/Makefile.am:
* src/lib/dlfcn/Makefile.am:
* src/lib/dlfcn/dlfcn.c: (get_last_error), (dlopen), (dlsym):
* src/lib/evil.c: (evil_char_to_wchar), (evil_wchar_to_char):
* src/lib/mman/Makefile.am:
* src/lib/mman/mman.c:

===================================================================
RCS file: /cvs/e/e17/proto/evil/src/lib/dlfcn/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- Makefile.am 22 Apr 2008 22:53:54 -0000      1.2
+++ Makefile.am 26 Apr 2008 16:27:46 -0000      1.3
@@ -6,4 +6,7 @@
 include_HEADERS = dlfcn.h
 libdl_la_SOURCES = dlfcn.c
 
+libdl_la_CFLAGS = @win32_cflags@
+libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la
+libdl_la_DEPENDENCIES = $(top_builddir)/src/lib/libevil.la
 libdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info 
@version_info@
===================================================================
RCS file: /cvs/e/e17/proto/evil/src/lib/dlfcn/dlfcn.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- dlfcn.c     22 Apr 2008 22:53:54 -0000      1.5
+++ dlfcn.c     26 Apr 2008 16:27:46 -0000      1.6
@@ -5,14 +5,17 @@
 #undef WIN32_LEAN_AND_MEAN
 
 #if defined(__CEGCC__) || defined(__MINGW32CE__)
-# include <wchar.h>
 # include <limits.h>
 #endif /* __MINGW32CE__ */
 
+#include "../Evil.h"
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#include "dlfcn.h"
+
 #if HAVE___ATTRIBUTE__
 # define __UNUSED__ __attribute__((unused))
 #else
@@ -23,52 +26,6 @@
 static char *dl_err = NULL;
 static int dl_err_viewed = 0;
 
-#if defined(__CEGCC__) || defined(__MINGW32CE__)
-
-static wchar_t *
-string_to_wchar(const char *text)
-{
-   wchar_t *wtext;
-   int      wsize;
-
-   wsize = MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, NULL, 0);
-   if ((wsize == 0) ||
-       (wsize > (int)(ULONG_MAX/sizeof(wchar_t))))
-     return NULL;
-
-   wtext = malloc(wsize * sizeof(wchar_t));
-   if (wtext)
-     if (!MultiByteToWideChar(CP_ACP, 0, text, strlen(text) + 1, wtext, wsize))
-       return NULL;
-
-   return wtext;
-}
-
-static char *
-wchar_to_string(const wchar_t *text)
-{
-   char * atext;
-   int    size;
-   int    asize;
-
-   size = wcslen(text) + 1;
-
-   asize = WideCharToMultiByte(CP_ACP, 0, text, size, NULL, 0, NULL, NULL);
-   if (asize == 0)
-     return NULL;
-
-   atext = (char*)malloc((asize + 1) * sizeof(char));
-
-   if (atext)
-     if (!WideCharToMultiByte(CP_ACP, 0, text, size, atext, asize, NULL, NULL))
-       return NULL;
-   atext[asize] = '\0';
-
-   return atext;
-}
-
-#endif /* __CEGCC__ || __MINGW32CE__ */
-
 static void
 get_last_error(char *desc)
 {
@@ -85,7 +42,7 @@
                  (LPTSTR)&str, 0, NULL);
 
 #if defined(__CEGCC__) || defined(__MINGW32CE__)
-   str2 = wchar_to_string(str);
+   str2 = evil_wchar_to_char(str);
 #else
    str2 = str;
 #endif /* ! __CEGCC__ && ! __MINGW32CE__ */
@@ -148,7 +105,7 @@
         {
            wchar_t *wpath;
 
-           wpath = string_to_wchar(new_path);
+           wpath = evil_char_to_wchar(new_path);
            module = LoadLibrary(wpath);
            free(wpath);
         }
@@ -186,7 +143,7 @@
    {
       wchar_t *wsymbol;
 
-      wsymbol = string_to_wchar(symbol);
+      wsymbol = evil_char_to_wchar(symbol);
       fp = GetProcAddress(handle, wsymbol);
       free(wsymbol);
    }



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to