summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-23 22:58:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-24 16:53:55 +0000
commit5f662f2540e02487396d0ef0d97325d9a1fa8960 (patch)
tree54e2d7ad0513e7fe70c2c1efa8276035d56e0e49 /tools
parent04d58ef75a5e6fd7066fcfd257d907f52e4de5a7 (diff)
all direct OUString readers are current little endian streams
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/stream.hxx4
-rw-r--r--tools/source/stream/stream.cxx13
2 files changed, 9 insertions, 8 deletions
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index e8f414bfc987..78f84fc2f7ba 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -499,9 +499,9 @@ TOOLS_DLLPUBLIC inline rtl::OUString read_uInt8s_ToOUString(SvStream& rStrm,
return rtl::OStringToOUString(read_uInt8s_ToOString(rStrm, nUnits), eEnc);
}
-//Attempt to read nUnits little endian 16bit units to an OUString, returned
+//Attempt to read nUnits 16bit units to an OUString, returned
//rtl::OUString's length is number of units successfully read
-TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm,
+TOOLS_DLLPUBLIC rtl::OUString read_uInt16s_ToOUString(SvStream& rStrm,
sal_Size nUnits);
//Attempt to read 8bit units to an OString until a zero terminator is
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 5e48f42b2e6b..11cfe33e766c 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -2370,8 +2370,8 @@ rtl::OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen)
return pStr ? rtl::OString(pStr, SAL_NO_ACQUIRE) : rtl::OString();
}
-//Create a OUString of nLen little endian sal_Unicodes from rStream
-rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm, sal_Size nLen)
+//Create a OUString of nLen sal_Unicodes from rStream
+rtl::OUString read_uInt16s_ToOUString(SvStream& rStrm, sal_Size nLen)
{
using comphelper::string::rtl_uString_alloc;
@@ -2391,10 +2391,11 @@ rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm, sal_Size nLen)
pStr->length = sal::static_int_cast<sal_Int32>(nWasRead);
pStr->buffer[pStr->length] = 0;
}
-#ifdef OSL_BIGENDIAN
- for (sal_Int32 i = 0; i < pStr->length; ++i)
- pStr->buffer[i] = SWAPSHORT(pStr->buffer[i]);
-#endif
+ if (rStrm.IsEndianSwap())
+ {
+ for (sal_Int32 i = 0; i < pStr->length; ++i)
+ pStr->buffer[i] = SWAPSHORT(pStr->buffer[i]);
+ }
}
//take ownership of buffer and return, otherwise return empty string