pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Christian Ullrich <chris@chrullrich.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: Sun, 10 Apr 2016 10:58:28 -0400
Message-ID: <570A6A14.6040303@dunslane.net> (raw)
In-Reply-To: <0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net>
References: <CAB7nPqTTcRGbDxS_RA4CWn1B_KRsvN+FTpct0mTp3v3gRWQ70g@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>
	<CAB7nPqSYAxCX+p0D0Qpqv6D4uLb2fmGcpUeKRxMyom5cAziuzg@mail.gmail.com>
	<CAB7nPqSOPynjV7ZC9wghkvwTpDPj7U=py7AoczzguTmv1kmh+g@mail.gmail.com>
	<0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>



On 04/09/2016 08:43 AM, Christian Ullrich wrote:
>> Michael Paquier wrote:
>>
>> On Sat, Apr 9, 2016 at 7:41 AM, Michael Paquier
>> <michael.paquier@gmail.com> wrote:
>>> On Sat, Apr 9, 2016 at 1:46 AM, Christian Ullrich <chris@chrullrich.net> wrote:
>>>> * 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);
>> I don't think that's good to use malloc in those code paths, and I
>> think that we cannot use palloc as well for a buffer passed directly
>> into this function, so it looks that we had better use a fix-sized
>> buffer and allocate the output into that. What would be a a correct
>> estimation of the maximum size we should allow? 80 (similar to
>> pg_locale.c)?
> I think it should not take more than 16 characters, but if you want to make sure the code can deal with long names as well, MSDN gives an upper limit of 85 for those somewhere.
>


I don't think we need to be too precious about saving a byte or two 
here. Can one or other of you please prepare a replacement patch based 
in this discussion?

cheers

andrew



-- 
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: <570A6A14.6040303@dunslane.net>
Permalink:  ../570A6A14.6040303@dunslane.net/
Also on:    postgresql.org/message-id/570A6A14.6040303@dunslane.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: andrew@dunslane.net, chris@chrullrich.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: <570A6A14.6040303@dunslane.net>
  References: <CAB7nPqTTcRGbDxS_RA4CWn1B_KRsvN+FTpct0mTp3v3gRWQ70g@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> <CAB7nPqSYAxCX+p0D0Qpqv6D4uLb2fmGcpUeKRxMyom5cAziuzg@mail.gmail.com> <CAB7nPqSOPynjV7ZC9wghkvwTpDPj7U=py7AoczzguTmv1kmh+g@mail.gmail.com> <0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net> <570A6A14.6040303@dunslane.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