[poppler] reconsideration about iconv() in cpp frontend

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Tue Apr 17 01:24:09 UTC 2018


Dear Adam, Albert,

Thank you very much for taking care on this.

Albert Astals Cid wrote:
> El dilluns, 16 d’abril de 2018, a les 19:11:01 CEST, Adam Reichold va 
> escriure:
>> I really think that poppler::ustring defined as
>>
>> std::basic_string<unsigned short>
>>
>> is already broken where sizeof(unsigned short) != 2 and hence should be
>> redefined to
>>
>> std::basic_string<std::uint16_t>
>>
>> without considering that an API break.

I had a concern whether C++ linker distinguishes uint16_t
and unsigned short even if their types are exactly same.

As far as I check GNU binutils: nm & c++filt for gcc object
files of GNU/Linux on amd64 enviroment, the result looks
like this, so there would be no problem.

00000000000000e0 T mapUTF16(unsigned int, char*, int)
0000000000000040 T UTF16toUCS4(unsigned int const*, int, unsigned int**)
0000000000000340 T utf8CountUtf16CodeUnits(char const*)
0000000000000400 T utf8ToUtf16(char const*, unsigned short*, int, int)
0000000000000570 T utf8ToUtf16(char const*, int*)
00000000000005c0 T utf16CountUtf8Bytes(unsigned short const*)
00000000000006b0 T utf16ToUtf8(unsigned short const*, char*, int, int)
0000000000000810 T utf16ToUtf8(unsigned short const*, int*)

So I have no objection to Adam's proposal to change
the definition of ustring object.

# if anybody has the knowledge on other object formats,
# please let me know.

> Sure, is there any system where sizeof(unsigned short) != 2 anyway?

Maybe people feel "such system is out of scope", but there were:
https://web.archive.org/web/20090408221917/http://www.zib.de/benger/hdf5/Datatypes.html
according to the description for "size_t H5Tget_precision (hid_t type)",
there is a note saying
"For instance, a short on a Cray is 32 significant bits in an eight-byte field."

If the poppler maintainers do not want to include the
codes rarely used for the exotic systems, I suggest to
insert a code checking uint16_t == unsigned short in
CMakeLists.txt.

Regards,
mpsuzuki



More information about the poppler mailing list