MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / open

Method open

src/openms/source/FORMAT/GzipIfstream.cpp:57–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 }
56
57 void GzipIfstream::open(const char * filename)
58 {
59 if (gzfile_ != nullptr)
60 {
61 close();
62 }
63 gzfile_ = gzopen(filename, "rb"); // read binary: always open in binary mode because windows and mac open in text mode
64
65 //aborting, ahhh!
66 if (gzfile_ == nullptr)
67 {
68 close();
69 throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename);
70 }
71 else
72 {
73 stream_at_end_ = false;
74 /* crc = crc32(0L, Z_NULL, 0);
75 FILE* file = fopen(filename,"rb");
76 fseek(file,8,SEEK_END);
77 char crc_[4];
78 fgets(crc_,5,file);
79 original_crc = 0;
80 original_crc |= crc_[0];
81 original_crc = original_crc << 8;
82 original_crc |= crc_[1];
83 original_crc = original_crc << 8;
84 original_crc |= crc_[2];
85 original_crc = original_crc << 8;
86 original_crc |= crc_[3];
87 original_crc = original_crc << 8;
88 cout<<hex<<crc_[0]<<hex<<crc_[1]<<hex<<crc_[2]<<hex<<crc_[3];
89 cout<<dec<<"ORIGINAL"<<original_crc<<endl;
90 const int CRC_BUFFER_SIZE = 8192;
91 unsigned char buf[CRC_BUFFER_SIZE];
92 size_t bufLen;
93 FILE* file2 = fopen(filename,"rb");
94 ** accumulate crc32 from file **
95 crc = 0;
96 while (1)
97 {
98 bufLen = fread( buf, 1, CRC_BUFFER_SIZE, file2 );
99 if (bufLen == 0) {
100 if (ferror(file2)) {
101 fprintf( stderr, "error reading file\n" );
102 return;
103 }
104 break;
105 }
106 crc = crc32( crc, buf, bufLen );
107 }
108 cout<<"CRC" <<crc<<endl;
109 */
110
111 }
112 }
113
114 void GzipIfstream::close()

Callers 15

create_header_sourcesFunction · 0.45
create_source_sourcesFunction · 0.45
create_sourcesFunction · 0.45
register_fileFunction · 0.45
CSVWriterMethod · 0.45
writeToLogFile_Method · 0.45
exportEntriesMethod · 0.45
QApplicationTOPPMethod · 0.45
main_Method · 0.45
main_Method · 0.45
main_Method · 0.45
FileAbstractionMethod · 0.45

Calls

no outgoing calls

Tested by 4

debugFileCreator_Method · 0.36
filesEqualFunction · 0.36
compressTrieDBMethod · 0.36
generateTrieDBMethod · 0.36