[poppler] qt4/src/poppler-qiodeviceoutstream.cc: open_memstream is non-portable
pino at kde.org
Tue Jan 29 16:43:36 PST 2008
Alle mercoledì 30 gennaio 2008, Jonathan Kew ha scritto:
> 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.
Ok, I'll fix that soon.
[As aside note, it's a bit sad that this kind of "facility" is not part of the
> > 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.
Wrong patch, this is not the "Qt4 way" (read below).
> I suppose this means that the string is being (unnecessarily)
> converted to and from Unicode, which may introduce a little overhead,
... and changes the data (converting to UTF-16 whatever is passed) that go
through the QIODevice!!
QIODeviceOutStream just pipes out _raw_ data into a QIODevice, w/o changing
it; otherwise, the stream gets corrupted.
As said above, let me fix that in the _proper_ Qt4 way, soon. (Changing home
across country these days.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/poppler/attachments/20080130/b1e34648/attachment.pgp
More information about the poppler