Enlightenment CVS committal Author : doursse Project : e17 Module : proto/evil
Dir : e17/proto/evil/src/lib Modified Files: Evil.h evil.c Makefile.am 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/Evil.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- Evil.h 7 Jun 2008 06:38:54 -0000 1.15 +++ Evil.h 8 Jun 2008 21:39:49 -0000 1.16 @@ -517,7 +517,7 @@ */ EAPI char *evil_getcwd(char *buffer, size_t size); -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE /** * @brief Convert a string from char * to wchar_t *. @@ -557,7 +557,9 @@ */ EAPI char *evil_wchar_to_char(const wchar_t *text); -#endif /* __CEGCC__ || __MINGW32CE__ */ +#endif /* UNICODE */ + +EAPI char *evil_last_error_get(void); #ifdef __cplusplus =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/evil.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- evil.c 2 Jun 2008 04:53:41 -0000 1.10 +++ evil.c 8 Jun 2008 21:39:49 -0000 1.11 @@ -15,9 +15,9 @@ # include <sys/syslimits.h> #endif /* __CEGCC__ */ -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE # include <wchar.h> -#endif /* __CEGCC__ || __MINGW32CE__ */ +#endif /* UNICODE */ #include <sys/types.h> #include <sys/timeb.h> @@ -497,7 +497,7 @@ #endif /* ! __CEGCC__ && ! __MINGW32CE__ */ } -#if defined(__CEGCC__) || defined(__MINGW32CE__) +#ifdef UNICODE wchar_t * evil_char_to_wchar(const char *text) @@ -541,4 +541,34 @@ return atext; } -#endif /* __CEGCC__ || __MINGW32CE__ */ +#endif /* UNICODE */ + +char * +evil_last_error_get(void) +{ + char str[PATH_MAX]; + LPTSTR str1; + char *str2; + DWORD err; + + err = GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + 0, // Default language + (LPTSTR)&str1, + 0, + NULL); + +#ifdef UNICODE + str2 = evil_wchar_to_char(str1); + LocalFree(str1); +#else + str2 = str1; +#endif /* ! UNICODE */ + + snprintf(str, PATH_MAX, "(%ld) %s", err, str2); + LocalFree(str2); + + return strdup(str); +} =================================================================== RCS file: /cvs/e/e17/proto/evil/src/lib/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- Makefile.am 26 Apr 2008 16:27:46 -0000 1.3 +++ Makefile.am 8 Jun 2008 21:39:49 -0000 1.4 @@ -12,4 +12,3 @@ libevil_la_LIBADD = @win32_libs@ libevil_la_DEPENDENCIES = $(top_builddir)/config.h libevil_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ - ------------------------------------------------------------------------- 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