comparison data/fileio/BZipFileDevice.cpp @ 690:1424aa29ae95

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:26:52 +0100
parents 06f13a3b9e9e
children e802e550a1f2
comparison
equal deleted inserted replaced
689:573d45e9487b 690:1424aa29ae95
28 { 28 {
29 } 29 }
30 30
31 BZipFileDevice::~BZipFileDevice() 31 BZipFileDevice::~BZipFileDevice()
32 { 32 {
33 // DEBUG << "BZipFileDevice::~BZipFileDevice(" << m_fileName << ")" << endl; 33 // SVDEBUG << "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 // DEBUG << "BZipFileDevice::readData: requested " << maxSize << ", read " << read << endl; 181 // SVDEBUG << "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 // DEBUG << "BZipFileDevice::readData: reached end of file" << endl; 190 // SVDEBUG << "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 // DEBUG << "BZipFileDevice::writeData: " << maxSize << " to write" << endl; 204 // SVDEBUG << "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 // DEBUG << "BZipFileDevice::writeData: wrote " << maxSize << endl; 213 // SVDEBUG << "BZipFileDevice::writeData: wrote " << maxSize << endl;
214 214
215 return maxSize; 215 return maxSize;
216 } 216 }
217 217