Re: VS 2015 support in src/tools/msvc

Поиск
Список
Период
Сортировка
От Christian Ullrich
Тема Re: VS 2015 support in src/tools/msvc
Дата
Msg-id 5707E074.4030102@chrullrich.net
обсуждение исходный текст
Ответ на Re: VS 2015 support in src/tools/msvc  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: VS 2015 support in src/tools/msvc  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
* Andrew Dunstan wrote:

> On 04/08/2016 11:02 AM, Christian Ullrich wrote:

>>   src/port/chklocale.c(233): warning C4133: 'function': incompatible
>>   types - from 'const char *' to 'LPCWSTR' [...\postgres.vcxproj]

> Do you have a fix for the LPCWSTR parameter issue?

As long as the locale short name cannot contain characters outside of 
ASCII, and I don't see how it could, just the typical 
measure-allocate-convert dance, add error handling to taste:

int res = MultiByteToWideChar(CP_ACP, 0, ctype, -1, NULL, 0);
WCHAR *wctype = malloc(res * sizeof(WCHAR));
memset(wctype, 0, res * sizeof(WCHAR));
res = MultiByteToWideChar(CP_ACP, 0, ctype, -1, wctype, wctypelen);

If it is somehow guaranteed that ctype is only the most basic short name 
("xx-YY") with no code pages or anything, it becomes much simpler, of 
course, and I would just use a loop.

If the locale name can contain characters above 0x7f, we'd have to know 
the code page of the string we use to get the code page.

-- 
Christian




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Lower msvc build verbosity level
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Choosing parallel_degree