diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-16 18:32:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-16 18:32:08 +0000 |
commit | 84b532c711d3e644d6ba05e8118356310fd68fbf (patch) | |
tree | 33d34c031bb6342b29a3801d2cc1f9208f637920 /Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp | |
parent | 32d816973b284f3e5a0bd28a7ad5ef73e3102b34 (diff) |
dvisvgm 3.2
git-svn-id: svn://tug.org/texlive/trunk@69453 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp index ea6ce17a709..17a383fb3b6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp @@ -2,7 +2,7 @@ ** InputBuffer.hpp ** ** ** ** This file is part of dvisvgm -- a fast DVI to SVG converter ** -** Copyright (C) 2005-2023 Martin Gieseking <martin.gieseking@uos.de> ** +** Copyright (C) 2005-2024 Martin Gieseking <martin.gieseking@uos.de> ** ** ** ** This program is free software; you can redistribute it and/or ** ** modify it under the terms of the GNU General Public License as ** @@ -25,8 +25,9 @@ #include <cstdint> #include <cstring> #include <istream> -#include <string> #include <ostream> +#include <string> +#include <vector> struct InputBuffer { virtual ~InputBuffer () =default; @@ -42,26 +43,23 @@ class StreamInputBuffer : public InputBuffer { public: explicit StreamInputBuffer (std::istream &is, size_t bufsize=1024); StreamInputBuffer (const StreamInputBuffer &ib) =delete; - ~StreamInputBuffer () override; int get () override; int peek () const override; int peek (size_t n) const override; - bool eof () const override {return pos() == _size1 && _size2 == 0;} - void invalidate () override {_bufptr = _buf1+_size1; _size2 = 0;} + bool eof () const override {return _pos == _size1 && _size2 == 0;} + void invalidate () override {_pos = _size1; _size2 = 0;} void operator = (const StreamInputBuffer &ib) =delete; protected: - int fillBuffer (uint8_t *buf); - size_t pos () const {return _bufptr-_buf1;} + size_t fillBuffer (std::vector<uint8_t> &buf); private: std::istream &_is; - const size_t _bufsize; ///< maximal number of bytes each buffer can hold - uint8_t *_buf1; ///< pointer to first buffer - uint8_t *_buf2; ///< pointer to second buffer - size_t _size1; ///< number of bytes in buffer 1 - size_t _size2; ///< number of bytes in buffer 2 - uint8_t *_bufptr; ///< pointer to next byte to read + std::vector<uint8_t> _buf1; ///< first buffer + std::vector<uint8_t> _buf2; ///< second buffer + size_t _size1; ///< number of bytes in buffer 1 + size_t _size2; ///< number of bytes in buffer 2 + size_t _pos=0; ///< position of next character to be read from first buffer }; |