From 4cfffca8c276df68f48af2827d7fc5f3660106ac Mon Sep 17 00:00:00 2001 From: Mike Goslin Date: Fri, 15 Dec 2000 18:47:12 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/downloader/extractor.cxx | 17 +++++++++-------- panda/src/downloader/extractor.h | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/panda/src/downloader/extractor.cxx b/panda/src/downloader/extractor.cxx index 2f67de6658..4564580cb4 100644 --- a/panda/src/downloader/extractor.cxx +++ b/panda/src/downloader/extractor.cxx @@ -87,11 +87,6 @@ initiate(Filename &source_file, const Filename &rel_path) { _total_bytes_read = 0; _read_all_input = false; _handled_all_input = false; - //_mfile.reset(); - if (_mfile != NULL) - delete _mfile; - _mfile = new Multifile; - _buffer_start = _buffer->_buffer; return ES_success; } @@ -102,12 +97,13 @@ initiate(Filename &source_file, const Filename &rel_path) { //////////////////////////////////////////////////////////////////// int Extractor:: run(void) { - nassertr(_mfile != NULL, ES_error); + if (_mfile == NULL) + _mfile = new Multifile; + // See if there is anything left in the source file if (_read_all_input == false) { _read_stream.read(_buffer->_buffer, _buffer->get_length()); _source_buffer_length = _read_stream.gcount(); - _buffer_size = _source_buffer_length; _total_bytes_read += _source_buffer_length; if (_read_stream.eof()) { nassertr(_total_bytes_read == _source_file_length, false); @@ -115,10 +111,15 @@ run(void) { } } + char *buffer_start = _buffer->_buffer; + int buffer_size = _source_buffer_length; + // Write to the out file - if (_mfile->write(_buffer_start, _buffer_size, _rel_path) == true) { + if (_mfile->write(buffer_start, buffer_size, _rel_path) == true) { _read_stream.close(); _source_file.unlink(); + delete _mfile; + _mfile = NULL; return ES_success; } return ES_ok; diff --git a/panda/src/downloader/extractor.h b/panda/src/downloader/extractor.h index cbf4369278..67db8e7a25 100644 --- a/panda/src/downloader/extractor.h +++ b/panda/src/downloader/extractor.h @@ -51,8 +51,6 @@ private: int _source_buffer_length; Filename _source_file; Filename _rel_path; - char *_buffer_start; - int _buffer_size; }; #endif