diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-23 22:58:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-24 16:53:55 +0000 |
commit | 5f662f2540e02487396d0ef0d97325d9a1fa8960 (patch) | |
tree | 54e2d7ad0513e7fe70c2c1efa8276035d56e0e49 | |
parent | 04d58ef75a5e6fd7066fcfd257d907f52e4de5a7 (diff) |
all direct OUString readers are current little endian streams
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 2 | ||||
-rw-r--r-- | filter/source/msfilter/mstoolbar.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 4 | ||||
-rw-r--r-- | tools/inc/tools/stream.hxx | 4 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 13 |
9 files changed, 34 insertions, 33 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 9c6a719e4e27..406b1532c4f0 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4014,7 +4014,7 @@ rtl::OUString SvxMSDffManager::MSDFFReadZString(SvStream& rIn, String sBuf; if( bUniCode ) - sBuf = read_LEuInt16s_ToOUString(rIn, nLen/2); + sBuf = read_uInt16s_ToOUString(rIn, nLen/2); else sBuf = read_uInt8s_ToOUString(rIn, nLen, RTL_TEXTENCODING_MS_1252); diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index fbac37f2152c..d8839a70c743 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -412,7 +412,7 @@ WString::Read( SvStream &rS ) nOffSet = rS.Tell(); sal_uInt8 nChars = 0; rS >> nChars; - sString = read_LEuInt16s_ToOUString(rS, nChars); + sString = read_uInt16s_ToOUString(rS, nChars); return true; } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a14279d5f669..99a2544d5df1 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -279,7 +279,7 @@ bool Sttb::Read( SvStream& rS ) { SBBItem aItem; rS >> aItem.cchData; - aItem.data = read_LEuInt16s_ToOUString(rS, aItem.cchData); + aItem.data = read_uInt16s_ToOUString(rS, aItem.cchData); dataItems.push_back( aItem ); } } @@ -5396,7 +5396,7 @@ const String* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx) } else { - mpAtnNames->push_back(read_LEuInt16_PascalString(rStrm)); + mpAtnNames->push_back(read_uInt16_PascalString(rStrm)); // UNICode: doppelte Laenge + sal_uInt16 Count nRead += mpAtnNames->rbegin()->Len() * 2 + 2; } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index c76f767377b3..ed4cf39ae4bf 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -699,7 +699,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, // // 4. den Nummerierungsstring einlesen: ergibt Prefix und Postfix // - String sNumString(read_LEuInt16_PascalString(rSt)); + String sNumString(read_uInt16_PascalString(rSt)); // // 5. gelesene Werte in Writer Syntax umwandeln @@ -2169,13 +2169,13 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, *pDataStream >> hps; // xstzName - sTitle = read_LEuInt16_BeltAndBracesString(*pDataStream); + sTitle = read_uInt16_BeltAndBracesString(*pDataStream); if (nWhich == WW8_CT_EDIT) { // Field is a textbox // Default text // xstzTextDef - sDefault = read_LEuInt16_BeltAndBracesString(*pDataStream); + sDefault = read_uInt16_BeltAndBracesString(*pDataStream); } else { @@ -2191,14 +2191,14 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, } } // xstzTextFormat - sFormatting = read_LEuInt16_BeltAndBracesString(*pDataStream); + sFormatting = read_uInt16_BeltAndBracesString(*pDataStream); // xstzHelpText - sHelp = read_LEuInt16_BeltAndBracesString(*pDataStream); + sHelp = read_uInt16_BeltAndBracesString(*pDataStream); // xstzStatText - sToolTip = read_LEuInt16_BeltAndBracesString(*pDataStream); + sToolTip = read_uInt16_BeltAndBracesString(*pDataStream); - String sEntryMacro = read_LEuInt16_BeltAndBracesString(*pDataStream); - String sExitMcr = read_LEuInt16_BeltAndBracesString(*pDataStream); + String sEntryMacro = read_uInt16_BeltAndBracesString(*pDataStream); + String sExitMcr = read_uInt16_BeltAndBracesString(*pDataStream); if (nWhich == WW8_CT_DROPDOWN) { @@ -2225,7 +2225,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, maListEntries.reserve(nNoStrings); for (sal_uInt32 nI = 0; nI < nNoStrings; ++nI) { - String sEntry = read_LEuInt16_PascalString(*pDataStream); + String sEntry = read_uInt16_PascalString(*pDataStream); maListEntries.push_back(sEntry); } } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index be9b8d44bcee..57e42db1f0f0 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1910,11 +1910,11 @@ Err: return false; } -String read_LEuInt16_PascalString(SvStream& rStrm) +String read_uInt16_PascalString(SvStream& rStrm) { sal_uInt16 nLen(0); rStrm >> nLen; - return read_LEuInt16s_ToOUString(rStrm, nLen); + return read_uInt16s_ToOUString(rStrm, nLen); } String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc) @@ -1924,9 +1924,9 @@ String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc) return aRet; } -String read_LEuInt16_BeltAndBracesString(SvStream& rStrm) +String read_uInt16_BeltAndBracesString(SvStream& rStrm) { - String aRet = read_LEuInt16_PascalString(rStrm); + String aRet = read_uInt16_PascalString(rStrm); rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end return aRet; } @@ -1961,7 +1961,7 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr, nLen = USHRT_MAX - 1; if( bIsUnicode ) - rStr.Append(String(read_LEuInt16s_ToOUString(rStrm, nLen))); + rStr.Append(String(read_uInt16s_ToOUString(rStrm, nLen))); else rStr.Append(String(read_uInt8s_ToOUString(rStrm, nLen, eEnc))); nTotalRead += nLen; @@ -3860,7 +3860,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen for (sal_uInt16 i=0; i < nStrings; ++i) { if (bUnicode) - rArray.push_back(read_LEuInt16_PascalString(rStrm)); + rArray.push_back(read_uInt16_PascalString(rStrm)); else { rtl::OString aTmp = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(rStrm); @@ -3891,7 +3891,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen for (sal_uInt16 i=0; i < nStrings; ++i) { if( bUnicode ) - pValueArray->push_back(read_LEuInt16_PascalString(rStrm)); + pValueArray->push_back(read_uInt16_PascalString(rStrm)); else { rtl::OString aTmp = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(rStrm); @@ -6143,7 +6143,7 @@ WW8_STD* WW8Style::Read1Style( short& rSkip, String* pString, short* pcbStd ) // trailing zero if (TestBeltAndBraces<sal_Unicode>(rSt)) { - *pString = read_LEuInt16_BeltAndBracesString(rSt); + *pString = read_uInt16_BeltAndBracesString(rSt); rSkip -= (pString->Len() + 2) * 2; } else diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 2b9f93f2de30..d4012d486fdb 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -139,13 +139,13 @@ inline String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc) { return read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>(rStrm, eEnc); } -String read_LEuInt16_PascalString(SvStream& rStrm); +String read_uInt16_PascalString(SvStream& rStrm); //Belt and Braces strings, i.e. Pascal-style strings followed by //null termination, Spolsky calls them "fucked strings" FWIW //http://www.joelonsoftware.com/articles/fog0000000319.html String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc); -String read_LEuInt16_BeltAndBracesString(SvStream& rStrm); +String read_uInt16_BeltAndBracesString(SvStream& rStrm); //--Line abovewhich the code has meaningful comments diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index 2f18072e80d4..32472173f3c3 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -787,7 +787,7 @@ Xst::Read( SvStream& rS ) { OSL_TRACE("Xst::Read() stream pos 0x%x", rS.Tell() ); nOffSet = rS.Tell(); - sString = read_LEuInt16_PascalString(rS); + sString = read_uInt16_PascalString(rS); return true; } @@ -1128,7 +1128,7 @@ bool TcgSttbfCore::Read( SvStream& rS ) for ( sal_Int32 index = 0; index < cData; ++index ) { rS >> dataItems[ index ].cchData; - dataItems[ index ].data = read_LEuInt16s_ToOUString(rS, dataItems[index].cchData); + dataItems[ index ].data = read_uInt16s_ToOUString(rS, dataItems[index].cchData); rS >> dataItems[ index ].extraData; } } 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 |