[poppler] qt4/src/poppler-qiodeviceoutstream.cc: open_memstream is non-portable

Jonathan Kew jonathan_kew at sil.org
Tue Jan 29 16:30:31 PST 2008


On 28 Jan 2008, at 10:53 pm, Kristian Høgsberg wrote:

> On Jan 28, 2008 5:20 PM, Albert Astals Cid <aacid at kde.org> wrote:
>> A Dilluns 28 Gener 2008, Jonathan Kew va escriure:
>>> The document saving code in the Qt4 wrapper uses open_memstream(),
>>> which is not available on all platforms. I would recommend using
>>> vasprintf() instead, which I suspect is more widely supported, but
>>> this is also a GNU extension and may not be available everywhere. So
>>> a fallback approach using vsnprintf() is also needed.
>>>
>>> Proposed changes below....
>>
>> I'll let Pino comment on that, but he is travelling so it'll take  
>> a while.
>
> I'll weigh in though and say that using open_memstream() isn't
> acceptable, it's very GNU Libc specific.  Also, the suggested patch
> has the same problems as the strndup() patch.  I'm sure there is a
> helper function  in Qt to create a dynamically allocated string from a
> printf-style string, that would be the way to go.

Attached is a revised (and simplified) version of the patch,  
abandoning open_memstream() etc in favor of QString::vsprintf(),  
which seems to be the Qt4 way to do this.

I suppose this means that the string is being (unnecessarily)  
converted to and from Unicode, which may introduce a little overhead,  
but I doubt this is a performance-critical point.

JK

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qiodeviceoutstream-patch.txt
Url: http://lists.freedesktop.org/archives/poppler/attachments/20080130/04e45082/attachment.txt 
-------------- next part --------------





More information about the poppler mailing list