comparison data/fileio/MatrixFile.cpp @ 259:dc46851837d6

* Fix many compile warnings, remove some debug output
author Chris Cannam
date Mon, 30 Apr 2007 13:36:23 +0000
parents 3e6fee4e4257
children 7aa1de571880
comparison
equal deleted inserted replaced
258:96a6dd889c68 259:dc46851837d6
157 m_columnBitsetWriteMutex.unlock(); 157 m_columnBitsetWriteMutex.unlock();
158 158
159 QMutexLocker locker(&m_refcountMutex); 159 QMutexLocker locker(&m_refcountMutex);
160 ++m_refcount[fileName]; 160 ++m_refcount[fileName];
161 161
162 std::cerr << "MatrixFile(" << this << "): fd " << m_fd << ", file " << fileName.toStdString() << ", ref " << m_refcount[fileName] << std::endl; 162 // std::cerr << "MatrixFile(" << this << "): fd " << m_fd << ", file " << fileName.toStdString() << ", ref " << m_refcount[fileName] << std::endl;
163 163
164 // std::cerr << "MatrixFile::MatrixFile: Done, size is " << "(" << m_width << ", " << m_height << ")" << std::endl; 164 // std::cerr << "MatrixFile::MatrixFile: Done, size is " << "(" << m_width << ", " << m_height << ")" << std::endl;
165 165
166 ++totalCount; 166 ++totalCount;
167 167
194 QMutexLocker locker(&m_refcountMutex); 194 QMutexLocker locker(&m_refcountMutex);
195 195
196 if (--m_refcount[m_fileName] == 0) { 196 if (--m_refcount[m_fileName] == 0) {
197 197
198 if (::unlink(m_fileName.toLocal8Bit())) { 198 if (::unlink(m_fileName.toLocal8Bit())) {
199 ::perror("Unlink failed"); 199 // ::perror("Unlink failed");
200 std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName.toStdString() << "\"" << std::endl; 200 // std::cerr << "WARNING: MatrixFile::~MatrixFile: reference count reached 0, but failed to unlink file \"" << m_fileName.toStdString() << "\"" << std::endl;
201 } else { 201 } else {
202 std::cerr << "deleted " << m_fileName.toStdString() << std::endl; 202 // std::cerr << "deleted " << m_fileName.toStdString() << std::endl;
203 } 203 }
204 204
205 QMutexLocker locker2(&m_columnBitsetWriteMutex); 205 QMutexLocker locker2(&m_columnBitsetWriteMutex);
206 m_columnBitsets.erase(m_fileName); 206 m_columnBitsets.erase(m_fileName);
207 delete m_columnBitset; 207 delete m_columnBitset;
210 210
211 totalStorage -= (m_headerSize + (m_width * m_height * m_cellSize)); 211 totalStorage -= (m_headerSize + (m_width * m_height * m_cellSize));
212 totalMemory -= (2 * m_defaultCacheWidth * m_height * m_cellSize); 212 totalMemory -= (2 * m_defaultCacheWidth * m_height * m_cellSize);
213 totalCount --; 213 totalCount --;
214 214
215 std::cerr << "MatrixFile::~MatrixFile: " << std::endl; 215 // std::cerr << "MatrixFile::~MatrixFile: " << std::endl;
216 std::cerr << "Total storage now " << totalStorage/1024 << "K, theoretical max memory " 216 // std::cerr << "Total storage now " << totalStorage/1024 << "K, theoretical max memory "
217 << totalMemory/1024 << "K in " << totalCount << " instances" << std::endl; 217 // << totalMemory/1024 << "K in " << totalCount << " instances" << std::endl;
218 218
219 } 219 }
220 220
221 void 221 void
222 MatrixFile::resize(size_t w, size_t h) 222 MatrixFile::resize(size_t w, size_t h)