From e99a728b7b7c6f7e27d3e08617db768d606581ec Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Fri, 11 Jun 2010 02:04:36 +0200 Subject: [PATCH] Wrap OutputDebugString for Windows CE builds, and add cast for MSVC. --- dbus/dbus-internals.c | 2 +- dbus/dbus-sysdeps-util-win.c | 2 +- dbus/dbus-sysdeps-wince-glue.c | 21 ++++++++++++++++++++- dbus/dbus-sysdeps-wince-glue.h | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 1ab6731..2ed56b3 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -443,7 +443,7 @@ _dbus_verbose_real (const char *format, #endif vsprintf (buf+strlen(buf),format, args); va_end (args); - OutputDebugString(buf); + OutputDebugStringA(buf); } #else #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 6c101e7..2f21409 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -307,7 +307,7 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args sprintf(buf,"%s%s",s,msg); vsprintf(buf,buf,args); - OutputDebugString(buf); + OutputDebugStringA(buf); if (severity == DBUS_SYSTEM_LOG_FATAL) exit (1); diff --git a/dbus/dbus-sysdeps-wince-glue.c b/dbus/dbus-sysdeps-wince-glue.c index 3eaeada..74b1371 100644 --- a/dbus/dbus-sysdeps-wince-glue.c +++ b/dbus/dbus-sysdeps-wince-glue.c @@ -89,7 +89,7 @@ get_verbose_setting() RegCloseKey (key_handle); return NULL; } - if (RegQueryValueExW (key_handle, name, 0, &type, result_w, &nbytes)) + if (RegQueryValueExW (key_handle, name, 0, &type, (LPBYTE) result_w, &nbytes)) { RegCloseKey (key_handle); free (result_w); @@ -1144,3 +1144,22 @@ SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder, lpszPath[MAX_PATH - 1] = '\0'; return result; } + + +void +OutputDebugStringA (LPCSTR lpOutputString) +{ + wchar_t *str; + HANDLE result; + int err; + + str = _dbus_win_utf8_to_utf16 (lpOutputString, NULL); + if (!str) + return; + + OutputDebugStringW (str); + + err = GetLastError (); + dbus_free (str); + SetLastError (err); +} diff --git a/dbus/dbus-sysdeps-wince-glue.h b/dbus/dbus-sysdeps-wince-glue.h index 7a6462b..f5ac6c8 100644 --- a/dbus/dbus-sysdeps-wince-glue.h +++ b/dbus/dbus-sysdeps-wince-glue.h @@ -237,6 +237,10 @@ DWORD GetTempPathA(DWORD,LPSTR); BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); +#define OutputDebugStringA _dbus_wince_OutputDebugStringA +void OutputDebugStringA(LPCSTR); + + DBUS_END_DECLS #endif /* DBUS_SYSDEPS_WINCE_GLUE_H */ -- 1.7.0.4