Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf3401f

Browse files
committed
Harmonize MinGW CODESET lookup with MSVC.
Historically, MinGW environments lacked some Windows API calls, so wetook a different code path in win32_langinfo(). Somehow, the codechange in commit35eeea6 (removing setlocale() calls) caused oneparticular 001_initdb.pl test to fail on MinGW + ICU builds, becausepg_import_system_collations() found no collations. It might take aMinGW user to discover the exact reason.Updating that function to use the same code as MSVC seems to fix thattest, so lets do that. (There are plenty more places that test for MSVCunnecessarily, to be investigated later.)While here, also rename the helper function win32_langinfo() towin32_get_codeset(), to explain what it does less confusingly; it's notreally a general langinfo() substitute.Noticed by triggering the optional MinGW CI task; no build farm animalsfailed.Discussion:https://postgr.es/m/CA%2BhUKGKBWfhXQ3J%2B2Lj5PhKvQnGD%3DsywA0XQcb7boTCf%3DerVLg%40mail.gmail.com
1 parent4c1b4cd commitbf3401f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎src/port/chklocale.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static const struct encoding_match encoding_match_list[] = {
193193

194194
#ifdefWIN32
195195
/*
196-
* On Windows, use CP<code page number> instead ofthe nl_langinfo() result
196+
* On Windows, use CP<code page number> instead ofCODESET.
197197
*
198198
* This routine uses GetLocaleInfoEx() to parse short locale names like
199199
* "de-DE", "fr-FR", etc. If those cannot be parsed correctly process falls
@@ -203,12 +203,10 @@ static const struct encoding_match encoding_match_list[] = {
203203
* Returns a malloc()'d string for the caller to free.
204204
*/
205205
staticchar*
206-
win32_langinfo(constchar*ctype)
206+
win32_get_codeset(constchar*ctype)
207207
{
208208
char*r=NULL;
209209
char*codepage;
210-
211-
#if defined(_MSC_VER)
212210
uint32cp;
213211
WCHARwctype[LOCALE_NAME_MAX_LENGTH];
214212

@@ -233,7 +231,6 @@ win32_langinfo(const char *ctype)
233231
}
234232
}
235233
else
236-
#endif
237234
{
238235
/*
239236
* Locale format on Win32 is <Language>_<Country>.<CodePage>. For
@@ -336,7 +333,7 @@ pg_get_encoding_from_locale(const char *ctype, bool write_message)
336333

337334
freelocale(loc);
338335
#else
339-
sys=win32_langinfo(ctype);
336+
sys=win32_get_codeset(ctype);
340337
#endif
341338

342339
if (!sys)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp