From 965125550937ce450c74effa9c13262db3adf48b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 23 Jun 2012 15:44:42 +0300 Subject: [PATCH] Fix a bug in w32-get-locale-info. src/w32proc.c (Fw32_get_locale_info): Fix an off-by-one error in last argument of make_unibyte_string. --- src/ChangeLog | 3 +++ src/w32proc.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index a01a93f86e9..b23e92057b0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-06-23 Eli Zaretskii + * w32proc.c (Fw32_get_locale_info): Fix an off-by-one error in + last argument of make_unibyte_string. + * keyboard.c (kbd_buffer_get_event): Include the codepage and the language ID in the event parameters. diff --git a/src/w32proc.c b/src/w32proc.c index 55b9ee1ec0e..2f5f39e68b3 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1949,8 +1949,12 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil. */) got_full = GetLocaleInfo (XINT (lcid), XINT (longform), full_name, sizeof (full_name)); + /* GetLocaleInfo's return value includes the terminating null + character, when the returned information is a string, whereas + make_unibyte_string needs the string length without the + terminating null. */ if (got_full) - return make_unibyte_string (full_name, got_full); + return make_unibyte_string (full_name, got_full - 1); } return Qnil; -- 2.39.2