[Libreoffice] some binary string reading methods, generally msword related

Caolán McNamara caolanm at redhat.com
Mon Sep 5 03:08:53 PDT 2011


I've added to tools

rtl::OString read_uInt8s_AsOString(SvStream& rStr, sal_Size nLen);
rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStr, sal_Size nLen);

which read nLen 8bit units or 16bit units from a SvStream into a
O[UString]. They should be reasonably efficient and drop the usual extra
intermediate buffer of the various methods and functions I
merged/replaced with these.

Down in sw I replaced, split out, refactored some various horrors with

a)
String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc);
String read_LEuInt16_PascalString(SvStream& rStrm);

which read pascal-style strings where the non-NULL terminated string on
disk is preceded by the len, and in passing fixed at least one case
where we passed "0" as the encoding of a string.

and b)
String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding
eEnc);
String read_LEuInt16_BeltAndBracesString(SvStream& rStrm);

which read the common msword pattern of null-terminated pascal-style
strings. Spolsky has amusing terminology for these FWIW
http://www.joelonsoftware.com/articles/fog0000000319.html

C.



More information about the LibreOffice mailing list