diff --git a/src/utils/bedFile/bedFile.cpp b/src/utils/bedFile/bedFile.cpp index 9faaffa5e59b68c9b7d96d4dbc231c6f1e7e1aec..2d6104d9b7ee72a46780651960a13d1029ace71c 100644 --- a/src/utils/bedFile/bedFile.cpp +++ b/src/utils/bedFile/bedFile.cpp @@ -135,13 +135,10 @@ void BedFile::Open(void) { else { _bedStream = new ifstream(bedFile.c_str(), ios::in); - //if (isGzipFile(_bedStream) == true) { if(bedFile.substr(bedFile.find_last_of(".") + 1) == "gz") { delete _bedStream; _bedStream = new igzstream(bedFile.c_str(), ios::in); } - - // can we open the file? if ( !(_bedStream->good()) ) { cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl; exit (1); diff --git a/src/utils/fileType/fileType.cpp b/src/utils/fileType/fileType.cpp index bda6d5821fb8ef8545028b3eebbf1ce1af0d34e3..bd0bba2203cd4c0cb6b8edfbb664886dabaeb3f0 100644 --- a/src/utils/fileType/fileType.cpp +++ b/src/utils/fileType/fileType.cpp @@ -40,22 +40,25 @@ returns TRUE if the file has a GZIP header. Should only be run on regular files. */ bool isGzipFile(istream *file) { - //see http://www.gzip.org/zlib/rfc-gzip.html#file-format + //see http://www.gzip.org/zlib/rfc-gzip.html#file-format struct { unsigned char id1; - unsigned char id2; - unsigned char cm; +// unsigned char id2; +// unsigned char cm; } gzip_header; - if (!file->read((char*)&gzip_header, sizeof(gzip_header))) + if (!file->read((char*)&gzip_header, sizeof(gzip_header))) { return false; + } - if ( gzip_header.id1 == 0x1f - && - gzip_header.id2 == 0x8b - && - gzip_header.cm == 8 ) + if ( gzip_header.id1 == 0x1f ) +// && +// gzip_header.id2 == 0x8b +// && +// gzip_header.cm == 8 ) + { return true; - + } + file->putback(gzip_header.id1); return false; }