fix minor bugs
This commit is contained in:
@@ -309,9 +309,8 @@ double StreamBuffer::read_double() {
|
||||
}
|
||||
|
||||
void StreamBuffer::write_hashvalue(const util::HashValue &hv) {
|
||||
make_space(16);
|
||||
memcpy(write_cursor_, &hv, 16);
|
||||
write_cursor_ += 16;
|
||||
write_uint64(hv.first);
|
||||
write_uint64(hv.second);
|
||||
}
|
||||
|
||||
void StreamBuffer::write_string(const std::string &s) {
|
||||
@@ -326,11 +325,9 @@ void StreamBuffer::write_string(const std::string &s) {
|
||||
}
|
||||
|
||||
util::HashValue StreamBuffer::read_hashvalue() {
|
||||
check_available(16);
|
||||
util::HashValue hv;
|
||||
memcpy(&hv, read_cursor_, 16);
|
||||
read_cursor_ += 16;
|
||||
return hv;
|
||||
uint64_t f = read_uint64();
|
||||
uint64_t s = read_uint64();
|
||||
return util::HashValue(f,s);
|
||||
}
|
||||
|
||||
std::string StreamBuffer::read_string() {
|
||||
@@ -546,7 +543,7 @@ LuaDefine(unittests_streambuffer, "c") {
|
||||
try {
|
||||
sb11.read_bytes(1);
|
||||
LuaAssert(L, false && "This should have thrown an exception");
|
||||
} catch (StreamEof) {}
|
||||
} catch (const StreamEof &) {}
|
||||
LuaAssert(L, sb11.layout_is(6, 0, 5));
|
||||
|
||||
// Write some more bytes into the stream, forcing a shift-left
|
||||
|
||||
Reference in New Issue
Block a user