summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp')
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/src/InputBuffer.hpp24
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
};