diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-04-30 20:40:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-05-01 11:02:02 +0200 |
commit | b4dbdbdc9755dbbb586039eb48b935e7dbcc4cbb (patch) | |
tree | 640d2e9caaa2d872fe8c629bb1c61e673fca4684 /hwpfilter | |
parent | 96ce28f5eb7139f66ba35e74e997c3a686aeca39 (diff) |
ofz#47118 Timeout
Change-Id: I5cf7f07c00faebb8005b150c9638dfbb742d156f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133666
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 6781267fdd7f..87c2e6412bd5 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -2608,7 +2608,6 @@ void HwpReader::makeChars(hchar_string & rStr) void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) { hchar_string str; - int n; int res; hchar dest[3]; unsigned char firstspace = 0; @@ -2637,16 +2636,21 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) startEl("text:span"); mxList->clear(); - for (n = 0; n < para->nch && para->hhstr[n]->hh; - n += para->hhstr[n]->WSize()) + int n = 0; + while (n < para->nch) { - if (para->hhstr[n]->hh == CH_SPACE && !firstspace) + const auto& box = para->hhstr[n]; + + if (!box->hh) + break; + + if (box->hh == CH_SPACE && !firstspace) { makeChars(str); startEl("text:s"); endEl("text:s"); } - else if (para->hhstr[n]->hh == CH_END_PARA) + else if (box->hh == CH_END_PARA) { makeChars(str); endEl("text:span"); @@ -2655,16 +2659,17 @@ void HwpReader::make_text_p0(HWPPara * para, bool bParaStart) } else { - if (para->hhstr[n]->hh == CH_SPACE) + if (box->hh == CH_SPACE) firstspace = 0; else firstspace = 1; - res = hcharconv(para->hhstr[n]->hh, dest, UNICODE); + res = hcharconv(box->hh, dest, UNICODE); for( int j = 0 ; j < res; j++ ) { str.push_back(dest[j]); } } + n += box->WSize(); } } |