Loading src/backend.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,26 @@ public: auto* p = const_cast<char*>(reinterpret_cast<const char*>(data)); setg(p, p, p + size); } protected: pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in) override { if (which & std::ios_base::in) { char* p = gptr(); if (dir == std::ios_base::beg) p = eback() + off; else if (dir == std::ios_base::cur) p += off; else if (dir == std::ios_base::end) p = egptr() + off; if (p < eback() || p > egptr()) return pos_type(off_type(-1)); setg(eback(), p, egptr()); return pos_type(p - eback()); } return pos_type(off_type(-1)); } pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in) override { return seekoff(off_type(pos), std::ios_base::beg, which); } }; // ---- BinDb ---- Loading Loading
src/backend.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,26 @@ public: auto* p = const_cast<char*>(reinterpret_cast<const char*>(data)); setg(p, p, p + size); } protected: pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in) override { if (which & std::ios_base::in) { char* p = gptr(); if (dir == std::ios_base::beg) p = eback() + off; else if (dir == std::ios_base::cur) p += off; else if (dir == std::ios_base::end) p = egptr() + off; if (p < eback() || p > egptr()) return pos_type(off_type(-1)); setg(eback(), p, egptr()); return pos_type(p - eback()); } return pos_type(off_type(-1)); } pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in) override { return seekoff(off_type(pos), std::ios_base::beg, which); } }; // ---- BinDb ---- Loading