Enlightenment CVS committal Author : doursse Project : e17 Module : proto/evil
Dir : e17/proto/evil/src/lib/dlfcn Modified Files: dlfcn.c Log Message: * src/lib/Evil.h: * src/lib/evil.c: (evil_last_error_get): add evil_last_error_get() function to get useful error string creation. * src/lib/dlfcn/dlfcn.c: (get_last_error), (dlopen), (dlsym), (dladdr): use UNICODE check instead of compiler checks when needed. use evil_last_error_get() * src/lib/mman/mman.c: (mmap), (munmap): file mapping does not work on Windows CE < 5.0. if it is the case, just read the file and return the data. use evil_last_error_get() * src/lib/mman/Makefile.am: * src/lib/Makefile.am: add libevil dependancy =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/dlfcn/dlfcn.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- dlfcn.c 7 Jun 2008 06:38:54 -0000 1.11 +++ dlfcn.c 8 Jun 2008 21:39:49 -0000 1.12 @@ -25,27 +25,14 @@ static void get_last_error(char *desc) { - TCHAR *str; - char *str2; + char *str; int l1; int l2; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&str, 0, NULL); - -#if defined(__CEGCC__) || defined(__MINGW32CE__) - str2 = evil_wchar_to_char(str); - LocalFree(str); -#else - str2 = str; -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ + str = evil_last_error_get(); l1 = strlen(desc); - l2 = strlen(str2); + l2 = strlen(str); if (dl_err) free(dl_err); @@ -56,10 +43,10 @@ else { memcpy(dl_err, desc, l1); - memcpy(dl_err + l1, str2, l2); + memcpy(dl_err + l1, str, l2); dl_err[l1 + l2] = '\0'; } - LocalFree(str2); + free(str); dl_err_viewed = 0; } @@ -98,7 +85,7 @@ else new_path[i] = path[i]; } -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE { wchar_t *wpath; @@ -109,7 +96,7 @@ #else module = LoadLibraryEx(new_path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ +#endif /* ! UNICODE */ if (!module) get_last_error("LoadLibraryEx returned: "); @@ -136,7 +123,7 @@ { FARPROC fp; -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE { wchar_t *wsymbol; @@ -146,7 +133,7 @@ } #else fp = GetProcAddress(handle, symbol); -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ +#endif /* ! UNICODE */ if (!fp) get_last_error("GetProcAddress returned: "); @@ -169,11 +156,11 @@ if (!ret) return 0; -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE path = evil_wchar_to_char(tpath); #else path = tpath; -#endif /* ! __CEGCC__ && ! __MINGW32CE__ */ +#endif /* ! UNICODE */ length = strlen (path); if (length >= PATH_MAX) @@ -195,9 +182,9 @@ info->dli_sname = NULL; info->dli_saddr = NULL; -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE free (path); -#endif /* __CEGCC__ || __MINGW32CE__ */ +#endif /* ! UNICODE */ return 1; } ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs