forked from boostorg/beast
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:
1 parent
fefdb32d08
commit
186ca9c235
82 files changed
+361
-7762
No files matched your search
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -98,7 +100,8 @@ bool OutputStream::writeShortBigEndian (short value)
|
||||
|
||||
bool OutputStream::writeInt32 (std::int32_t value)
|
||||
{
|
||||
static_bassert (sizeof (std::int32_t) == 4);
|
||||
static_assert (sizeof (std::int32_t) == 4,
|
||||
"The size of an integer must be exactly 4 bytes.");
|
||||
|
||||
const unsigned int v = ByteOrder::swapIfBigEndian ((std::uint32_t) value);
|
||||
return write (&v, 4);
|
||||
@@ -106,7 +109,8 @@ bool OutputStream::writeInt32 (std::int32_t value)
|
||||
|
||||
bool OutputStream::writeInt (int value)
|
||||
{
|
||||
static_bassert (sizeof (int) == 4);
|
||||
static_assert (sizeof (int) == 4,
|
||||
"The size of an integer must be exactly 4 bytes.");
|
||||
|
||||
const unsigned int v = ByteOrder::swapIfBigEndian ((unsigned int) value);
|
||||
return write (&v, 4);
|
||||
@@ -114,14 +118,16 @@ bool OutputStream::writeInt (int value)
|
||||
|
||||
bool OutputStream::writeInt32BigEndian (int value)
|
||||
{
|
||||
static_bassert (sizeof (std::int32_t) == 4);
|
||||
static_assert (sizeof (std::int32_t) == 4,
|
||||
"The size of an integer must be exactly 4 bytes.");
|
||||
const std::uint32_t v = ByteOrder::swapIfLittleEndian ((std::uint32_t) value);
|
||||
return write (&v, 4);
|
||||
}
|
||||
|
||||
bool OutputStream::writeIntBigEndian (int value)
|
||||
{
|
||||
static_bassert (sizeof (int) == 4);
|
||||
static_assert (sizeof (int) == 4,
|
||||
"The size of an integer must be exactly 4 bytes.");
|
||||
const unsigned int v = ByteOrder::swapIfLittleEndian ((unsigned int) value);
|
||||
return write (&v, 4);
|
||||
}
|
||||
@@ -274,7 +280,7 @@ int OutputStream::writeFromInputStream (InputStream& source, std::int64_t numByt
|
||||
while (numBytesToWrite > 0)
|
||||
{
|
||||
char buffer [8192];
|
||||
const int num = source.read (buffer, (int) bmin (numBytesToWrite, (std::int64_t) sizeof (buffer)));
|
||||
const int num = source.read (buffer, (int) std::min (numBytesToWrite, (std::int64_t) sizeof (buffer)));
|
||||
|
||||
if (num <= 0)
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user