[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-poppler
Subject:    Re: [poppler] qt4/src/poppler-qiodeviceoutstream.cc: open_memstream
From:       Pino Toscano <pino () kde ! org>
Date:       2008-01-30 0:43:36
Message-ID: 200801300143.41762.pino () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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@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 
standard.]

> > 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.)

-- 
Pino Toscano

["signature.asc" (application/pgp-signature)]

_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic