[Libreoffice] [PATCH][REVIEW] Replacing ByteString with rtl::OString
Caolán McNamara
caolanm at redhat.com
Thu Jun 30 08:41:38 PDT 2011
On Wed, 2011-06-29 at 23:00 +0200, Chr. Rossmanith wrote:
> Hi,
>
> I've started to replace ByteString with rtl::OString. You find what I
> did so far in the attached patches. It would be nice if someone could
> review the patches and give feedback. Then I'll continue and push.
Patch 2 is good, we can go back when finished and re-implement ReadLine
at the end in terms of rtl::OStringBuffer or whatever when the rest are
all gone.
Patch 1 has
a) various original lines of...
rtl::OUString( UniString( aRequestHost, RTL_TEXTENCODING_UTF8 ) )
we need to retain the encoding information here in the conversion from
OString to OUString
so use
rtl::OStringToOUString(aRequestHost, RTL_TEXTENCODING_UTF8)
instead of
rtl::OUString::createFromAscii(aRequestHost.getStr())
e.g.
aConnectAddr = osl::SocketAddr(rtl::OStringToOUString(aRequestHost,
RTL_TEXTENCODING_UTF8), nRequestPort);
b)
- nResultId = (sal_uInt16)aLine.GetToken( 1, ' ' ).ToInt32();
+ nResultId = (sal_uInt16)aLine.getToken( (sal_Int32)1, ' ',
nIndex ).toInt32();
which is find, but nIndex is an in-out argument in rtl::OString, and
this code is in a loop, so old code always seemed to say
"get the second (1) token starting from default 0"
new code says
"get the second (1) token starting from nIndex, where nIndex is the
position of the last token got"
so to be the same move sal_Int32 nIndex = 0; inside the loop above
getToken
C.
More information about the LibreOffice
mailing list