hwpfilter/source/hwpread.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
New commits: commit ed901cc95b24d01c741861526d66f9451827c0ba Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Apr 10 20:35:50 2021 +0100 Commit: Caolán McNamara <caol...@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 <caol...@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]); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits