[Libreoffice-commits] core.git: hwpfilter/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Apr 11 10:07:34 UTC 2021
hwpfilter/source/hwpread.cxx | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
New commits:
commit ed901cc95b24d01c741861526d66f9451827c0ba
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Apr 10 20:35:50 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Apr 11 12:06:51 2021 +0200
Related: ofz#31685 Timeout. This hunk is a simple swap
Change-Id: Ia4c0f2727c0278496c68f54eca3046a924fa21e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113930
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index 36fb77996c56..ca2a2eff534e 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -285,7 +285,7 @@ bool TxtBox::Read(HWPFile & hwpf)
ncell = nCell;
if (ncell <= 0){
return hwpf.SetState(HWP_InvalidFileFormat);
- }
+ }
cell.reset( ::comphelper::newArray_null<Cell>(ncell) );
if (!cell) {
@@ -333,22 +333,18 @@ bool TxtBox::Read(HWPFile & hwpf)
tcell->pCell = &cell[ii];
pArr[ii] = tcell;
}
- TCell *tmp;
+
// Sort by row and column
for( ii = 0 ; ii < ncell - 1; ii++ ){
for( int jj = ii ; jj < ncell ; jj++){
if( pArr[ii]->nRowIndex > pArr[jj]->nRowIndex ){
- tmp = pArr[ii];
- pArr[ii] = pArr[jj];
- pArr[jj] = tmp;
+ std::swap(pArr[ii], pArr[jj]);
}
}
for( int kk = ii ; kk > 0 ; kk--){
if( ( pArr[kk]->nRowIndex == pArr[kk-1]->nRowIndex ) &&
(pArr[kk]->nColumnIndex < pArr[kk-1]->nColumnIndex )){
- tmp = pArr[kk];
- pArr[kk] = pArr[kk-1];
- pArr[kk-1] = tmp;
+ std::swap(pArr[kk], pArr[kk-1]);
}
}
}
More information about the Libreoffice-commits
mailing list