From 819e2da92a18d7af03ccd9cf0a2e5b940eb7b54f Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 10 Mar 2013 14:55:25 -0800 Subject: 2013-03-10 Daniel Colascione * w32term.h (GUISTR, GUI_ENCODE_FILE, GUI_ENCODE_SYSTEM, GUI_FN) (GUI_SDATA, guichar_t): Macros to abstract out differences between NTGUI_UNICODE and !NTGUI_UNICODE builds, some moved out of w32fns.c. * w32term.c (construct_drag_n_drop): Use the above macros to make drag-and-drop work for non-ASCII filenames in cygw32 builds. * w32fns.c (x_set_name, x_set_title): Use the above macros to properly display non-ASCII frame titles in cygw32 builds. * w32fns.c (Fw32_shell_execute): Use the above macros to properly call ShellExecute in cygw32 builds. * w32fn.c (Fx_file_dialog): Use the above macros to simplify the common file dialog code. * w32fns.c (Ffile_system_info): Remove from cygw32 builds, which can just use du like other systems. * coding.c (from_unicode_buffer): Declare. * coding.c (from_unicode_buffer): Implement. --- src/coding.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index d6560a92b70..c18632f301b 100644 --- a/src/coding.c +++ b/src/coding.c @@ -286,6 +286,10 @@ encode_coding_XXX (struct coding_system *coding) #include #include +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ + #include "lisp.h" #include "character.h" #include "buffer.h" @@ -8003,6 +8007,16 @@ from_unicode (Lisp_Object str) return code_convert_string_norecord (str, Qutf_16le, 0); } +Lisp_Object +from_unicode_buffer (const wchar_t* wstr) +{ + return from_unicode ( + make_unibyte_string ( + (char*) wstr, + /* we get one of the two final 0 bytes for free. */ + 1 + sizeof (wchar_t) * wcslen (wstr))); +} + wchar_t * to_unicode (Lisp_Object str, Lisp_Object *buf) { -- cgit v1.2.1