[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Tue Jul 26 13:14:30 PDT 2011
sw/source/filter/ww8/ww8scan.cxx | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
New commits:
commit ad39a0a6ab951642bc2dff472ce88f8d59e00d5c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jun 19 22:09:17 2011 +0100
Resolves: #i118018# fExtChar affects only < 8 (if at all)
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 3db9bf6..804b016 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1373,9 +1373,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
if( nFcPos == WW8_FC_MAX )
return nFallBackCpEnd;
+ bool bIsUnicode;
+ if (pWw8Fib->nVersion >= 8)
+ bIsUnicode = false;
+ else
+ bIsUnicode = pWw8Fib->fExtChar ? true : false;
+
if( pPieceIter ) // Complex File ?
{
- bool bIsUnicode = false;
sal_uLong nOldPos = pPieceIter->GetIdx();
for (pPieceIter->SetIdx(0);
@@ -1389,15 +1394,14 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
break;
}
sal_Int32 nFcStart = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
- if( 8 <= pWw8Fib->nVersion )
+ if (pWw8Fib->nVersion >= 8)
{
nFcStart = WW8PLCFx_PCD::TransformPieceAddress( nFcStart,
bIsUnicode );
}
else
{
- if (pWw8Fib->fExtChar)
- bIsUnicode=true;
+ bIsUnicode = pWw8Fib->fExtChar ? true : false;
}
sal_Int32 nLen = (nCpEnd - nCpStart) * (bIsUnicode ? 2 : 1);
@@ -1432,11 +1436,13 @@ WW8_CP WW8ScannerBase::WW8Fc2Cp( WW8_FC nFcPos ) const
*/
return nFallBackCpEnd;
}
+
// No complex file
- if (!pWw8Fib->fExtChar)
+ if (!bIsUnicode)
nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin);
else
nFallBackCpEnd = (nFcPos - pWw8Fib->fcMin + 1) / 2;
+
return nFallBackCpEnd;
}
@@ -1452,8 +1458,14 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
if( !pIsUnicode )
pIsUnicode = &bIsUnicode;
+ if (pWw8Fib->nVersion >= 8)
+ *pIsUnicode = false;
+ else
+ *pIsUnicode = pWw8Fib->fExtChar ? true : false;
+
if( pPieceIter )
- { // Complex File
+ {
+ // Complex File
if( pNextPieceCp )
*pNextPieceCp = WW8_CP_MAX;
@@ -1481,16 +1493,10 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
*pNextPieceCp = nCpEnd;
WW8_FC nRet = SVBT32ToUInt32( ((WW8_PCD*)pData)->fc );
- if (8 > pWw8Fib->nVersion)
- {
- if (pWw8Fib->fExtChar)
- *pIsUnicode=true;
- else
- *pIsUnicode = false;
- }
- else
+ if (pWw8Fib->nVersion >= 8)
nRet = WW8PLCFx_PCD::TransformPieceAddress( nRet, *pIsUnicode );
-
+ else
+ *pIsUnicode = pWw8Fib->fExtChar ? true : false;
nRet += (nCpPos - nCpStart) * (*pIsUnicode ? 2 : 1);
@@ -1498,10 +1504,6 @@ WW8_FC WW8ScannerBase::WW8Cp2Fc(WW8_CP nCpPos, bool* pIsUnicode,
}
// No complex file
- if (pWw8Fib->fExtChar)
- *pIsUnicode = true;
- else
- *pIsUnicode = false;
return pWw8Fib->fcMin + nCpPos * (*pIsUnicode ? 2 : 1);
}
More information about the Libreoffice-commits
mailing list