Mercurial > hg > svcore
comparison data/fileio/FileSource.cpp @ 470:dddd4ab77068
* revert changes from r1254 as well; also restore a fix from r1245
that had been reverted in the previous commit
author | Chris Cannam |
---|---|
date | Tue, 28 Oct 2008 11:37:33 +0000 |
parents | a8a7b8f698c8 |
children | 05383ee78f3e |
comparison
equal
deleted
inserted
replaced
469:a8a7b8f698c8 | 470:dddd4ab77068 |
---|---|
57 m_done(false), | 57 m_done(false), |
58 m_leaveLocalFile(false), | 58 m_leaveLocalFile(false), |
59 m_reporter(reporter), | 59 m_reporter(reporter), |
60 m_refCounted(false) | 60 m_refCounted(false) |
61 { | 61 { |
62 | |
63 if (cacheMode == PersistentCache) { | |
64 std::cerr << "FileSource::FileSource: Persistent cache mode used for \"" << fileOrUrl.toStdString() << "\"" << std::endl; | |
65 exit(1); | |
66 } | |
67 | |
68 #ifdef DEBUG_FILE_SOURCE | 62 #ifdef DEBUG_FILE_SOURCE |
69 std::cerr << "FileSource::FileSource(" << fileOrUrl.toStdString() << ")" << std::endl; | 63 std::cerr << "FileSource::FileSource(" << fileOrUrl.toStdString() << ")" << std::endl; |
70 #endif | 64 #endif |
71 | 65 |
72 if (!canHandleScheme(m_url)) { | 66 if (!canHandleScheme(m_url)) { |
127 m_done(false), | 121 m_done(false), |
128 m_leaveLocalFile(false), | 122 m_leaveLocalFile(false), |
129 m_reporter(reporter), | 123 m_reporter(reporter), |
130 m_refCounted(false) | 124 m_refCounted(false) |
131 { | 125 { |
132 | |
133 if (cacheMode == PersistentCache) { | |
134 std::cerr << "FileSource::FileSource: Persistent cache mode used for \"" << url.toString().toStdString() << "\"" << std::endl; | |
135 exit(1); | |
136 } | |
137 | |
138 #ifdef DEBUG_FILE_SOURCE | 126 #ifdef DEBUG_FILE_SOURCE |
139 std::cerr << "FileSource::FileSource(" << url.toString().toStdString() << ") [as url]" << std::endl; | 127 std::cerr << "FileSource::FileSource(" << url.toString().toStdString() << ") [as url]" << std::endl; |
140 #endif | 128 #endif |
141 | 129 |
142 if (!canHandleScheme(m_url)) { | 130 if (!canHandleScheme(m_url)) { |
415 } | 403 } |
416 | 404 |
417 void | 405 void |
418 FileSource::cleanup() | 406 FileSource::cleanup() |
419 { | 407 { |
408 if (m_done) { | |
409 delete m_localFile; // does not actually delete the file | |
410 m_localFile = 0; | |
411 } | |
420 m_done = true; | 412 m_done = true; |
421 if (m_http) { | 413 if (m_http) { |
422 QHttp *h = m_http; | 414 QHttp *h = m_http; |
423 m_http = 0; | 415 m_http = 0; |
424 h->abort(); | 416 h->abort(); |
428 QFtp *f = m_ftp; | 420 QFtp *f = m_ftp; |
429 m_ftp = 0; | 421 m_ftp = 0; |
430 f->abort(); | 422 f->abort(); |
431 f->deleteLater(); | 423 f->deleteLater(); |
432 } | 424 } |
433 delete m_localFile; // does not actually delete the file | 425 if (m_localFile) { |
434 m_localFile = 0; | 426 delete m_localFile; // does not actually delete the file |
427 m_localFile = 0; | |
428 } | |
435 } | 429 } |
436 | 430 |
437 bool | 431 bool |
438 FileSource::isRemote(QString fileOrUrl) | 432 FileSource::isRemote(QString fileOrUrl) |
439 { | 433 { |