diff options
| author | Eddie Hung <eddie@fpgeh.com> | 2019-09-27 15:14:31 -0700 |
|---|---|---|
| committer | Eddie Hung <eddie@fpgeh.com> | 2019-09-27 15:14:31 -0700 |
| commit | 8f5710c464b2b3b91f0c7f29a9420dcb798be4c5 (patch) | |
| tree | 59bde082cba0f8f76e0e297ed57980592df7e73b /kernel/register.cc | |
| parent | f1a206ba03c5b6fba2672754d09cc649a60beeb8 (diff) | |
| parent | fd0e3a2c43d96ba31beede9865d5000230029994 (diff) | |
| download | yosys-8f5710c464b2b3b91f0c7f29a9420dcb798be4c5.tar.gz yosys-8f5710c464b2b3b91f0c7f29a9420dcb798be4c5.tar.bz2 yosys-8f5710c464b2b3b91f0c7f29a9420dcb798be4c5.zip | |
Merge remote-tracking branch 'origin/master' into xaig_dff
Diffstat (limited to 'kernel/register.cc')
| -rw-r--r-- | kernel/register.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/register.cc b/kernel/register.cc index 1fd1bad1d..8131fa279 100644 --- a/kernel/register.cc +++ b/kernel/register.cc @@ -48,7 +48,7 @@ using zlib to write gzip-compressed data every time the stream is flushed. */ class gzip_ostream : public std::ostream { public: - gzip_ostream() + gzip_ostream() : std::ostream(nullptr) { rdbuf(&outbuf); } @@ -71,7 +71,7 @@ private: str(""); return 0; } - ~gzip_streambuf() + virtual ~gzip_streambuf() { sync(); gzclose(gzf); @@ -498,7 +498,15 @@ void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<s 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()); |
