#define CHUNK 16384 #include #include #include #include #include "cookiebot_conf.h" #include #if USE_GZIP == ON #include #endif auto getModuleStorage(std::string filename) -> std::string { std::string::size_type idx; idx = filename.rfind('.'); if(idx != std::string::npos) { std::string extension = filename.substr(idx+1); #if USE_GZIP == ON if(extension=="gz") { FILE *out; out=fopen(filename.substr(0,idx).c_str(), "wb"); struct gzFile_s *file = gzopen(filename.c_str(),"rb"); size_t len=1024*1024; gzrewind(file); uint8_t *buf=new uint8_t[len]; gzread(file, (void*)buf, len); std::cout << buf << std::endl; fwrite((void*)buf, len, 1, out); gzclose(file); fclose(out); delete[] buf; return filename.substr(0,idx); } #endif return filename; } else { return nullptr; } }