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

Jonathan Kew jonathan_kew at sil.org
Wed Jan 30 12:04:11 PST 2008


On 30 Jan 2008, at 12:43 am, Pino Toscano wrote:

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

My understanding from the Qt4 docs was that QString::vsprintf() would  
map the bytes to Unicode according to the Latin-1 codepage, and then  
the toAscii() method would reverse this, mapping back to bytes -- and  
so the result should be OK. But I may well have misunderstood  
something here.

> As said above, let me fix that in the _proper_ Qt4 way, soon.  
> (Changing home
> across country these days.)

Thanks; I'll be happy to see the proper fix applied here.

JK



More information about the poppler mailing list