diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-19 15:52:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-19 19:16:34 +0100 |
commit | 3194487d6287a401849521347fc41792cd88a662 (patch) | |
tree | 3ecdc2fb3de20943500cb1543f34b7d2cf3f137f /editeng | |
parent | 415c1ce394a69ce49d3361f2e6cd6803ed6ee249 (diff) |
CID#1038307 Negative loop bound
fix of coverity#1038307 Negative loop bound
d9ac156b2d651c1305135938a1e828144aa5742b wasn't complete, it assigned possible
-1 int32 to unsigned value before comparison, so -1 not detected.
Change-Id: I6c2805acae8e776902d74c641e01c036193ce3d8
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index e8cf38d41413..e6c26e7a15d4 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -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 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 */ - if(nCount > 0) + if (nCount > 0) { int32_t nStart = 0; int32_t nEnd; UBiDiLevel nCurrDir; - for ( size_t nIdx = 0; nIdx < nCount; ++nIdx ) + for (int32_t nIdx = 0; nIdx < nCount; ++nIdx) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); |