pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christian Ullrich <chris@chrullrich.net>
To: Andrew Dunstan <andrew@dunslane.net>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Petr Jelinek <petr@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: VS 2015 support in src/tools/msvc
Date: Fri, 8 Apr 2016 18:46:44 +0200
Message-ID: <5707E074.4030102@chrullrich.net> (raw)
In-Reply-To: <5707D7DC.2030508@dunslane.net>
References: <CAB7nPqTTcRGbDxS_RA4CWn1B_KRsvN+FTpct0mTp3v3gRWQ70g@mail.gmail.com>
	<CA+TgmobzFi-AZ+OxFOxG=AjUs=dWw3Vjt-dH4NKXiJ1jEXmAeA@mail.gmail.com>
	<CAB7nPqTEkqF7E7nWcdQSvyOUAV3OGjX=rKSxFTkk03TOJGF5ng@mail.gmail.com>
	<56F53382.3060508@dunslane.net>
	<CAB7nPqSkMU3F2jV5S6tULnUpJMub-Pqc1t0H=MjOTJZFdw3jDg@mail.gmail.com>
	<CA+TgmoZ1gKfVB2r=nr5zPp9eDbzFcnauvW_awwz1xmJF_RJmBQ@mail.gmail.com>
	<56FA9FDF.20108@2ndquadrant.com>
	<CA+TgmoaRAhFtVuMfrAn9R4aeib0azhj3jb+RC9aQ2z-JTYJsag@mail.gmail.com>
	<CAB7nPqRHbMZ5eW+AcwxgkfoU1odh75osFLJKrKkQn2N1gbiceQ@mail.gmail.com>
	<56FB2BF8.3060303@dunslane.net>
	<CA+TgmoakpqU5uXDTkfaCHesFeW8N_aH5w-e991BfxkcREo7-mg@mail.gmail.com>
	<5705768E.4020908@dunslane.net>
	<5706FB7E.5070703@dunslane.net>
	<CAB7nPqR4QHFRZ1vjMo9Njy49hDAXOAjO+AEGhuCDzmhQJRagAw@mail.gmail.com>
	<570792ED.2080003@chrullrich.net>
	<5707AC9E.7070309@dunslane.net>
	<CAB7nPqROXyB_=-BbAXGnCdHFYUE4_+qgQAGk1swwnVQSfiab9Q@mail.gmail.com>
	<5707C80F.9050709@chrullrich.net>
	<5707D7DC.2030508@dunslane.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (134+ messages)  latest in thread

Message-ID: <5707E074.4030102@chrullrich.net>
Permalink:  ../5707E074.4030102@chrullrich.net/
Also on:    postgresql.org/message-id/5707E074.4030102@chrullrich.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: chris@chrullrich.net, andrew@dunslane.net, michael.paquier@gmail.com, robertmhaas@gmail.com, petr@2ndquadrant.com, tgl@sss.pgh.pa.us, magnus@hagander.net
  Subject: Re: VS 2015 support in src/tools/msvc
  In-Reply-To: <5707E074.4030102@chrullrich.net>
  References: <CAB7nPqTTcRGbDxS_RA4CWn1B_KRsvN+FTpct0mTp3v3gRWQ70g@mail.gmail.com> <CAB7nPqTEkqF7E7nWcdQSvyOUAV3OGjX=rKSxFTkk03TOJGF5ng@mail.gmail.com> <56F53382.3060508@dunslane.net> <CAB7nPqSkMU3F2jV5S6tULnUpJMub-Pqc1t0H=MjOTJZFdw3jDg@mail.gmail.com> <CA+TgmoZ1gKfVB2r=nr5zPp9eDbzFcnauvW_awwz1xmJF_RJmBQ@mail.gmail.com> <56FA9FDF.20108@2ndquadrant.com> <CA+TgmoaRAhFtVuMfrAn9R4aeib0azhj3jb+RC9aQ2z-JTYJsag@mail.gmail.com> <CAB7nPqRHbMZ5eW+AcwxgkfoU1odh75osFLJKrKkQn2N1gbiceQ@mail.gmail.com> <56FB2BF8.3060303@dunslane.net> <CA+TgmoakpqU5uXDTkfaCHesFeW8N_aH5w-e991BfxkcREo7-mg@mail.gmail.com> <5705768E.4020908@dunslane.net> <5706FB7E.5070703@dunslane.net> <CAB7nPqR4QHFRZ1vjMo9Njy49hDAXOAjO+AEGhuCDzmhQJRagAw@mail.gmail.com> <570792ED.2080003@chrullrich.net> <5707AC9E.7070309@dunslane.net> <CAB7nPqROXyB_=-BbAXGnCdHFYUE4_+qgQAGk1swwnVQSfiab9Q@mail.gmail.com> <5707C80F.9050709@chrullrich.net> <5707D7DC.2030508@dunslane.net> <5707E074.4030102@chrullrich.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox