* dln.c (dln_strerror): get English message first, instead of

system default. see [ruby-dev:42358].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-10-15 23:39:16 +00:00
parent d2623b2281
commit 92a7cf0455
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Sat Oct 16 08:39:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (dln_strerror): get English message first, instead of
system default. see [ruby-dev:42358].
Sat Oct 16 00:08:00 2010 Koichi Sasada <ko1@atdot.net>
* hash.c (rb_hash_aref): skip calling "default" method

10
dln.c
View File

@ -1127,10 +1127,12 @@ dln_strerror(char *message, size_t size)
char *p = message;
size_t len = snprintf(message, size, "%d: ", error);
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
message + len, size - len, NULL);
#define format_message(sublang) FormatMessage(\
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, \
NULL, error, MAKELANGID(LANG_NEUTRAL, sublang), \
message + len, size - len, NULL)
if (format_message(SUBLANG_ENGLISH_US) == 0)
format_message(SUBLANG_DEFAULT);
for (p = message + len; *p; p++) {
if (*p == '\n' || *p == '\r')
*p = ' ';