Source release v3.0.1 + third_party

This commit is contained in:
Joey Parrish
2015-09-11 16:15:34 -07:00
parent 0546ee6732
commit b5d6be97cb
32 changed files with 1344 additions and 129 deletions

View File

@@ -24,9 +24,9 @@ namespace wvcdm {
class BufferReader {
public:
BufferReader(const uint8_t* buf, size_t size)
: buf_(buf), size_(size), pos_(0) {}
: buf_(buf), size_(buf != NULL ? size : 0), pos_(0) {}
bool HasBytes(int count) { return (pos() + count <= size()); }
bool HasBytes(size_t count) { return (pos() + count <= size()); }
// Read a value from the stream, performing endian correction,
// and advance the stream pointer.
@@ -38,8 +38,8 @@ class BufferReader {
bool Read8(uint64_t* v) WARN_UNUSED_RESULT;
bool Read8s(int64_t* v) WARN_UNUSED_RESULT;
bool ReadString(std::string* str, int count) WARN_UNUSED_RESULT;
bool ReadVec(std::vector<uint8_t>* t, int count) WARN_UNUSED_RESULT;
bool ReadString(std::string* str, size_t count) WARN_UNUSED_RESULT;
bool ReadVec(std::vector<uint8_t>* t, size_t count) WARN_UNUSED_RESULT;
// These variants read a 4-byte integer of the corresponding signedness and
// store it in the 8-byte return type.
@@ -47,7 +47,7 @@ class BufferReader {
bool Read4sInto8s(int64_t* v) WARN_UNUSED_RESULT;
// Advance the stream by this many bytes.
bool SkipBytes(int nbytes) WARN_UNUSED_RESULT;
bool SkipBytes(size_t nbytes) WARN_UNUSED_RESULT;
const uint8_t* data() const { return buf_; }
size_t size() const { return size_; }