Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apGp4-0001Hq-Ta for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Apr 2016 14:58:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1apGp4-00020g-5o for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Apr 2016 14:58:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apGp2-0001zv-Rs for pgsql-hackers@postgresql.org; Sun, 10 Apr 2016 14:58:45 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apGou-00087k-Ud for pgsql-hackers@postgresql.org; Sun, 10 Apr 2016 14:58:42 +0000 Received: from mfilter24-d.gandi.net (mfilter24-d.gandi.net [217.70.178.152]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 6B1BEFB88B; Sun, 10 Apr 2016 16:58:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter24-d.gandi.net Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter24-d.gandi.net (mfilter24-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id trL0sBdmEJkv; Sun, 10 Apr 2016 16:58:31 +0200 (CEST) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 357BCFB886; Sun, 10 Apr 2016 16:58:30 +0200 (CEST) Subject: Re: VS 2015 support in src/tools/msvc To: Christian Ullrich , Michael Paquier References: <56FA9FDF.20108@2ndquadrant.com> <56FB2BF8.3060303@dunslane.net> <5705768E.4020908@dunslane.net> <5706FB7E.5070703@dunslane.net> <570792ED.2080003@chrullrich.net> <5707AC9E.7070309@dunslane.net> <5707C80F.9050709@chrullrich.net> <5707D7DC.2030508@dunslane.net> <5707E074.4030102@chrullrich.net> <0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net> Cc: Robert Haas , Petr Jelinek , Tom Lane , Magnus Hagander , PostgreSQL mailing lists From: Andrew Dunstan Message-ID: <570A6A14.6040303@dunslane.net> Date: Sun, 10 Apr 2016 10:58:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 04/09/2016 08:43 AM, Christian Ullrich wrote: >> Michael Paquier wrote: >> >> On Sat, Apr 9, 2016 at 7:41 AM, Michael Paquier >> wrote: >>> On Sat, Apr 9, 2016 at 1:46 AM, Christian Ullrich 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