Skip to content

Commit

Permalink
refactor: remove useless functions from binary_reader (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Tao authored and HuangWei committed Oct 12, 2019
1 parent 2b8147a commit 88bead7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
4 changes: 0 additions & 4 deletions include/dsn/utility/binary_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ class binary_reader
int read(blob &blob);
int read(blob &blob, int len);

bool next(const void **data, int *size);
bool skip(int count);
bool backup(int count);

blob get_buffer() const { return _blob; }
blob get_remaining_buffer() const { return _blob.range(static_cast<int>(_ptr - _blob.data())); }
bool is_eof() const { return _ptr >= _blob.data() + _size; }
Expand Down
36 changes: 1 addition & 35 deletions src/core/core/binary_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,38 +82,4 @@ int binary_reader::read(char *buffer, int sz)
}
}

bool binary_reader::next(const void **data, int *size)
{
if (get_remaining_size() > 0) {
*data = (const void *)_ptr;
*size = _remaining_size;

_ptr += _remaining_size;
_remaining_size = 0;
return true;
} else
return false;
}

bool binary_reader::backup(int count)
{
if (count <= static_cast<int>(_ptr - _blob.data())) {
_ptr -= count;
_remaining_size += count;
return true;
} else
return false;
}

bool binary_reader::skip(int count)
{
if (count <= get_remaining_size()) {
_ptr += count;
_remaining_size -= count;
return true;
} else {
assert(false);
return false;
}
}
}
} // namespace dsn

0 comments on commit 88bead7

Please sign in to comment.