Readd openNewStream function for gzdopen() via SMUSH

This commit is contained in:
James Brown 2003-12-13 11:03:42 +00:00
parent 135bea3ba8
commit ea93407848
2 changed files with 18 additions and 7 deletions

10
lab.cpp
View File

@ -90,6 +90,16 @@ Block *Lab::getFileBlock(const char *filename) const {
return new Block(data, i->second.len);
}
std::FILE *Lab::openNewStream(const char *filename) const {
file_map_type::const_iterator i = find_filename(filename);
if (i == file_map_.end())
return NULL;
std::fseek(f_, i->second.offset, SEEK_SET);
return f_;
}
int Lab::fileLength(const char *filename) const {
file_map_type::const_iterator i = find_filename(filename);
if (i == file_map_.end())

View File

@ -113,13 +113,14 @@ Block *ResourceLoader::getFileBlock(const char *filename) const {
return l->getFileBlock(filename);
}
//std::FILE *ResourceLoader::openNewStream(const char *filename) const {
// const Lab *l = findFile(filename);
// if (l == NULL)
// return NULL;
// else
// return l->openNewStream(filename);
//}
std::FILE *ResourceLoader::openNewStream(const char *filename) const {
const Lab *l = findFile(filename);
if (l == NULL)
return NULL;
else
return l->openNewStream(filename);
}
int ResourceLoader::fileLength(const char *filename) const {
const Lab *l = findFile(filename);