From e347c1dd475ab83b2ec483f43879b105be145ea2 Mon Sep 17 00:00:00 2001 From: Spencer Low Date: Sun, 2 Aug 2015 18:13:54 -0700 Subject: adb: win32: define UNICODE/_UNICODE, Unicode error messages, misc Define the UNICODE and _UNICODE preprocessor symbols to make passing char* to Ansi/Unicode-agnostic Windows and C Runtime APIs break the build. The solution is to call wide Windows and C Runtime APIs and use widen(utf8).c_str(). Most code was already calling wide APIs. Defining these symbols makes a call to CreateEvent() (which previously mapped to CreateEventA()) turn into a call to CreateEventW(). Make SystemErrorCodeToString() use Unicode. Add various comments. Change-Id: I9b212412348a29826718e897a486489e1f142d16 Signed-off-by: Spencer Low --- adb/Android.mk | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'adb/Android.mk') diff --git a/adb/Android.mk b/adb/Android.mk index ec7f49c85..e911bc334 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -22,6 +22,15 @@ ADB_COMMON_CFLAGS := \ -Wno-missing-field-initializers \ -DADB_REVISION='"$(adb_version)"' \ +# Define windows.h and tchar.h Unicode preprocessor symbols so that +# CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the +# build if you accidentally pass char*. Fix by calling like: +# CreateFileW(widen(utf8).c_str()). +ADB_COMMON_windows_CFLAGS := \ + -DUNICODE=1 -D_UNICODE=1 \ + +ADB_COMMON_CFLAGS += $(ADB_COMMON_$(HOST_OS)_CFLAGS) + # libadb # ========================================================= -- cgit v1.2.3