mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Reduce Beast public interface and eliminate unused code:
Beast includes a lot of code for encapsulating cross-platform differences which are not used or needed by rippled. Additionally, a lot of that code implements functionality that is available from the standard library. This moves away from custom implementations of features that the standard library provides and reduces the number of platform-specific interfaces andfeatures that Beast makes available. Highlights include: * Use std:: instead of beast implementations when possible * Reduce the use of beast::String in public interfaces * Remove Windows-specific COM and Registry code * Reduce the public interface of beast::File * Reduce the public interface of beast::SystemStats * Remove unused sysctl/getsysinfo functions * Remove beast::Logger
This commit is contained in:
committed by
Vinnie Falco
parent
fefdb32d08
commit
186ca9c235
@@ -68,7 +68,8 @@ short InputStream::readShortBigEndian()
|
||||
|
||||
int InputStream::readInt()
|
||||
{
|
||||
static_bassert (sizeof (int) == 4);
|
||||
static_assert (sizeof (int) == 4,
|
||||
"The size of an integer must be exactly 4 bytes");
|
||||
|
||||
char temp[4];
|
||||
|
||||
@@ -153,7 +154,9 @@ std::int64_t InputStream::readInt64BigEndian()
|
||||
float InputStream::readFloat()
|
||||
{
|
||||
// the union below relies on these types being the same size...
|
||||
static_bassert (sizeof (std::int32_t) == sizeof (float));
|
||||
static_assert (sizeof (std::int32_t) == sizeof (float),
|
||||
"The size of a float must be equal to the size of an std::int32_t");
|
||||
|
||||
union { std::int32_t asInt; float asFloat; } n;
|
||||
n.asInt = (std::int32_t) readInt();
|
||||
return n.asFloat;
|
||||
@@ -248,11 +251,11 @@ void InputStream::skipNextBytes (std::int64_t numBytesToSkip)
|
||||
{
|
||||
if (numBytesToSkip > 0)
|
||||
{
|
||||
const int skipBufferSize = (int) bmin (numBytesToSkip, (std::int64_t) 16384);
|
||||
const int skipBufferSize = (int) std::min (numBytesToSkip, (std::int64_t) 16384);
|
||||
HeapBlock<char> temp ((size_t) skipBufferSize);
|
||||
|
||||
while (numBytesToSkip > 0 && ! isExhausted())
|
||||
numBytesToSkip -= read (temp, (int) bmin (numBytesToSkip, (std::int64_t) skipBufferSize));
|
||||
numBytesToSkip -= read (temp, (int) std::min (numBytesToSkip, (std::int64_t) skipBufferSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user