Commit 0ded90eff979c0a329736861995b2516139de114

Authored by Jay Berkenbilt
1 parent b93c3409

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
libqpdf/PCRE.cc
@@ -147,7 +147,7 @@ PCRE::Match::nMatches() const @@ -147,7 +147,7 @@ PCRE::Match::nMatches() const
147 return this->nmatches; 147 return this->nmatches;
148 } 148 }
149 149
150 -PCRE::PCRE(char const* pattern, int options) throw (Exception) 150 +PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception)
151 { 151 {
152 char const *errptr; 152 char const *errptr;
153 int erroffset; 153 int erroffset;
libqpdf/QPDF_linearization.cc
@@ -113,19 +113,17 @@ QPDF::isLinearized() @@ -113,19 +113,17 @@ QPDF::isLinearized()
113 } 113 }
114 else 114 else
115 { 115 {
116 - if ((p = (char*)memchr(p, '\0', tbuf_size - (p - buf))) != 0) 116 + p = (char*)memchr(p, '\0', tbuf_size - (p - buf));
  117 + assert(p != 0);
  118 + while ((p - buf < tbuf_size) && (*p == 0))
117 { 119 {
118 - QTC::TC("qpdf", "QPDF lindict null found");  
119 - while ((p - buf < tbuf_size) && (*p == 0))  
120 - {  
121 - ++p;  
122 - }  
123 - if ((p - buf) == tbuf_size)  
124 - {  
125 - break;  
126 - }  
127 - QTC::TC("qpdf", "QPDF lindict searching after null"); 120 + ++p;
  121 + }
  122 + if ((p - buf) == tbuf_size)
  123 + {
  124 + break;
128 } 125 }
  126 + QTC::TC("qpdf", "QPDF lindict searching after null");
129 } 127 }
130 } 128 }
131 129
libtests/flate.cc
@@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode) @@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode)
15 { 15 {
16 std::cerr << "fopen " << filename << " failed: " << strerror(errno) 16 std::cerr << "fopen " << filename << " failed: " << strerror(errno)
17 << std::endl; 17 << std::endl;
  18 + exit(2);
18 } 19 }
19 return result; 20 return result;
20 } 21 }
libtests/png_filter.cc
@@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode) @@ -15,6 +15,7 @@ FILE* safe_fopen(char const* filename, char const* mode)
15 { 15 {
16 std::cerr << "fopen " << filename << " failed: " << strerror(errno) 16 std::cerr << "fopen " << filename << " failed: " << strerror(errno)
17 << std::endl; 17 << std::endl;
  18 + exit(2);
18 } 19 }
19 return result; 20 return result;
20 } 21 }