Skip site navigation (1) Skip section navigation (2)

utffile patch

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Max Khon <fjoe(at)samodelkin(dot)net>
Cc: Hiroshi Saito <saito(at)inetrt(dot)skcapi(dot)co(dot)jp>,pgadmin-hackers(at)postgresql(dot)org, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Subject: utffile patch
Date: 2005-02-23 22:26:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgadmin-hackers
Max Khon wrote:
> Hi!
> Attached patch fixes coredump in non-Unicode version of pgadmin3.
> This allows to build (non-Unicode) pgadmin3 on FreeBSD 4.x.

This patch appears highly dubious to me (apart from the fact that I'd 
call non-unicode unsupported).

> +#if wxUSE_UNICODE
> +            size_t buf_len = nLen;
> +#else
> +            size_t buf_len = nLen * sizeof(wchar_t);
> +#endif
 > + 
m_conversion->MB2WC((wchar_t*)(wxChar*)wxStringBuffer(str, buf_len), 
(const char*)buffer, (size_t)(nLen+1));

wxStringBuffers expects the second parameter to contain the number of 
characters (not bytes), which will be the same for unicode as and 
non-unicode. Using sizeof(wchar_t) in non-unicode is just an arbitrary 
number with no special meaning, might be the magic constant 42 as well. 
The only mechanism of "fix" I could think of is that wxStringBuffer 
really should receive nLen+1 instead of nLen.
Max, apparently you have a test case, please check nLen+1 instead of 


In response to


pgadmin-hackers by date

Next:From: Andreas PflugDate: 2005-02-23 22:39:22
Subject: Re: upgrade to wx2.5.4
Previous:From: Dave PageDate: 2005-02-23 21:21:30
Subject: Re: [pgadmin-support] [ANNOUNCE] pgAdmin III 1.2.0 Released

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group