*/
class gzip_ostream : public std::ostream {
public:
- gzip_ostream()
+ gzip_ostream() : std::ostream(nullptr)
{
rdbuf(&outbuf);
}
str("");
return 0;
}
- ~gzip_streambuf()
+ virtual ~gzip_streambuf()
{
sync();
gzclose(gzf);
if (f != NULL) {
// Check for gzip magic
unsigned char magic[3];
- int n = readsome(*ff, reinterpret_cast<char*>(magic), 3);
+ int n = 0;
+ while (n < 3)
+ {
+ int c = ff->get();
+ if (c != EOF) {
+ magic[n] = (unsigned char) c;
+ }
+ n++;
+ }
if (n == 3 && magic[0] == 0x1f && magic[1] == 0x8b) {
#ifdef YOSYS_ENABLE_ZLIB
log("Found gzip magic in file `%s', decompressing using zlib.\n", filename.c_str());