aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-09-14 03:31:46 +0200
committerJay Berkenbilt <ejb@ql.org>2009-09-14 03:31:46 +0200
commit0ded90eff979c0a329736861995b2516139de114 (patch)
treec7f3ed5dc3481172f4a742de8869c8e52a9cb87a
parentb93c34099cee9f546d5aed2451568e2aaf51d00d (diff)
downloadqpdf-0ded90eff979c0a329736861995b2516139de114.tar.zst
fix problems or otherwise improve code based on issues raised by Klocwork
git-svn-id: svn+q:///qpdf/trunk@690 71b93d88-0707-0410-a8cf-f5a4172ac649
-rw-r--r--libqpdf/PCRE.cc2
-rw-r--r--libqpdf/QPDF_linearization.cc20
-rw-r--r--libtests/flate.cc1
-rw-r--r--libtests/png_filter.cc1
4 files changed, 12 insertions, 12 deletions
diff --git a/libqpdf/PCRE.cc b/libqpdf/PCRE.cc
index 59174f67..872fde36 100644
--- a/libqpdf/PCRE.cc
+++ b/libqpdf/PCRE.cc
@@ -147,7 +147,7 @@ PCRE::Match::nMatches() const
return this->nmatches;
}
-PCRE::PCRE(char const* pattern, int options) throw (Exception)
+PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception)
{
char const *errptr;
int erroffset;
diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc
index 2a81856e..281748b5 100644
--- a/libqpdf/QPDF_linearization.cc
+++ b/libqpdf/QPDF_linearization.cc
@@ -113,19 +113,17 @@ QPDF::isLinearized()
}
else
{
- if ((p = (char*)memchr(p, '\0', tbuf_size - (p - buf))) != 0)
+ p = (char*)memchr(p, '\0', tbuf_size - (p - buf));
+ assert(p != 0);
+ while ((p - buf < tbuf_size) && (*p == 0))
{
- QTC::TC("qpdf", "QPDF lindict null found");
- while ((p - buf < tbuf_size) && (*p == 0))
- {
- ++p;
- }
- if ((p - buf) == tbuf_size)
- {
- break;
- }
- QTC::TC("qpdf", "QPDF lindict searching after null");
+ ++p;
+ }
+ if ((p - buf) == tbuf_size)
+ {
+ break;
}
+ QTC::TC("qpdf", "QPDF lindict searching after null");
}
}
diff --git a/libtests/flate.cc b/libtests/flate.cc
index b6059a21..d05e7f92 100644
--- a/libtests/flate.cc
+++ b/libtests/flate.cc
@@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode)
{
std::cerr << "fopen " << filename << " failed: " << strerror(errno)
<< std::endl;
+ exit(2);
}
return result;
}
diff --git a/libtests/png_filter.cc b/libtests/png_filter.cc
index 4a888bf9..a4b8a110 100644
--- a/libtests/png_filter.cc
+++ b/libtests/png_filter.cc
@@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode)
{
std::cerr << "fopen " << filename << " failed: " << strerror(errno)
<< std::endl;
+ exit(2);
}
return result;
}