Kaydet (Commit) 3194487d authored tarafından Caolán McNamara's avatar Caolán McNamara

CID#1038307 Negative loop bound

fix of coverity#1038307 Negative loop bound
d9ac156b wasn't complete, it assigned possible
-1 int32 to unsigned value before comparison, so -1 not detected.

Change-Id: I6c2805acae8e776902d74c641e01c036193ce3d8
üst 415c1ce3
...@@ -1909,16 +1909,16 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) ...@@ -1909,16 +1909,16 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW
nError = U_ZERO_ERROR; nError = U_ZERO_ERROR;
size_t nCount = ubidi_countRuns( pBidi, &nError ); int32_t nCount = ubidi_countRuns( pBidi, &nError );
/* ubidi_countRuns can return -1 in case of error */ /* ubidi_countRuns can return -1 in case of error */
if(nCount > 0) if (nCount > 0)
{ {
int32_t nStart = 0; int32_t nStart = 0;
int32_t nEnd; int32_t nEnd;
UBiDiLevel nCurrDir; UBiDiLevel nCurrDir;
for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) for (int32_t nIdx = 0; nIdx < nCount; ++nIdx)
{ {
ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment