comparison data/fileio/BZipFileDevice.cpp @ 687:06f13a3b9e9e debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:09 +0100
parents b4a8d8221eaf
children 1424aa29ae95
comparison
equal deleted inserted replaced
686:b4a8d8221eaf 687:06f13a3b9e9e
28 { 28 {
29 } 29 }
30 30
31 BZipFileDevice::~BZipFileDevice() 31 BZipFileDevice::~BZipFileDevice()
32 { 32 {
33 // std::cerr << "BZipFileDevice::~BZipFileDevice(" << m_fileName << ")" << std::endl; 33 // DEBUG << "BZipFileDevice::~BZipFileDevice(" << m_fileName << ")" << endl;
34 if (m_bzFile) close(); 34 if (m_bzFile) close();
35 } 35 }
36 36
37 bool 37 bool
38 BZipFileDevice::isOK() const 38 BZipFileDevice::isOK() const
176 if (m_atEnd) return 0; 176 if (m_atEnd) return 0;
177 177
178 int bzError = BZ_OK; 178 int bzError = BZ_OK;
179 int read = BZ2_bzRead(&bzError, m_bzFile, data, maxSize); 179 int read = BZ2_bzRead(&bzError, m_bzFile, data, maxSize);
180 180
181 // std::cerr << "BZipFileDevice::readData: requested " << maxSize << ", read " << read << std::endl; 181 // DEBUG << "BZipFileDevice::readData: requested " << maxSize << ", read " << read << endl;
182 182
183 if (bzError != BZ_OK) { 183 if (bzError != BZ_OK) {
184 if (bzError != BZ_STREAM_END) { 184 if (bzError != BZ_STREAM_END) {
185 std::cerr << "BZipFileDevice::readData: error condition" << std::endl; 185 std::cerr << "BZipFileDevice::readData: error condition" << std::endl;
186 setErrorString(tr("bzip2 stream read error")); 186 setErrorString(tr("bzip2 stream read error"));
187 m_ok = false; 187 m_ok = false;
188 return -1; 188 return -1;
189 } else { 189 } else {
190 // std::cerr << "BZipFileDevice::readData: reached end of file" << std::endl; 190 // DEBUG << "BZipFileDevice::readData: reached end of file" << endl;
191 m_atEnd = true; 191 m_atEnd = true;
192 } 192 }
193 } 193 }
194 194
195 return read; 195 return read;
199 BZipFileDevice::writeData(const char *data, qint64 maxSize) 199 BZipFileDevice::writeData(const char *data, qint64 maxSize)
200 { 200 {
201 int bzError = BZ_OK; 201 int bzError = BZ_OK;
202 BZ2_bzWrite(&bzError, m_bzFile, (void *)data, maxSize); 202 BZ2_bzWrite(&bzError, m_bzFile, (void *)data, maxSize);
203 203
204 // std::cerr << "BZipFileDevice::writeData: " << maxSize << " to write" << std::endl; 204 // DEBUG << "BZipFileDevice::writeData: " << maxSize << " to write" << endl;
205 205
206 if (bzError != BZ_OK) { 206 if (bzError != BZ_OK) {
207 std::cerr << "BZipFileDevice::writeData: error condition" << std::endl; 207 std::cerr << "BZipFileDevice::writeData: error condition" << std::endl;
208 setErrorString("bzip2 stream write error"); 208 setErrorString("bzip2 stream write error");
209 m_ok = false; 209 m_ok = false;
210 return -1; 210 return -1;
211 } 211 }
212 212
213 // std::cerr << "BZipFileDevice::writeData: wrote " << maxSize << std::endl; 213 // DEBUG << "BZipFileDevice::writeData: wrote " << maxSize << endl;
214 214
215 return maxSize; 215 return maxSize;
216 } 216 }
217 217