*** empty log message ***

This commit is contained in:
Mike Goslin 2000-12-15 04:16:14 +00:00
parent 2a018ab8e0
commit f29c43153c
2 changed files with 17 additions and 9 deletions

View File

@ -101,6 +101,7 @@ initiate(Filename &source_file, const Filename &rel_path) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int Extractor:: int Extractor::
run(void) { run(void) {
nassertr(_mfile != NULL, ES_error);
// See if there is anything left in the source file // See if there is anything left in the source file
if (_read_all_input == false) { if (_read_all_input == false) {
_read_stream.read(_buffer->_buffer, _buffer->get_length()); _read_stream.read(_buffer->_buffer, _buffer->get_length());
@ -119,6 +120,7 @@ run(void) {
_read_stream.close(); _read_stream.close();
_source_file.unlink(); _source_file.unlink();
delete _mfile; delete _mfile;
_mfile = NULL;
return ES_success; return ES_success;
} }
return ES_ok; return ES_ok;

View File

@ -300,17 +300,23 @@ write_to_multifile(ofstream &write_stream) {
bool Multifile::Memfile:: bool Multifile::Memfile::
write(char *&start, int &size, const Filename &rel_path) { write(char *&start, int &size, const Filename &rel_path) {
// Make sure we've got a complete header first // Make sure we've got a complete header first
if (parse_header(start, size) == false) if (parse_header(start, size) == false) {
if (express_cat.is_debug())
express_cat.debug()
<< "Multifile::Memfile::write() - parse_header() == false"
<< endl;
return false; return false;
}
// Try to open the file for writing // Try to open the file for writing
if (_file_open == false) { if (_file_open == false) {
Filename name = rel_path.get_fullpath() + _name.get_fullpath(); Filename name = rel_path.get_fullpath() + _name.get_fullpath();
name.set_binary(); name.set_binary();
name.make_dir(); name.make_dir();
express_cat.debug() if (express_cat.is_debug())
<< "Multifile::Memfile::write() - Opening mem file: " << name express_cat.debug()
<< " for writing" << endl; << "Multifile::Memfile::write() - Opening mem file: " << name
<< " for writing" << endl;
if ((_file_open = name.open_write(_write_stream)) == false) { if ((_file_open = name.open_write(_write_stream)) == false) {
express_cat.error() express_cat.error()
<< "Multfile::Memfile::write() - Couldn't open file: " << "Multfile::Memfile::write() - Couldn't open file: "
@ -366,6 +372,8 @@ Multifile(void) {
Multifile:: Multifile::
~Multifile(void) { ~Multifile(void) {
_files.erase(_files.begin(), _files.end()); _files.erase(_files.begin(), _files.end());
if (_current_mfile != NULL)
delete _current_mfile;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -584,16 +592,14 @@ write(char *&start, int &size, const Filename &rel_path) {
if (parse_header(start, size) == false) if (parse_header(start, size) == false)
return false; return false;
//if (_current_mfile == (Memfile *)0L)
// _current_mfile = new Memfile;
while (_num_mfiles > 0) { while (_num_mfiles > 0) {
if (_current_mfile == NULL) if (_current_mfile == NULL) {
_current_mfile = new Memfile; _current_mfile = new Memfile;
}
if (_current_mfile->write(start, size, rel_path) == true) { if (_current_mfile->write(start, size, rel_path) == true) {
_num_mfiles--; _num_mfiles--;
delete _current_mfile; delete _current_mfile;
// _current_mfile->reset(); _current_mfile = NULL;
} else } else
return false; return false;
} }