summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 09:04:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 19:25:23 +0200
commit4cc702a7055c0e12c7cbf5e5e359e7cbc8b88020 (patch)
treef09f7167cdca22f16edb5a998c2f9714e4bdc698 /hwpfilter
parent393aa2b3dee9cca84a215635060b369a962ab179 (diff)
loplugin:buriedassign in f,h,i*
Change-Id: Iac753e528e13cb2565832a484e87f88061bbc91e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92239 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hiodev.cxx5
-rw-r--r--hwpfilter/source/hwpeq.cxx37
-rw-r--r--hwpfilter/source/hwpfile.cxx8
3 files changed, 36 insertions, 14 deletions
diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx
index f7cd75ead04a..56d4719e4302 100644
--- a/hwpfilter/source/hiodev.cxx
+++ b/hwpfilter/source/hiodev.cxx
@@ -134,7 +134,10 @@ bool HStreamIODev::setCompressed(bool flag)
{
compressed = flag;
if (flag)
- return nullptr != (_gzfp = gz_open(*_stream));
+ {
+ _gzfp = gz_open(*_stream);
+ return nullptr != _gzfp;
+ }
else if (_gzfp)
{
gz_flush(_gzfp, Z_FINISH);
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 00cf2182866c..5aa6487fae2a 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -504,13 +504,19 @@ static int next_token(MzString &white, MzString &token, istream *strm)
token = nullptr;
white = nullptr;
- if( !strm->good() || (ch = strm->get()) == std::istream::traits_type::eof() )
+ if( !strm->good() )
+ return 0;
+ ch = strm->get();
+ if( ch == std::istream::traits_type::eof() )
return 0;
// read preceding ws
if( IS_WS(ch) ) {
- do white << static_cast<char>(ch);
- while( IS_WS(ch = strm->get()) );
+ do
+ {
+ white << static_cast<char>(ch);
+ ch = strm->get();
+ } while (IS_WS(ch));
}
if( ch == '\\' || ch & 0x80
@@ -544,8 +550,12 @@ static int next_token(MzString &white, MzString &token, istream *strm)
token = "^";
}
else if( IS_BINARY(ch) ) {
- do token << static_cast<char>(ch);
- while( IS_BINARY(ch = strm->get()) );
+ do
+ {
+ token << static_cast<char>(ch);
+ ch = strm->get();
+ }
+ while( IS_BINARY(ch) );
strm->putback(static_cast<char>(ch));
}
else if( ch != std::istream::traits_type::eof() && rtl::isAsciiDigit(ch) ) {
@@ -572,8 +582,13 @@ static std::istream::int_type read_white_space(MzString& outs, istream *strm)
}
else {
std::istream::int_type ch;
- while( IS_WS(ch = strm->get()) )
- outs << static_cast<char>(ch);
+ for (;;)
+ {
+ ch = strm->get();
+ if (!IS_WS(ch))
+ break;
+ outs << static_cast<char>(ch);
+ }
strm->putback(static_cast<char>(ch));
result = ch;
}
@@ -741,9 +756,13 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
sstr.replace(pos, ' ');
}
sstr << token;
- while( (ch = strm->get()) != std::istream::traits_type::eof()
- && IS_WS(ch) )
+ for (;;)
+ {
+ ch = strm->get();
+ if ( ch == std::istream::traits_type::eof() || !IS_WS(ch) )
+ break;
sstr << static_cast<char>(ch);
+ }
if( ch != '{' )
sstr << "{}";
else {
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index b7031bb10444..8be445919ed4 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -106,11 +106,11 @@ int HWPFile::Open(std::unique_ptr<HStream> stream)
char idstr[HWPIDLen];
- if (ReadBlock(idstr, HWPIDLen) < HWPIDLen
- || HWP_V30 != (version = detect_hwp_version(idstr)))
- {
+ if (ReadBlock(idstr, HWPIDLen) < HWPIDLen)
+ return SetState(HWP_UNSUPPORTED_VERSION);
+ version = detect_hwp_version(idstr);
+ if (HWP_V30 != version)
return SetState(HWP_UNSUPPORTED_VERSION);
- }
return HWP_NoError;
}