diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 64c135d19c..d79834d8c0 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -2590,6 +2590,9 @@
+
+
+
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index b2c9bd29d6..2748a1eaff 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -3048,6 +3048,15 @@
[1] Ripple\common
+
+ [2] Old Ripple\ripple_core\functional
+
+
+ [2] Old Ripple\ripple_core\functional
+
+
+ [2] Old Ripple\ripple_core\functional
+
diff --git a/Builds/VisualStudio2013/ripple.sln b/Builds/VisualStudio2013/ripple.sln
index 7eba733d5d..12114c44cd 100644
--- a/Builds/VisualStudio2013/ripple.sln
+++ b/Builds/VisualStudio2013/ripple.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
+# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "beast", "..\..\src\beast\Builds\VisualStudio2013\beast.vcxproj", "{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}"
@@ -16,7 +16,6 @@ Global
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.ActiveCfg = Debug|Win32
- {73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|Win32.Build.0 = Debug|Win32
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.ActiveCfg = Debug|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Debug|x64.Build.0 = Debug|x64
{73C5A0F0-7629-4DE7-9194-BE7AC6C19535}.Release|Win32.ActiveCfg = Release|Win32
diff --git a/doc/todo/VFALCO_TODO.txt b/doc/todo/VFALCO_TODO.txt
index 4f11a6f5c2..16dffd223d 100644
--- a/doc/todo/VFALCO_TODO.txt
+++ b/doc/todo/VFALCO_TODO.txt
@@ -53,19 +53,6 @@ David Features:
down the cache and then something that uses the cache, objects may get
put in the cache after it was shut down.
-- Do something about the throw() reporting weaknesses:
- * Make sure all Sconstruct and .pro builds have debug symbols in release
- * Replace all throw with beast::Throw()
- (Only in ripple sources, not in Subtrees/, protobuf, or websocket)
- - Improved Beast exception object, provides __FILE__ and __LINE__
- - Add file and line capabilities to beast::Throw()
- - Allow beast::Throw to be hooked for logging
- - Add stack trace capability to beast::Throw() diagnostics via the hook
- (use the existing beast::SystemStats::getStackBacktrace())
- - Implement getStackBacktrace for BEAST_BSD targets
- - Add UnhandledExceptionCatcher to beast
- - Return EXIT_FAILURE on unhandled exception
-
- Consolidate JSON code maybe use Beast
- Deeply create directories specified in config settings
@@ -132,20 +119,10 @@ David Features:
- Rename LedgerMaster to Ledgers, create ILedgers interface.
-- Replace all NULL with nullptr
-
-- Make TxFormats a member of ICore instead of a singleton.
- PROBLEM: STObject derived classes like STInt16 make direct use of the
- singleton. It might have to remain a singleton. At the very least,
- it should be a SharedSingleton to resolve ordering issues.
-
- Replace C11X with BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
- Remove "ENABLE_INSECURE" when the time is right.
-- lift unique_ptr / auto_ptr into ripple namespace,
- or replace with ScopedPointer (preferred)
-
- Go searching through VFALCO notes and fix everything
- Deal with function-level statics used for SqliteDatabase (like in
diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj b/src/beast/Builds/VisualStudio2013/beast.vcxproj
index ee0ff1d65f..84262d0984 100644
--- a/src/beast/Builds/VisualStudio2013/beast.vcxproj
+++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj
@@ -47,12 +47,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -142,7 +136,6 @@
-
@@ -299,7 +292,6 @@
-
@@ -340,26 +332,16 @@
-
-
-
-
-
-
-
-
-
-
@@ -988,12 +970,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1012,12 +988,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1036,12 +1006,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1114,18 +1078,6 @@
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
true
@@ -1138,12 +1090,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -1156,18 +1102,6 @@
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
diff --git a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
index eccb9d4e45..91a7c34707 100644
--- a/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
+++ b/src/beast/Builds/VisualStudio2013/beast.vcxproj.filters
@@ -4,9 +4,6 @@
beast_core\native
-
- beast_core\native
-
beast_core\native
@@ -111,9 +108,6 @@
{d3ea4af5-ae48-4144-a2ef-a212342d72ee}
-
- {a1a38659-7779-41d6-8a3c-068433c4deaf}
-
{69e28551-92ea-420b-a465-75ed248e3b59}
@@ -159,9 +153,6 @@
{1b2e8962-c087-4453-8107-7077c2de5846}
-
- {91538dcf-b219-4c80-9861-bb4949089775}
-
{c0724499-ab69-40c3-90e2-65242dbd2eaa}
@@ -326,9 +317,6 @@
beast_core\containers
-
- beast_core\containers
-
beast_core\containers
@@ -401,21 +389,12 @@
beast_core\text
-
- beast_core\threads
-
beast_core\threads
beast_core\threads
-
- beast_core\threads
-
-
- beast_core\threads
-
beast_core\threads
@@ -425,12 +404,6 @@
beast_core\time
-
- beast_core\xml
-
-
- beast_core\xml
-
beast_core\diagnostic
@@ -521,24 +494,9 @@
beast_core\thread
-
- beast_core\thread
-
-
- beast_core\thread\detail
-
beast_core\thread\detail
-
- beast_core\thread\impl
-
-
- beast_core\thread\impl
-
-
- beast_core\thread\impl
-
beast_core\thread
@@ -677,9 +635,6 @@
beast
-
- beast
-
beast\utility
@@ -1265,9 +1220,6 @@
beast_core\native
-
- beast_core\native
-
beast_core\native
@@ -1277,9 +1229,6 @@
beast_core\native
-
- beast_core\native
-
beast_core\native
@@ -1307,30 +1256,15 @@
beast_core\text
-
- beast_core\threads
-
-
- beast_core\threads
-
beast_core\time
-
- beast_core\xml
-
-
- beast_core\xml
-
beast_core\native
beast_core\native
-
- beast_core\native
-
beast_core\native
@@ -1391,9 +1325,6 @@
beast_core\diagnostic
-
- beast_core\thread\impl
-
beast_core\thread
diff --git a/src/beast/CodingStyle.md b/src/beast/CodingStyle.md
index 92b35da4ef..bd598c3b51 100644
--- a/src/beast/CodingStyle.md
+++ b/src/beast/CodingStyle.md
@@ -120,7 +120,7 @@ overlooked. Blank lines are used to separate code into "paragraphs."
`static_cast`. And when you're reinterpreting data, always use
`reinterpret_cast`.
* Until C++ gets a universal 64-bit primitive type (part of the C++11
- standard), it's best to stick to the `int64` and `uint64` typedefs.
+ standard), it's best to stick to the `std::int64_t` and `std::uint64_t` typedefs.
## Object lifetime and ownership
diff --git a/src/beast/TODO.txt b/src/beast/TODO.txt
index b58e7f661c..5ea09353ae 100644
--- a/src/beast/TODO.txt
+++ b/src/beast/TODO.txt
@@ -2,12 +2,12 @@
BEAST TODO
--------------------------------------------------------------------------------
+- Change sqdb to use exceptions instead of errors
+
- Use SemanticVersion for beast version numbers to replace BEAST_VERSION
- add support for a __PRETTY_FUNCTION__ equivalent for all environments
-- add expectThrow() to UnitTest, where it expects an exception
-
- Import secp256k1 from sipa
- Set sqlite thread safety model to '2' in beast_sqlite
@@ -18,8 +18,6 @@ BEAST TODO
- Rename HeapBlock routines to not conflict with _CRTDBG_MAP_ALLOC macros
-- Design a WeakPtr / SharedPtr / SharedObject intrusive system
-
- Implement beast::Bimap?
- Use Bimap for storage in the DeadlineTimer::Manager, to support
@@ -28,39 +26,18 @@ BEAST TODO
- Think about adding a shouldStop bool to InterruptibleThread, along
with a shouldStop () function returning bool, and a stop() method.
-- Make OwnedArray add routines return a pointer instead of reference
-
- Tidy up CacheLine, MemoryAlignment
-- Remove anything having to do with DLL builds like
- BEAST_DLL, BEAST_DLL_BUILD, BEAST_DISABLE_DLL_ALLOCATORS
-
-- Fix FifoFreeStoreWithTLS reference counting bug
-
- Implement a reasonable substitute for boost's thread_local_storage
-- Think about doing away with BEAST_CALLTYPE and BEAST_API
-
- Rename malloc/calloc JUCE members that conflict with the debug CRT from MSVC
- Reformat every Doxygen comment
- Fix Doxygen metatags
- update Beast Doxyfile
-- Rename include guards to boost style, e.g. BEAST_THROW_H_INCLUDED
-
-- Clean up CacheLine, StaticObject
-
-- Clean up ConcurrentObject
-
- Rename SharedData to SharedState or something?
-- Put BEAST_PUBLIC_FUNCTION in front of all loose functions
-
-- restructure the repo sources to look like this:
- /Source/beast/beast_core/beast_core.h
- etc...
-
- Make sure the template BeastConfig.h is included in the Doxyfile
- Implement robust key/value database with bulk write
diff --git a/src/beast/beast/Arithmetic.h b/src/beast/beast/Arithmetic.h
index da2925030e..bcbadc43dd 100644
--- a/src/beast/beast/Arithmetic.h
+++ b/src/beast/beast/Arithmetic.h
@@ -25,11 +25,11 @@
#define BEAST_ARITHMETIC_H_INCLUDED
#include "Config.h"
-#include "CStdInt.h"
#include "utility/noexcept.h"
#include
+#include
#include
namespace beast {
@@ -197,12 +197,6 @@ inline bool isPositiveAndNotGreaterThan (const int valueToTest, const int upperL
}
//==============================================================================
-/** Handy function to swap two values. */
-template
-inline void swapVariables (Type& variable1, Type& variable2)
-{
- std::swap (variable1, variable2);
-}
/** Handy function for getting the number of elements in a simple const C array.
E.g.
@@ -220,54 +214,12 @@ int numElementsInArray (Type (&array)[N])
return N;
}
-//==============================================================================
-// Some useful maths functions that aren't always present with all compilers and build settings.
-
-/** Using beast_hypot is easier than dealing with the different types of hypot function
- that are provided by the various platforms and compilers. */
-template
-inline Type beast_hypot (Type a, Type b) noexcept
-{
- #if BEAST_MSVC
- return static_cast (_hypot (a, b));
- #else
- return static_cast (hypot (a, b));
- #endif
-}
-
/** 64-bit abs function. */
-inline int64 abs64 (const int64 n) noexcept
+inline std::int64_t abs64 (const std::int64_t n) noexcept
{
return (n >= 0) ? n : -n;
}
-//==============================================================================
-/** A predefined value for Pi, at double-precision.
- @see float_Pi
-*/
-const double double_Pi = 3.1415926535897932384626433832795;
-
-/** A predefined value for Pi, at single-precision.
- @see double_Pi
-*/
-const float float_Pi = 3.14159265358979323846f;
-
-
-//==============================================================================
-/** The isfinite() method seems to vary between platforms, so this is a
- platform-independent function for it.
-*/
-template
-inline bool beast_isfinite (FloatingPointType value)
-{
- #if BEAST_WINDOWS
- return _finite (value);
- #elif BEAST_ANDROID
- return isfinite (value);
- #else
- return std::isfinite (value);
- #endif
-}
//==============================================================================
#if BEAST_MSVC
@@ -311,149 +263,6 @@ inline int roundToInt (const FloatType value) noexcept
#pragma optimize ("", on) // resets optimisations to the project defaults
#endif
-/** Fast floating-point-to-integer conversion.
-
- This is a slightly slower and slightly more accurate version of roundDoubleToInt(). It works
- fine for values above zero, but negative numbers are rounded the wrong way.
-*/
-inline int roundToIntAccurate (const double value) noexcept
-{
- #ifdef __INTEL_COMPILER
- #pragma float_control (pop)
- #endif
-
- return roundToInt (value + 1.5e-8);
-}
-
-/** Fast floating-point-to-integer conversion.
-
- This is faster than using the normal c++ cast to convert a double to an int, and
- it will round the value to the nearest integer, rather than rounding it down
- like the normal cast does.
-
- Note that this routine gets its speed at the expense of some accuracy, and when
- rounding values whose floating point component is exactly 0.5, odd numbers and
- even numbers will be rounded up or down differently. For a more accurate conversion,
- see roundDoubleToIntAccurate().
-*/
-inline int roundDoubleToInt (const double value) noexcept
-{
- return roundToInt (value);
-}
-
-/** Fast floating-point-to-integer conversion.
-
- This is faster than using the normal c++ cast to convert a float to an int, and
- it will round the value to the nearest integer, rather than rounding it down
- like the normal cast does.
-
- Note that this routine gets its speed at the expense of some accuracy, and when
- rounding values whose floating point component is exactly 0.5, odd numbers and
- even numbers will be rounded up or down differently.
-*/
-inline int roundFloatToInt (const float value) noexcept
-{
- return roundToInt (value);
-}
-
-//==============================================================================
-/** Returns true if the specified integer is a power-of-two.
-*/
-template
-bool isPowerOfTwo (IntegerType value)
-{
- return (value & (value - 1)) == 0;
-}
-
-/** Returns the smallest power-of-two which is equal to or greater than the given integer.
-*/
-inline int nextPowerOfTwo (int n) noexcept
-{
- --n;
- n |= (n >> 1);
- n |= (n >> 2);
- n |= (n >> 4);
- n |= (n >> 8);
- n |= (n >> 16);
- return n + 1;
-}
-
-/** Performs a modulo operation, but can cope with the dividend being negative.
- The divisor must be greater than zero.
-*/
-template
-IntegerType negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept
-{
- bassert (divisor > 0);
- dividend %= divisor;
- return (dividend < 0) ? (dividend + divisor) : dividend;
-}
-
-//==============================================================================
-#if (BEAST_INTEL && BEAST_32BIT) || defined (DOXYGEN)
- /** This macro can be applied to a float variable to check whether it contains a denormalised
- value, and to normalise it if necessary.
- On CPUs that aren't vulnerable to denormalisation problems, this will have no effect.
- */
- #define BEAST_UNDENORMALISE(x) x += 1.0f; x -= 1.0f;
-#else
- #define BEAST_UNDENORMALISE(x)
-#endif
-
-//==============================================================================
-/** This namespace contains a few template classes for helping work out class type variations.
-*/
-namespace TypeHelpers
-{
- #if BEAST_VC8_OR_EARLIER
- #define PARAMETER_TYPE(type) const type&
- #else
- /** The ParameterType struct is used to find the best type to use when passing some kind
- of object as a parameter.
-
- Of course, this is only likely to be useful in certain esoteric template situations.
-
- Because "typename TypeHelpers::ParameterType::type" is a bit of a mouthful, there's
- a PARAMETER_TYPE(SomeClass) macro that you can use to get the same effect.
-
- E.g. "myFunction (PARAMETER_TYPE (int), PARAMETER_TYPE (MyObject))"
- would evaluate to "myfunction (int, const MyObject&)", keeping any primitive types as
- pass-by-value, but passing objects as a const reference, to avoid copying.
- */
- template struct ParameterType { typedef const Type& type; };
-
- #if ! DOXYGEN
- template struct ParameterType { typedef Type& type; };
- template struct ParameterType { typedef Type* type; };
- template <> struct ParameterType { typedef char type; };
- template <> struct ParameterType { typedef unsigned char type; };
- template <> struct ParameterType { typedef short type; };
- template <> struct ParameterType { typedef unsigned short type; };
- template <> struct ParameterType { typedef int type; };
- template <> struct ParameterType { typedef unsigned int type; };
- template <> struct ParameterType { typedef long type; };
- template <> struct ParameterType { typedef unsigned long type; };
- template <> struct ParameterType { typedef int64 type; };
- template <> struct ParameterType { typedef uint64 type; };
- template <> struct ParameterType { typedef bool type; };
- template <> struct ParameterType { typedef float type; };
- template <> struct ParameterType { typedef double type; };
- #endif
-
- /** A helpful macro to simplify the use of the ParameterType template.
- @see ParameterType
- */
- #define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType::type
- #endif
-
-
- /** These templates are designed to take a type, and if it's a double, they return a double
- type; for anything else, they return a float type.
- */
- template struct SmallestFloatType { typedef float type; };
- template <> struct SmallestFloatType { typedef double type; };
-}
-
}
#endif
diff --git a/src/beast/beast/Atomic.h b/src/beast/beast/Atomic.h
index bd252f70b3..ffeb82a695 100644
--- a/src/beast/beast/Atomic.h
+++ b/src/beast/beast/Atomic.h
@@ -25,11 +25,12 @@
#define BEAST_ATOMIC_H_INCLUDED
#include "Config.h"
-#include "CStdInt.h"
#include "StaticAssert.h"
#include "utility/noexcept.h"
+#include
+
namespace beast {
//==============================================================================
@@ -158,10 +159,10 @@ private:
template
static inline Dest castTo (Source value) noexcept { union { Dest d; Source s; } u; u.s = value; return u.d; }
- static inline Type castFrom32Bit (int32 value) noexcept { return castTo (value); }
- static inline Type castFrom64Bit (int64 value) noexcept { return castTo (value); }
- static inline int32 castTo32Bit (Type value) noexcept { return castTo (value); }
- static inline int64 castTo64Bit (Type value) noexcept { return castTo (value); }
+ static inline Type castFrom32Bit (std::int32_t value) noexcept { return castTo (value); }
+ static inline Type castFrom64Bit (std::int64_t value) noexcept { return castTo (value); }
+ static inline std::int32_t castTo32Bit (Type value) noexcept { return castTo (value); }
+ static inline std::int64_t castTo64Bit (Type value) noexcept { return castTo (value); }
Type operator++ (int); // better to just use pre-increment with atomics..
@@ -174,14 +175,14 @@ private:
return sizeof (ValueType) == 1 ? (ValueType) -(signed char) n
: (sizeof (ValueType) == 2 ? (ValueType) -(short) n
: (sizeof (ValueType) == 4 ? (ValueType) -(int) n
- : ((ValueType) -(int64) n)));
+ : ((ValueType) -(std::int64_t) n)));
}
/** This templated negate function will negate pointers as well as integers */
template
inline PointerType* negateValue (PointerType* n) noexcept
{
- return reinterpret_cast (-reinterpret_cast (n));
+ return reinterpret_cast (-reinterpret_cast (n));
}
};
@@ -274,14 +275,14 @@ template
inline Type Atomic::get() const noexcept
{
#if BEAST_ATOMICS_MAC
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier ((int32_t) 0, (BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value))
- : castFrom64Bit ((int64) OSAtomicAdd64Barrier ((int64_t) 0, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) OSAtomicAdd32Barrier ((int32_t) 0, (BEAST_MAC_ATOMICS_VOLATILE int32_t*) &value))
+ : castFrom64Bit ((std::int64_t) OSAtomicAdd64Barrier ((int64_t) 0, (BEAST_MAC_ATOMICS_VOLATILE int64_t*) &value));
#elif BEAST_ATOMICS_WINDOWS
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) beast_InterlockedExchangeAdd ((volatile long*) &value, (long) 0))
- : castFrom64Bit ((int64) beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) beast_InterlockedExchangeAdd ((volatile long*) &value, (long) 0))
+ : castFrom64Bit ((std::int64_t) beast_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0));
#elif BEAST_ATOMICS_GCC
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0))
- : castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &value, 0));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) __sync_add_and_fetch ((volatile std::int32_t*) &value, 0))
+ : castFrom64Bit ((std::int64_t) __sync_add_and_fetch ((volatile std::int64_t*) &value, 0));
#endif
}
@@ -293,8 +294,8 @@ inline Type Atomic::exchange (const Type newValue) noexcept
while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; }
return currentVal;
#elif BEAST_ATOMICS_WINDOWS
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) beast_InterlockedExchange ((volatile long*) &value, (long) castTo32Bit (newValue)))
- : castFrom64Bit ((int64) beast_InterlockedExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue)));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) beast_InterlockedExchange ((volatile long*) &value, (long) castTo32Bit (newValue)))
+ : castFrom64Bit ((std::int64_t) beast_InterlockedExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue)));
#endif
}
@@ -379,8 +380,8 @@ inline bool Atomic::compareAndSetBool (const Type newValue, const Type val
#elif BEAST_ATOMICS_WINDOWS
return compareAndSetValue (newValue, valueToCompare) == valueToCompare;
#elif BEAST_ATOMICS_GCC
- return sizeof (Type) == 4 ? __sync_bool_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue))
- : __sync_bool_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue));
+ return sizeof (Type) == 4 ? __sync_bool_compare_and_swap ((volatile std::int32_t*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue))
+ : __sync_bool_compare_and_swap ((volatile std::int64_t*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue));
#endif
}
@@ -399,11 +400,11 @@ inline Type Atomic::compareAndSetValue (const Type newValue, const Type va
}
#elif BEAST_ATOMICS_WINDOWS
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) beast_InterlockedCompareExchange ((volatile long*) &value, (long) castTo32Bit (newValue), (long) castTo32Bit (valueToCompare)))
- : castFrom64Bit ((int64) beast_InterlockedCompareExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue), (__int64) castTo64Bit (valueToCompare)));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) beast_InterlockedCompareExchange ((volatile long*) &value, (long) castTo32Bit (newValue), (long) castTo32Bit (valueToCompare)))
+ : castFrom64Bit ((std::int64_t) beast_InterlockedCompareExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue), (__int64) castTo64Bit (valueToCompare)));
#elif BEAST_ATOMICS_GCC
- return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_val_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue)))
- : castFrom64Bit ((int64) __sync_val_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue)));
+ return sizeof (Type) == 4 ? castFrom32Bit ((std::int32_t) __sync_val_compare_and_swap ((volatile std::int32_t*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue)))
+ : castFrom64Bit ((std::int64_t) __sync_val_compare_and_swap ((volatile std::int64_t*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue)));
#endif
}
diff --git a/src/beast/beast/ByteOrder.h b/src/beast/beast/ByteOrder.h
index 0e40616e7d..e17736d348 100644
--- a/src/beast/beast/ByteOrder.h
+++ b/src/beast/beast/ByteOrder.h
@@ -25,9 +25,10 @@
#define BEAST_BYTEORDER_H_INCLUDED
#include "Config.h"
-#include "CStdInt.h"
#include "Uncopyable.h"
+#include
+
namespace beast {
//==============================================================================
@@ -39,51 +40,51 @@ class ByteOrder : public Uncopyable
public:
//==============================================================================
/** Swaps the upper and lower bytes of a 16-bit integer. */
- static uint16 swap (uint16 value);
+ static std::uint16_t swap (std::uint16_t value);
/** Reverses the order of the 4 bytes in a 32-bit integer. */
- static uint32 swap (uint32 value);
+ static std::uint32_t swap (std::uint32_t value);
/** Reverses the order of the 8 bytes in a 64-bit integer. */
- static uint64 swap (uint64 value);
+ static std::uint64_t swap (std::uint64_t value);
//==============================================================================
/** Swaps the byte order of a 16-bit int if the CPU is big-endian */
- static uint16 swapIfBigEndian (uint16 value);
+ static std::uint16_t swapIfBigEndian (std::uint16_t value);
/** Swaps the byte order of a 32-bit int if the CPU is big-endian */
- static uint32 swapIfBigEndian (uint32 value);
+ static std::uint32_t swapIfBigEndian (std::uint32_t value);
/** Swaps the byte order of a 64-bit int if the CPU is big-endian */
- static uint64 swapIfBigEndian (uint64 value);
+ static std::uint64_t swapIfBigEndian (std::uint64_t value);
/** Swaps the byte order of a 16-bit int if the CPU is little-endian */
- static uint16 swapIfLittleEndian (uint16 value);
+ static std::uint16_t swapIfLittleEndian (std::uint16_t value);
/** Swaps the byte order of a 32-bit int if the CPU is little-endian */
- static uint32 swapIfLittleEndian (uint32 value);
+ static std::uint32_t swapIfLittleEndian (std::uint32_t value);
/** Swaps the byte order of a 64-bit int if the CPU is little-endian */
- static uint64 swapIfLittleEndian (uint64 value);
+ static std::uint64_t swapIfLittleEndian (std::uint64_t value);
//==============================================================================
/** Turns 2 bytes into a little-endian integer. */
- static uint16 littleEndianShort (const void* bytes);
+ static std::uint16_t littleEndianShort (const void* bytes);
/** Turns 4 bytes into a little-endian integer. */
- static uint32 littleEndianInt (const void* bytes);
+ static std::uint32_t littleEndianInt (const void* bytes);
/** Turns 4 bytes into a little-endian integer. */
- static uint64 littleEndianInt64 (const void* bytes);
+ static std::uint64_t littleEndianInt64 (const void* bytes);
/** Turns 2 bytes into a big-endian integer. */
- static uint16 bigEndianShort (const void* bytes);
+ static std::uint16_t bigEndianShort (const void* bytes);
/** Turns 4 bytes into a big-endian integer. */
- static uint32 bigEndianInt (const void* bytes);
+ static std::uint32_t bigEndianInt (const void* bytes);
/** Turns 4 bytes into a big-endian integer. */
- static uint64 bigEndianInt64 (const void* bytes);
+ static std::uint64_t bigEndianInt64 (const void* bytes);
//==============================================================================
/** Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). */
@@ -111,16 +112,16 @@ private:
#pragma intrinsic (_byteswap_ulong)
#endif
-inline uint16 ByteOrder::swap (uint16 n)
+inline std::uint16_t ByteOrder::swap (std::uint16_t n)
{
#if BEAST_USE_INTRINSICSxxx // agh - the MS compiler has an internal error when you try to use this intrinsic!
- return static_cast (_byteswap_ushort (n));
+ return static_cast (_byteswap_ushort (n));
#else
- return static_cast ((n << 8) | (n >> 8));
+ return static_cast ((n << 8) | (n >> 8));
#endif
}
-inline uint32 ByteOrder::swap (uint32 n)
+inline std::uint32_t ByteOrder::swap (std::uint32_t n)
{
#if BEAST_MAC || BEAST_IOS
return OSSwapInt32 (n);
@@ -143,48 +144,48 @@ inline uint32 ByteOrder::swap (uint32 n)
#endif
}
-inline uint64 ByteOrder::swap (uint64 value)
+inline std::uint64_t ByteOrder::swap (std::uint64_t value)
{
#if BEAST_MAC || BEAST_IOS
return OSSwapInt64 (value);
#elif BEAST_USE_INTRINSICS
return _byteswap_uint64 (value);
#else
- return (((int64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
+ return (((std::int64_t) swap ((std::uint32_t) value)) << 32) | swap ((std::uint32_t) (value >> 32));
#endif
}
#if BEAST_LITTLE_ENDIAN
- inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return v; }
- inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return v; }
- inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return v; }
- inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return swap (v); }
- inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return swap (v); }
- inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return swap (v); }
- inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast (bytes); }
- inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast (bytes); }
- inline uint64 ByteOrder::littleEndianInt64 (const void* const bytes) { return *static_cast (bytes); }
- inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast (bytes)); }
- inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast (bytes)); }
- inline uint64 ByteOrder::bigEndianInt64 (const void* const bytes) { return swap (*static_cast (bytes)); }
+ inline std::uint16_t ByteOrder::swapIfBigEndian (const std::uint16_t v) { return v; }
+ inline std::uint32_t ByteOrder::swapIfBigEndian (const std::uint32_t v) { return v; }
+ inline std::uint64_t ByteOrder::swapIfBigEndian (const std::uint64_t v) { return v; }
+ inline std::uint16_t ByteOrder::swapIfLittleEndian (const std::uint16_t v) { return swap (v); }
+ inline std::uint32_t ByteOrder::swapIfLittleEndian (const std::uint32_t v) { return swap (v); }
+ inline std::uint64_t ByteOrder::swapIfLittleEndian (const std::uint64_t v) { return swap (v); }
+ inline std::uint16_t ByteOrder::littleEndianShort (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint32_t ByteOrder::littleEndianInt (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint64_t ByteOrder::littleEndianInt64 (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint16_t ByteOrder::bigEndianShort (const void* const bytes) { return swap (*static_cast (bytes)); }
+ inline std::uint32_t ByteOrder::bigEndianInt (const void* const bytes) { return swap (*static_cast (bytes)); }
+ inline std::uint64_t ByteOrder::bigEndianInt64 (const void* const bytes) { return swap (*static_cast (bytes)); }
inline bool ByteOrder::isBigEndian() { return false; }
#else
- inline uint16 ByteOrder::swapIfBigEndian (const uint16 v) { return swap (v); }
- inline uint32 ByteOrder::swapIfBigEndian (const uint32 v) { return swap (v); }
- inline uint64 ByteOrder::swapIfBigEndian (const uint64 v) { return swap (v); }
- inline uint16 ByteOrder::swapIfLittleEndian (const uint16 v) { return v; }
- inline uint32 ByteOrder::swapIfLittleEndian (const uint32 v) { return v; }
- inline uint64 ByteOrder::swapIfLittleEndian (const uint64 v) { return v; }
- inline uint32 ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast (bytes)); }
- inline uint16 ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast (bytes)); }
- inline uint16 ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast (bytes); }
- inline uint32 ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast (bytes); }
- inline uint64 ByteOrder::bigEndianInt64 (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint16_t ByteOrder::swapIfBigEndian (const std::uint16_t v) { return swap (v); }
+ inline std::uint32_t ByteOrder::swapIfBigEndian (const std::uint32_t v) { return swap (v); }
+ inline std::uint64_t ByteOrder::swapIfBigEndian (const std::uint64_t v) { return swap (v); }
+ inline std::uint16_t ByteOrder::swapIfLittleEndian (const std::uint16_t v) { return v; }
+ inline std::uint32_t ByteOrder::swapIfLittleEndian (const std::uint32_t v) { return v; }
+ inline std::uint64_t ByteOrder::swapIfLittleEndian (const std::uint64_t v) { return v; }
+ inline std::uint32_t ByteOrder::littleEndianInt (const void* const bytes) { return swap (*static_cast (bytes)); }
+ inline std::uint16_t ByteOrder::littleEndianShort (const void* const bytes) { return swap (*static_cast (bytes)); }
+ inline std::uint16_t ByteOrder::bigEndianShort (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint32_t ByteOrder::bigEndianInt (const void* const bytes) { return *static_cast (bytes); }
+ inline std::uint64_t ByteOrder::bigEndianInt64 (const void* const bytes) { return *static_cast (bytes); }
inline bool ByteOrder::isBigEndian() { return true; }
#endif
-inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((int) (uint8) bytes[1]) << 8) | ((int) (uint8) bytes[0]); }
-inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((int) (uint8) bytes[1]) << 8) | ((int) (uint8) bytes[2]); }
+inline int ByteOrder::littleEndian24Bit (const char* const bytes) { return (((int) bytes[2]) << 16) | (((int) (std::uint8_t) bytes[1]) << 8) | ((int) (std::uint8_t) bytes[0]); }
+inline int ByteOrder::bigEndian24Bit (const char* const bytes) { return (((int) bytes[0]) << 16) | (((int) (std::uint8_t) bytes[1]) << 8) | ((int) (std::uint8_t) bytes[2]); }
inline void ByteOrder::littleEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)(value & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)((value >> 16) & 0xff); }
inline void ByteOrder::bigEndian24BitToChars (const int value, char* const destBytes) { destBytes[0] = (char)((value >> 16) & 0xff); destBytes[1] = (char)((value >> 8) & 0xff); destBytes[2] = (char)(value & 0xff); }
@@ -211,29 +212,29 @@ struct SwapBytes
// Specializations for signed integers
template <>
-struct SwapBytes
+struct SwapBytes
{
- inline int16 operator() (int16 value) const noexcept
+ inline std::int16_t operator() (std::int16_t value) const noexcept
{
- return static_cast (ByteOrder::swap (static_cast (value)));
+ return static_cast (ByteOrder::swap (static_cast (value)));
}
};
template <>
-struct SwapBytes
+struct SwapBytes
{
- inline int32 operator() (int32 value) const noexcept
+ inline std::int32_t operator() (std::int32_t value) const noexcept
{
- return static_cast (ByteOrder::swap (static_cast (value)));
+ return static_cast (ByteOrder::swap (static_cast (value)));
}
};
template <>
-struct SwapBytes
+struct SwapBytes
{
- inline int64 operator() (int64 value) const noexcept
+ inline std::int64_t operator() (std::int64_t value) const noexcept
{
- return static_cast (ByteOrder::swap (static_cast (value)));
+ return static_cast (ByteOrder::swap (static_cast (value)));
}
};
diff --git a/src/beast/beast/CStdInt.h b/src/beast/beast/CStdInt.h
deleted file mode 100644
index 265f3d9f19..0000000000
--- a/src/beast/beast/CStdInt.h
+++ /dev/null
@@ -1,88 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of Beast: https://github.com/vinniefalco/Beast
- Copyright 2013, Vinnie Falco
-
- Portions of this file are from JUCE.
- Copyright (c) 2013 - Raw Material Software Ltd.
- Please visit http://www.juce.com
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef BEAST_CSTDINT_H_INCLUDED
-#define BEAST_CSTDINT_H_INCLUDED
-
-#include "Config.h"
-
-namespace beast {
-
-typedef signed char int8;
-typedef signed short int16;
-typedef signed int int32;
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-
-#if BEAST_MSVC
- typedef __int64 int64;
- typedef unsigned __int64 uint64;
-
- /** A platform-independent macro for writing 64-bit literals, needed because
- different compilers have different syntaxes for this.
-
- E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
- GCC, or 0x1000000000 for MSVC.
- */
- #define literal64bit(longLiteral) ((__int64) longLiteral)
-
-#else
- /** A platform-independent 64-bit integer type. */
- typedef long long int64;
- /** A platform-independent 64-bit unsigned integer type. */
- typedef unsigned long long uint64;
- /** A platform-independent macro for writing 64-bit literals, needed because
- different compilers have different syntaxes for this.
-
- E.g. writing literal64bit (0x1000000000) will translate to 0x1000000000LL for
- GCC, or 0x1000000000 for MSVC.
- */
- #define literal64bit(longLiteral) (longLiteral##LL)
-
-#endif
-
-#if BEAST_64BIT
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef int64 pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef uint64 pointer_sized_uint;
-#elif BEAST_MSVC
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef _W64 int pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef _W64 unsigned int pointer_sized_uint;
-#else
- /** A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef int pointer_sized_int;
- /** An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. */
- typedef unsigned int pointer_sized_uint;
-#endif
-
-#if BEAST_MSVC
- typedef pointer_sized_int ssize_t;
-#endif
-
-}
-
-#endif
diff --git a/src/beast/beast/HeapBlock.h b/src/beast/beast/HeapBlock.h
index 875dae0e47..aff4006e62 100644
--- a/src/beast/beast/HeapBlock.h
+++ b/src/beast/beast/HeapBlock.h
@@ -119,7 +119,7 @@ namespace HeapBlockHelper
then a failed allocation will just leave the heapblock with a null pointer (assuming
that the system's malloc() function doesn't throw).
- @see Array, OwnedArray, MemoryBlock
+ @see Array, MemoryBlock
*/
template
class HeapBlock : public Uncopyable
@@ -339,10 +339,6 @@ private:
{
HeapBlockHelper::ThrowOnFail::check (data);
}
-
- #if ! (defined (BEAST_DLL) || defined (BEAST_DLL_BUILD))
- BEAST_PREVENT_HEAP_ALLOCATION // Creating a 'new HeapBlock' would be missing the point!
- #endif
};
}
diff --git a/src/beast/beast/Memory.h b/src/beast/beast/Memory.h
index a95627542a..adb3717f2e 100644
--- a/src/beast/beast/Memory.h
+++ b/src/beast/beast/Memory.h
@@ -78,7 +78,7 @@ Type* createCopyIfNotNull (const Type* pointer)
/** A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII.
You should use the BEAST_AUTORELEASEPOOL macro to create a local auto-release pool on the stack.
*/
- class BEAST_API ScopedAutoReleasePool : public Uncopyable
+ class ScopedAutoReleasePool : public Uncopyable
{
public:
ScopedAutoReleasePool();
diff --git a/src/beast/beast/asio/impl/IPAddressConversion.cpp b/src/beast/beast/asio/impl/IPAddressConversion.cpp
index 62511b6f64..d97f3811f4 100644
--- a/src/beast/beast/asio/impl/IPAddressConversion.cpp
+++ b/src/beast/beast/asio/impl/IPAddressConversion.cpp
@@ -33,7 +33,7 @@ Endpoint from_asio (boost::asio::ip::address const& address)
}
// VFALCO TODO IPv6 support
- bassertfalse;
+ assert(false);
return Endpoint();
}
@@ -52,7 +52,7 @@ boost::asio::ip::address to_asio_address (Endpoint const& endpoint)
}
// VFALCO TODO IPv6 support
- bassertfalse;
+ assert(false);
return boost::asio::ip::address (
boost::asio::ip::address_v6 ());
}
diff --git a/src/beast/beast/chrono/RelativeTime.h b/src/beast/beast/chrono/RelativeTime.h
index 57da666b5b..b4e849f0bb 100644
--- a/src/beast/beast/chrono/RelativeTime.h
+++ b/src/beast/beast/chrono/RelativeTime.h
@@ -41,7 +41,7 @@ namespace beast {
If you need an absolute time, (i.e. a date + time), see the Time class.
*/
-class BEAST_API RelativeTime
+class RelativeTime
{
public:
//==============================================================================
@@ -88,7 +88,7 @@ public:
/** Creates a new RelativeTime object representing a number of milliseconds.
@see seconds, minutes, hours, days, weeks
*/
- static RelativeTime milliseconds (int64 milliseconds) noexcept;
+ static RelativeTime milliseconds (std::int64_t milliseconds) noexcept;
/** Creates a new RelativeTime object representing a number of seconds.
@see milliseconds, minutes, hours, days, weeks
@@ -119,7 +119,7 @@ public:
/** Returns the number of milliseconds this time represents.
@see milliseconds, inSeconds, inMinutes, inHours, inDays, inWeeks
*/
- int64 inMilliseconds() const noexcept;
+ std::int64_t inMilliseconds() const noexcept;
/** Returns the number of seconds this time represents.
@see inMilliseconds, inMinutes, inHours, inDays, inWeeks
diff --git a/src/beast/beast/chrono/impl/RelativeTime.cpp b/src/beast/beast/chrono/impl/RelativeTime.cpp
index 8a79c7fd20..853940bb3e 100644
--- a/src/beast/beast/chrono/impl/RelativeTime.cpp
+++ b/src/beast/beast/chrono/impl/RelativeTime.cpp
@@ -54,7 +54,7 @@ RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept
return RelativeTime (milliseconds * 0.001);
}
-RelativeTime RelativeTime::milliseconds (const int64 milliseconds) noexcept
+RelativeTime RelativeTime::milliseconds (const std::int64_t milliseconds) noexcept
{
return RelativeTime (milliseconds * 0.001);
}
@@ -86,9 +86,9 @@ RelativeTime RelativeTime::weeks (const RelativeTime::value_type numberOfWeeks)
//==============================================================================
-int64 RelativeTime::inMilliseconds() const noexcept
+std::int64_t RelativeTime::inMilliseconds() const noexcept
{
- return (int64) (numSeconds * 1000.0);
+ return (std::int64_t) (numSeconds * 1000.0);
}
RelativeTime::value_type RelativeTime::inMinutes() const noexcept
@@ -301,7 +301,7 @@ static double monotonicCurrentTimeInSeconds()
{
numerator = timebase.numer;
// VFALCO NOTE I don't understand this code
- //denominator = timebase.denom * (uint64) 1000000 * 1000.0;
+ //denominator = timebase.denom * (std::uint64_t) 1000000 * 1000.0;
denominator = timebase.denom * 1000000000.0;
}
diff --git a/src/beast/beast/config/CompilerConfig.h b/src/beast/beast/config/CompilerConfig.h
index 534588f7c3..7cdaf733a3 100644
--- a/src/beast/beast/config/CompilerConfig.h
+++ b/src/beast/beast/config/CompilerConfig.h
@@ -42,10 +42,8 @@
/** This macro defines the C calling convention used as the standard for Beast calls.
*/
#if BEAST_MSVC
-# define BEAST_CALLTYPE __stdcall
# define BEAST_CDECL __cdecl
#else
-# define BEAST_CALLTYPE
# define BEAST_CDECL
#endif
@@ -148,16 +146,6 @@ extern void beast_reportFatalError (char const* message, char const* fileName, i
//------------------------------------------------------------------------------
-/** This macro can be added to class definitions to disable the use of new/delete to
- allocate the object on the heap, forcing it to only be used as a stack or member variable.
-*/
-#define BEAST_PREVENT_HEAP_ALLOCATION \
- private: \
- static void* operator new (size_t); \
- static void operator delete (void*);
-
-//------------------------------------------------------------------------------
-
#if ! DOXYGEN
#define BEAST_JOIN_MACRO_HELPER(a, b) a ## b
#define BEAST_STRINGIFY_MACRO_HELPER(a) #a
@@ -175,19 +163,6 @@ extern void beast_reportFatalError (char const* message, char const* fileName, i
//------------------------------------------------------------------------------
-#if BEAST_DEBUG || DOXYGEN
-/** A platform-independent way of forcing an inline function.
- Use the syntax: @code
- forcedinline void myfunction (int x)
- @endcode
-*/
-# define forcedinline inline
-#elif BEAST_MSVC
-# define forcedinline __forceinline
-#else
-# define forcedinline inline __attribute__((always_inline))
-#endif
-
#if BEAST_MSVC || DOXYGEN
/** This can be placed before a stack or member variable declaration to tell
the compiler to align it to the specified number of bytes.
diff --git a/src/beast/beast/config/ContractChecks.h b/src/beast/beast/config/ContractChecks.h
index 59cad4231c..d611d5f036 100644
--- a/src/beast/beast/config/ContractChecks.h
+++ b/src/beast/beast/config/ContractChecks.h
@@ -24,13 +24,10 @@
#if defined (fatal_error) || \
defined (fatal_condition) || \
- defined (fatal_assert) || \
defined (meets_condition) || \
defined (meets_precondition) || \
defined (meets_postcondition) || \
defined (meets_invariant) || \
- defined (check_precondition) || \
- defined (check_postcondition) || \
defined (check_invariant)
#error "Programming by contract macros cannot be overriden!"
#endif
@@ -52,13 +49,6 @@
(((!!(condition)) || (beast_reportFatalError ( \
category " '" BEAST_STRINGIFY(condition) "' failed.", __FILE__, __LINE__), 0)))
-/** Replacement for assert which generates a fatal error if the condition is false.
- The condition is always evaluated regardless of compilation settings.
- Meets this declaration syntax:
- @code inline void fatal_assert (bool condition); @endcode
-*/
-#define fatal_assert(condition) fatal_condition(condition,"Assertion")
-
/** Reports a fatal error message type if the condition is false
The condition is always evaluated regardless of settings.
Meets this declaration syntax:
@@ -87,12 +77,8 @@
*/
/** @{ */
#if ! BEAST_DISABLE_CONTRACT_CHECKS
-# define check_precondition(condition) meets_precondition(condition)
-# define check_postcondition(condition) meets_postcondition(condition)
# define check_invariant(condition) meets_invariant(condition)
#else
-# define check_precondition(condition) ((void)0)
-# define check_postcondition(condition) ((void)0)
# define check_invariant(condition) ((void)0)
#endif
/** @} */
diff --git a/src/beast/beast/config/StandardConfig.h b/src/beast/beast/config/StandardConfig.h
index 6f2a67c875..f620563c4a 100644
--- a/src/beast/beast/config/StandardConfig.h
+++ b/src/beast/beast/config/StandardConfig.h
@@ -74,40 +74,4 @@
#undef max
#undef min
-//------------------------------------------------------------------------------
-
-// DLL building settings on Windows
-//
-// VFALCO TODO Deprecate this
-//
-#if BEAST_MSVC
- #ifdef BEAST_DLL_BUILD
- #define BEAST_API __declspec (dllexport)
- #pragma warning (disable: 4251)
- #elif defined (BEAST_DLL)
- #define BEAST_API __declspec (dllimport)
- #pragma warning (disable: 4251)
- #endif
- #ifdef __INTEL_COMPILER
- #pragma warning (disable: 1125) // (virtual override warning)
- #endif
-#elif defined (BEAST_DLL) || defined (BEAST_DLL_BUILD)
- #define BEAST_API __attribute__ ((visibility("default")))
-#endif
-
-//------------------------------------------------------------------------------
-
-#ifndef BEAST_API
-#define BEAST_API /**< This macro is added to all beast public class declarations. */
-#endif
-
-#if BEAST_MSVC && BEAST_DLL_BUILD
-#define BEAST_PUBLIC_IN_DLL_BUILD(decl) public: decl; private:
-#else
-#define BEAST_PUBLIC_IN_DLL_BUILD(decl) decl;
-#endif
-
-/** This macro is added to all beast public function declarations. */
-#define BEAST_PUBLIC_FUNCTION BEAST_API BEAST_CALLTYPE
-
#endif
diff --git a/src/beast/beast/crypto/MurmurHash.h b/src/beast/beast/crypto/MurmurHash.h
index 724d62d2fe..a9bda5c1ca 100644
--- a/src/beast/beast/crypto/MurmurHash.h
+++ b/src/beast/beast/crypto/MurmurHash.h
@@ -20,22 +20,23 @@
#ifndef BEAST_CRYPTO_MURMURHASH_H_INCLUDED
#define BEAST_CRYPTO_MURMURHASH_H_INCLUDED
-#include "../CStdInt.h"
+#include
+#include
// Original source code links in .cpp file
namespace beast {
namespace Murmur {
-extern void MurmurHash3_x86_32 (const void* key, int len, uint32 seed, void* out);
-extern void MurmurHash3_x86_128 (const void* key, int len, uint32 seed, void* out);
-extern void MurmurHash3_x64_128 (const void* key, int len, uint32 seed, void* out);
+extern void MurmurHash3_x86_32 (const void* key, int len, std::uint32_t seed, void* out);
+extern void MurmurHash3_x86_128 (const void* key, int len, std::uint32_t seed, void* out);
+extern void MurmurHash3_x64_128 (const void* key, int len, std::uint32_t seed, void* out);
// Uses Beast to choose an appropriate routine
// This handy template deduces which size hash is desired
template
-inline void Hash (const void* key, int len, uint32 seed, HashType* out)
+inline void Hash (const void* key, int len, std::uint32_t seed, HashType* out)
{
switch (8 * sizeof (HashType))
{
@@ -72,7 +73,7 @@ inline void Hash (const void* key, int len, uint32 seed, HashType* out)
#endif
default:
- Throw (std::runtime_error ("invalid key size in MurmurHash"));
+ throw std::runtime_error ("invalid key size in MurmurHash");
break;
};
}
diff --git a/src/beast/beast/crypto/Sha256.h b/src/beast/beast/crypto/Sha256.h
index 9f3c0d3e0f..c415ac0675 100644
--- a/src/beast/beast/crypto/Sha256.h
+++ b/src/beast/beast/crypto/Sha256.h
@@ -21,9 +21,9 @@
#define BEAST_CRYPTO_SHA256_H_INCLUDED
#include "../Config.h"
-#include "../CStdInt.h"
#include
+#include
//------------------------------------------------------------------------------
@@ -37,14 +37,14 @@ enum
};
/** A container suitable for holding the resulting hash. */
-typedef std::array digest_type;
+typedef std::array digest_type;
namespace detail {
struct Context
{
- beast::uint32 state[8];
- beast::uint64 bitcount;
- beast::uint8 buffer[Sha256::blockLength];
+ std::uint32_t state[8];
+ std::uint64_t bitcount;
+ std::uint8_t buffer[Sha256::blockLength];
};
}
@@ -59,12 +59,12 @@ public:
/** @{ */
void update (void const* buffer, std::size_t bytes);
- void update (int8 const* begin, int8 const* end)
+ void update (std::int8_t const* begin, std::int8_t const* end)
{
update (begin, end - begin);
}
- void update (uint8 const* begin, uint8 const* end)
+ void update (std::uint8_t const* begin, std::uint8_t const* end)
{
update (begin, end - begin);
}
@@ -115,10 +115,10 @@ digest_type const& empty_digest();
void* hash (void const* buffer, std::size_t bytes, void* digest);
digest_type& hash ( void const* buffer, std::size_t bytes, digest_type& digest);
digest_type hash (void const* buffer, std::size_t bytes);
-void* hash (int8 const* begin, int8 const* end, void* digest);
-void* hash (uint8 const* begin, uint8 const* end, void* digest);
-digest_type hash (int8 const* begin, int8 const* end);
-digest_type hash (uint8 const* begin, uint8 const* end);
+void* hash (std::int8_t const* begin, std::int8_t const* end, void* digest);
+void* hash (std::uint8_t const* begin, std::uint8_t const* end, void* digest);
+digest_type hash (std::int8_t const* begin, std::int8_t const* end);
+digest_type hash (std::uint8_t const* begin, std::uint8_t const* end);
template
void* hash (T const& t, void* digest)
diff --git a/src/beast/beast/crypto/UnsignedInteger.h b/src/beast/beast/crypto/UnsignedInteger.h
index a810b60b3a..4b2069c0ec 100644
--- a/src/beast/beast/crypto/UnsignedInteger.h
+++ b/src/beast/beast/crypto/UnsignedInteger.h
@@ -23,8 +23,12 @@
#include "UnsignedIntegerCalc.h"
#include "MurmurHash.h"
-#include "../../modules/beast_core/beast_core.h" // FIX ASAP
+#include "../ByteOrder.h"
+#include "../utility/hardened_hash.h"
+#include "../utility/noexcept.h"
+#include
+#include
#include
#include
@@ -56,35 +60,20 @@ public:
typedef value_type* iterator;
typedef value_type const* const_iterator;
+ void
+ hash_combine (std::size_t& seed) const noexcept
+ {
+ std::size_t result;
+ Murmur::Hash (get(), size, seed, &result);
+ seed = result;
+ }
+
/** Hardened hash function for use with hash based containers.
The seed is used to make the hash unpredictable. This prevents
attackers from exploiting crafted inputs to produce degenerate
containers.
*/
- class hasher
- {
- public:
- /** Construct a hash function
- If a seed is specified it will be used, else a random seed
- will be generated from the system
- @param seedToUse An optional seed to use.
- */
- explicit hasher (std::size_t seedToUse = Random::getSystemRandom ().nextInt ())
- : m_seed (seedToUse)
- {
- }
-
- /** Generates a simple hash from an UnsignedInteger. */
- std::size_t operator() (UnsignedInteger const& key) const
- {
- std::size_t hash;
- Murmur::Hash (key.cbegin (), key.size, m_seed, &hash);
- return hash;
- }
-
- private:
- std::size_t m_seed;
- };
+ typedef hardened_hash hasher;
/** Determins if two UnsignedInteger objects are equal. */
class equal
@@ -126,7 +115,7 @@ public:
UnsignedInteger (InputIt first, InputIt last)
{
m_values [0] = 0; // clear any pad bytes
- check_precondition (std::distance (first, last) == size);
+ assert (std::distance (first, last) == size);
std::copy (first, last, begin());
}
/** @} */
@@ -150,7 +139,8 @@ public:
UnsignedInteger result;
value = toNetworkByteOrder (value);
result.clear ();
- std::memcpy (result.end () - sizeof (value), &value, bmin (Bytes, sizeof (value)));
+ std::memcpy (result.end () - sizeof (value), &value,
+ std::min (Bytes, sizeof (value)));
return result;
}
diff --git a/src/beast/beast/crypto/UnsignedIntegerCalc.h b/src/beast/beast/crypto/UnsignedIntegerCalc.h
index 2f48049317..05e0ff79d0 100644
--- a/src/beast/beast/crypto/UnsignedIntegerCalc.h
+++ b/src/beast/beast/crypto/UnsignedIntegerCalc.h
@@ -20,8 +20,11 @@
#ifndef BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
#define BEAST_CRYPTO_UNSIGNEDINTEGERCALC_H_INCLUDED
+#include "../ByteOrder.h"
+
#include
#include
+#include
namespace beast {
@@ -111,7 +114,7 @@ public:
if (swizzle)
{
// Zero fill the possibly uninitialized pad bytes
- memset (buffer, 0,
+ std::memset (buffer, 0,
((sizeof(UInt)-(bytes&(sizeof(UInt)-1)))&(sizeof(UInt)-1)));
// Swap and swizzle
UInt* lo (values);
diff --git a/src/beast/beast/crypto/impl/MurmurHash.cpp b/src/beast/beast/crypto/impl/MurmurHash.cpp
index 1674c3b436..4b92e563c2 100644
--- a/src/beast/beast/crypto/impl/MurmurHash.cpp
+++ b/src/beast/beast/crypto/impl/MurmurHash.cpp
@@ -42,12 +42,12 @@ namespace Murmur {
#else
-static inline uint32_t rotl32 ( uint32_t x, int8_t r )
+static inline std::uint32_t rotl32 ( std::uint32_t x, int8_t r )
{
return (x << r) | (x >> (32 - r));
}
-static inline uint64_t rotl64 ( uint64_t x, int8_t r )
+static inline std::uint64_t rotl64 ( std::uint64_t x, int8_t r )
{
return (x << r) | (x >> (64 - r));
}
@@ -63,12 +63,12 @@ static inline uint64_t rotl64 ( uint64_t x, int8_t r )
// Block read - if your platform needs to do endian-swapping or can only
// handle aligned reads, do the conversion here
-static forcedinline uint32_t getblock ( const uint32_t* p, int i )
+static inline std::uint32_t getblock ( const std::uint32_t* p, int i )
{
return p[i];
}
-static forcedinline uint64_t getblock ( const uint64_t* p, int i )
+static inline std::uint64_t getblock ( const std::uint64_t* p, int i )
{
return p[i];
}
@@ -76,7 +76,7 @@ static forcedinline uint64_t getblock ( const uint64_t* p, int i )
//-----------------------------------------------------------------------------
// Finalization mix - force all bits of a hash block to avalanche
-static forcedinline uint32_t fmix ( uint32_t h )
+static inline std::uint32_t fmix ( std::uint32_t h )
{
h ^= h >> 16;
h *= 0x85ebca6b;
@@ -89,7 +89,7 @@ static forcedinline uint32_t fmix ( uint32_t h )
//----------
-static forcedinline uint64_t fmix ( uint64_t k )
+static inline std::uint64_t fmix ( std::uint64_t k )
{
k ^= k >> 33;
k *= BIG_CONSTANT (0xff51afd7ed558ccd);
@@ -103,24 +103,24 @@ static forcedinline uint64_t fmix ( uint64_t k )
//-----------------------------------------------------------------------------
void MurmurHash3_x86_32 ( const void* key, int len,
- uint32_t seed, void* out )
+ std::uint32_t seed, void* out )
{
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 4;
- uint32_t h1 = seed;
+ std::uint32_t h1 = seed;
- uint32_t c1 = 0xcc9e2d51;
- uint32_t c2 = 0x1b873593;
+ std::uint32_t c1 = 0xcc9e2d51;
+ std::uint32_t c2 = 0x1b873593;
//----------
// body
- const uint32_t* blocks = (const uint32_t*) (data + nblocks * 4);
+ const std::uint32_t* blocks = (const std::uint32_t*) (data + nblocks * 4);
for (int i = -nblocks; i; i++)
{
- uint32_t k1 = getblock (blocks, i);
+ std::uint32_t k1 = getblock (blocks, i);
k1 *= c1;
k1 = ROTL32 (k1, 15);
@@ -136,7 +136,7 @@ void MurmurHash3_x86_32 ( const void* key, int len,
const uint8_t* tail = (const uint8_t*) (data + nblocks * 4);
- uint32_t k1 = 0;
+ std::uint32_t k1 = 0;
switch (len & 3)
{
@@ -161,38 +161,38 @@ void MurmurHash3_x86_32 ( const void* key, int len,
h1 = fmix (h1);
- * (uint32_t*)out = h1;
+ * (std::uint32_t*)out = h1;
}
//-----------------------------------------------------------------------------
void MurmurHash3_x86_128 ( const void* key, const int len,
- uint32_t seed, void* out )
+ std::uint32_t seed, void* out )
{
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16;
- uint32_t h1 = seed;
- uint32_t h2 = seed;
- uint32_t h3 = seed;
- uint32_t h4 = seed;
+ std::uint32_t h1 = seed;
+ std::uint32_t h2 = seed;
+ std::uint32_t h3 = seed;
+ std::uint32_t h4 = seed;
- uint32_t c1 = 0x239b961b;
- uint32_t c2 = 0xab0e9789;
- uint32_t c3 = 0x38b34ae5;
- uint32_t c4 = 0xa1e38b93;
+ std::uint32_t c1 = 0x239b961b;
+ std::uint32_t c2 = 0xab0e9789;
+ std::uint32_t c3 = 0x38b34ae5;
+ std::uint32_t c4 = 0xa1e38b93;
//----------
// body
- const uint32_t* blocks = (const uint32_t*) (data + nblocks * 16);
+ const std::uint32_t* blocks = (const std::uint32_t*) (data + nblocks * 16);
for (int i = -nblocks; i; i++)
{
- uint32_t k1 = getblock (blocks, i * 4 + 0);
- uint32_t k2 = getblock (blocks, i * 4 + 1);
- uint32_t k3 = getblock (blocks, i * 4 + 2);
- uint32_t k4 = getblock (blocks, i * 4 + 3);
+ std::uint32_t k1 = getblock (blocks, i * 4 + 0);
+ std::uint32_t k2 = getblock (blocks, i * 4 + 1);
+ std::uint32_t k3 = getblock (blocks, i * 4 + 2);
+ std::uint32_t k4 = getblock (blocks, i * 4 + 3);
k1 *= c1;
k1 = ROTL32 (k1, 15);
@@ -236,10 +236,10 @@ void MurmurHash3_x86_128 ( const void* key, const int len,
const uint8_t* tail = (const uint8_t*) (data + nblocks * 16);
- uint32_t k1 = 0;
- uint32_t k2 = 0;
- uint32_t k3 = 0;
- uint32_t k4 = 0;
+ std::uint32_t k1 = 0;
+ std::uint32_t k2 = 0;
+ std::uint32_t k3 = 0;
+ std::uint32_t k4 = 0;
switch (len & 15)
{
@@ -348,38 +348,38 @@ void MurmurHash3_x86_128 ( const void* key, const int len,
h4 += h1;
- ((uint32_t*)out)[0] = h1;
+ ((std::uint32_t*)out)[0] = h1;
- ((uint32_t*)out)[1] = h2;
+ ((std::uint32_t*)out)[1] = h2;
- ((uint32_t*)out)[2] = h3;
+ ((std::uint32_t*)out)[2] = h3;
- ((uint32_t*)out)[3] = h4;
+ ((std::uint32_t*)out)[3] = h4;
}
//-----------------------------------------------------------------------------
void MurmurHash3_x64_128 ( const void* key, const int len,
- const uint32_t seed, void* out )
+ const std::uint32_t seed, void* out )
{
const uint8_t* data = (const uint8_t*)key;
const int nblocks = len / 16;
- uint64_t h1 = seed;
- uint64_t h2 = seed;
+ std::uint64_t h1 = seed;
+ std::uint64_t h2 = seed;
- uint64_t c1 = BIG_CONSTANT (0x87c37b91114253d5);
- uint64_t c2 = BIG_CONSTANT (0x4cf5ad432745937f);
+ std::uint64_t c1 = BIG_CONSTANT (0x87c37b91114253d5);
+ std::uint64_t c2 = BIG_CONSTANT (0x4cf5ad432745937f);
//----------
// body
- const uint64_t* blocks = (const uint64_t*) (data);
+ const std::uint64_t* blocks = (const std::uint64_t*) (data);
for (int i = 0; i < nblocks; i++)
{
- uint64_t k1 = getblock (blocks, i * 2 + 0);
- uint64_t k2 = getblock (blocks, i * 2 + 1);
+ std::uint64_t k1 = getblock (blocks, i * 2 + 0);
+ std::uint64_t k2 = getblock (blocks, i * 2 + 1);
k1 *= c1;
k1 = ROTL64 (k1, 31);
@@ -405,59 +405,59 @@ void MurmurHash3_x64_128 ( const void* key, const int len,
const uint8_t* tail = (const uint8_t*) (data + nblocks * 16);
- uint64_t k1 = 0;
- uint64_t k2 = 0;
+ std::uint64_t k1 = 0;
+ std::uint64_t k2 = 0;
switch (len & 15)
{
case 15:
- k2 ^= uint64_t (tail[14]) << 48;
+ k2 ^= std::uint64_t (tail[14]) << 48;
case 14:
- k2 ^= uint64_t (tail[13]) << 40;
+ k2 ^= std::uint64_t (tail[13]) << 40;
case 13:
- k2 ^= uint64_t (tail[12]) << 32;
+ k2 ^= std::uint64_t (tail[12]) << 32;
case 12:
- k2 ^= uint64_t (tail[11]) << 24;
+ k2 ^= std::uint64_t (tail[11]) << 24;
case 11:
- k2 ^= uint64_t (tail[10]) << 16;
+ k2 ^= std::uint64_t (tail[10]) << 16;
case 10:
- k2 ^= uint64_t (tail[ 9]) << 8;
+ k2 ^= std::uint64_t (tail[ 9]) << 8;
case 9:
- k2 ^= uint64_t (tail[ 8]) << 0;
+ k2 ^= std::uint64_t (tail[ 8]) << 0;
k2 *= c2;
k2 = ROTL64 (k2, 33);
k2 *= c1;
h2 ^= k2;
case 8:
- k1 ^= uint64_t (tail[ 7]) << 56;
+ k1 ^= std::uint64_t (tail[ 7]) << 56;
case 7:
- k1 ^= uint64_t (tail[ 6]) << 48;
+ k1 ^= std::uint64_t (tail[ 6]) << 48;
case 6:
- k1 ^= uint64_t (tail[ 5]) << 40;
+ k1 ^= std::uint64_t (tail[ 5]) << 40;
case 5:
- k1 ^= uint64_t (tail[ 4]) << 32;
+ k1 ^= std::uint64_t (tail[ 4]) << 32;
case 4:
- k1 ^= uint64_t (tail[ 3]) << 24;
+ k1 ^= std::uint64_t (tail[ 3]) << 24;
case 3:
- k1 ^= uint64_t (tail[ 2]) << 16;
+ k1 ^= std::uint64_t (tail[ 2]) << 16;
case 2:
- k1 ^= uint64_t (tail[ 1]) << 8;
+ k1 ^= std::uint64_t (tail[ 1]) << 8;
case 1:
- k1 ^= uint64_t (tail[ 0]) << 0;
+ k1 ^= std::uint64_t (tail[ 0]) << 0;
k1 *= c1;
k1 = ROTL64 (k1, 31);
k1 *= c2;
@@ -483,9 +483,9 @@ void MurmurHash3_x64_128 ( const void* key, const int len,
h2 += h1;
- ((uint64_t*)out)[0] = h1;
+ ((std::uint64_t*)out)[0] = h1;
- ((uint64_t*)out)[1] = h2;
+ ((std::uint64_t*)out)[1] = h2;
}
}
diff --git a/src/beast/beast/crypto/impl/Sha256.cpp b/src/beast/beast/crypto/impl/Sha256.cpp
index 3eb1f57743..4fec4b7661 100644
--- a/src/beast/beast/crypto/impl/Sha256.cpp
+++ b/src/beast/beast/crypto/impl/Sha256.cpp
@@ -49,12 +49,12 @@ Context::Context ()
void Context::update (void const* buffer, std::size_t bytes)
{
- detail::SHA256_Update (&m_context, static_cast (buffer), bytes);
+ detail::SHA256_Update (&m_context, static_cast (buffer), bytes);
}
void* Context::finish (void* hash)
{
- detail::SHA256_Final (static_cast (hash), &m_context);
+ detail::SHA256_Final (static_cast (hash), &m_context);
return hash;
}
@@ -66,7 +66,7 @@ digest_type const& empty_digest()
{
Holder ()
{
- uint8 zero (0);
+ std::uint8_t zero (0);
hash (zero, digest);
}
@@ -99,24 +99,24 @@ digest_type hash (void const* buffer, std::size_t bytes)
return digest;
}
-void* hash (int8 const* begin, int8 const* end, void* digest)
+void* hash (std::int8_t const* begin, std::int8_t const* end, void* digest)
{
return hash (begin, end - begin, digest);
}
-void* hash (uint8 const* begin, uint8 const* end, void* digest)
+void* hash (std::uint8_t const* begin, std::uint8_t const* end, void* digest)
{
return hash (begin, end - begin, digest);
}
-digest_type hash (int8 const* begin, int8 const* end)
+digest_type hash (std::int8_t const* begin, std::int8_t const* end)
{
digest_type digest;
hash (begin, end - begin, digest);
return digest;
}
-digest_type hash (uint8 const* begin, uint8 const* end)
+digest_type hash (std::uint8_t const* begin, std::uint8_t const* end)
{
digest_type digest;
hash (begin, end - begin, digest);
diff --git a/src/beast/beast/crypto/impl/sha2/sha2.c b/src/beast/beast/crypto/impl/sha2/sha2.c
index 125aae2cae..7d4811517d 100644
--- a/src/beast/beast/crypto/impl/sha2/sha2.c
+++ b/src/beast/beast/crypto/impl/sha2/sha2.c
@@ -103,9 +103,9 @@
* types and pointing out recent ANSI C support for uintXX_t in inttypes.h.
*/
-typedef uint8 sha2_byte; /* Exactly 1 byte */
-typedef uint32 sha2_word32; /* Exactly 4 bytes */
-typedef uint64 sha2_word64; /* Exactly 8 bytes */
+typedef std::uint8_t sha2_byte; /* Exactly 1 byte */
+typedef std::uint32_t sha2_word32; /* Exactly 4 bytes */
+typedef std::uint64_t sha2_word64; /* Exactly 8 bytes */
/*** SHA-256/384/512 Various Length Definitions ***********************/
/* NOTE: Most of these are in sha2.h */
diff --git a/src/beast/beast/crypto/impl/sha2/sha2.h b/src/beast/beast/crypto/impl/sha2/sha2.h
index 1728d86306..f1c4e7e9c5 100644
--- a/src/beast/beast/crypto/impl/sha2/sha2.h
+++ b/src/beast/beast/crypto/impl/sha2/sha2.h
@@ -58,9 +58,9 @@
/*** SHA-256/384/512 Context Structures *******************************/
typedef struct _SHA512_CTX {
- uint64 state[8];
- uint64 bitcount[2];
- uint8 buffer[SHA512_BLOCK_LENGTH];
+ std::uint64_t state[8];
+ std::uint64_t bitcount[2];
+ std::uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
typedef SHA512_CTX SHA384_CTX;
@@ -70,22 +70,22 @@ typedef SHA512_CTX SHA384_CTX;
#ifndef NOPROTO
void SHA256_Init(Sha256::detail::Context *);
-void SHA256_Update(Sha256::detail::Context*, const uint8*, size_t);
-void SHA256_Final(uint8[Sha256::digestLength], Sha256::detail::Context*);
+void SHA256_Update(Sha256::detail::Context*, const std::uint8_t*, size_t);
+void SHA256_Final(std::uint8_t[Sha256::digestLength], Sha256::detail::Context*);
char* SHA256_End(Sha256::detail::Context*, char[SHA256_DIGEST_STRING_LENGTH]);
-char* SHA256_Data(const uint8*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
+char* SHA256_Data(const std::uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
void SHA384_Init(SHA384_CTX*);
-void SHA384_Update(SHA384_CTX*, const uint8*, size_t);
-void SHA384_Final(uint8[SHA384_DIGEST_LENGTH], SHA384_CTX*);
+void SHA384_Update(SHA384_CTX*, const std::uint8_t*, size_t);
+void SHA384_Final(std::uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
-char* SHA384_Data(const uint8*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
+char* SHA384_Data(const std::uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
void SHA512_Init(SHA512_CTX*);
-void SHA512_Update(SHA512_CTX*, const uint8*, size_t);
-void SHA512_Final(uint8[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+void SHA512_Update(SHA512_CTX*, const std::uint8_t*, size_t);
+void SHA512_Final(std::uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
-char* SHA512_Data(const uint8*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
+char* SHA512_Data(const std::uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
#else /* NOPROTO */
diff --git a/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp b/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
index f66185f589..b85a2488f7 100644
--- a/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
+++ b/src/beast/beast/crypto/tests/BinaryEncoding.test.cpp
@@ -21,6 +21,7 @@
#include "../UnsignedInteger.h"
#include "../../unit_test/suite.h"
+#include "../../../modules/beast_core/maths/Random.h"
#include
#include
@@ -134,12 +135,12 @@ public:
static std::string encode (UnsignedInteger const& v)
{
std::string s;
- uint8 const* src (v.cbegin()-1);
+ std::uint8_t const* src (v.cbegin()-1);
char const* const tab (alphabet().c_str());
s.reserve (Bytes * 2);
for (std::size_t bytes (v.size);bytes--;)
{
- uint8 const v (*++src);
+ std::uint8_t const v (*++src);
s.push_back (tab [v>>4]);
s.push_back (tab [v&0x0f]);
}
@@ -153,7 +154,7 @@ public:
// can't have an odd size
if (s.size() & 1)
return false;
- uint8* dest (rv.begin()-1);
+ std::uint8_t* dest (rv.begin()-1);
int const* const tab (&inverse_alphabet().front());
for (std::string::const_iterator iter (s.begin()); iter != s.end();)
{
@@ -163,7 +164,7 @@ public:
int const n2 (tab [*iter++]);
if (n2 == -1)
return false;
- *++dest = ((uint8)((n1<<4)|n2));
+ *++dest = ((std::uint8_t)((n1<<4)|n2));
}
return true;
}
diff --git a/src/beast/beast/http/URL.h b/src/beast/beast/http/URL.h
index d2b01f6e55..12e2c31731 100644
--- a/src/beast/beast/http/URL.h
+++ b/src/beast/beast/http/URL.h
@@ -39,7 +39,7 @@ public:
URL (
String schema_,
String host_,
- uint16 port_,
+ std::uint16_t port_,
String port_string_,
String path_,
String query_ = "",
@@ -68,7 +68,7 @@ public:
/** Returns the port number as an integer.
If no port was specified, the value will be zero.
*/
- uint16 port () const;
+ std::uint16_t port () const;
/** Returns the port number as a string.
If no port was specified, the string will be empty.
@@ -100,7 +100,7 @@ public:
private:
String m_scheme;
String m_host;
- uint16 m_port;
+ std::uint16_t m_port;
String m_port_string;
String m_path;
String m_query;
diff --git a/src/beast/beast/http/impl/URL.cpp b/src/beast/beast/http/impl/URL.cpp
index 3167684dd0..4aa3810e7d 100644
--- a/src/beast/beast/http/impl/URL.cpp
+++ b/src/beast/beast/http/impl/URL.cpp
@@ -28,7 +28,7 @@ URL::URL ()
URL::URL (
String scheme_,
String host_,
- uint16 port_,
+ std::uint16_t port_,
String port_string_,
String path_,
String query_,
@@ -92,7 +92,7 @@ String URL::port_string () const
return m_port_string;
}
-uint16 URL::port () const
+std::uint16_t URL::port () const
{
return m_port;
}
diff --git a/src/beast/beast/net/IPAddress.h b/src/beast/beast/net/IPAddress.h
index 65e8c32b53..325a10c633 100644
--- a/src/beast/beast/net/IPAddress.h
+++ b/src/beast/beast/net/IPAddress.h
@@ -20,14 +20,14 @@
#ifndef BEAST_NET_IPADDRESS_H_INCLUDED
#define BEAST_NET_IPADDRESS_H_INCLUDED
-#include
-#include
-#include
-
-#include "../CStdInt.h"
#include "IPAddressV4.h"
#include "IPAddressV6.h"
+#include
+#include
+#include
+#include
+
//------------------------------------------------------------------------------
namespace beast {
diff --git a/src/beast/beast/net/IPAddressV4.h b/src/beast/beast/net/IPAddressV4.h
index 529c852a62..cf0c7bd38d 100644
--- a/src/beast/beast/net/IPAddressV4.h
+++ b/src/beast/beast/net/IPAddressV4.h
@@ -20,12 +20,11 @@
#ifndef BEAST_NET_IPADDRESSV4_H_INCLUDED
#define BEAST_NET_IPADDRESSV4_H_INCLUDED
-#include
+#include
#include
+#include
#include
-#include "../CStdInt.h"
-
namespace beast {
namespace IP {
@@ -38,12 +37,12 @@ struct AddressV4
/** Construct from a 32-bit unsigned.
@note Octets are formed in order from the MSB to the LSB.
*/
- explicit AddressV4 (uint32 value_);
+ explicit AddressV4 (std::uint32_t value_);
/** Construct from four individual octets..
@note The resulting address is a.b.c.d
*/
- AddressV4 (uint8 a, uint8 b, uint8 c, uint8 d);
+ AddressV4 (std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d);
/** Create an address from an IPv4 address string in dotted decimal form.
@return A pair with the address, and bool set to `true` on success.
@@ -108,7 +107,7 @@ struct AddressV4
{
public:
typedef typename std::conditional <
- IsConst, uint32 const*, uint32*>::type Pointer;
+ IsConst, std::uint32_t const*, std::uint32_t*>::type Pointer;
Proxy (int shift, Pointer value)
: m_shift (shift)
@@ -116,7 +115,7 @@ struct AddressV4
{
}
- operator uint8() const
+ operator std::uint8_t() const
{
return ((*m_value)>>m_shift) & 0xff;
}
@@ -141,7 +140,7 @@ struct AddressV4
/** @{ */
/** The value as a 32 bit unsigned. */
- uint32 value;
+ std::uint32_t value;
};
//------------------------------------------------------------------------------
diff --git a/src/beast/beast/net/IPAddressV6.h b/src/beast/beast/net/IPAddressV6.h
index f1244e42a8..bc3bb97d50 100644
--- a/src/beast/beast/net/IPAddressV6.h
+++ b/src/beast/beast/net/IPAddressV6.h
@@ -20,12 +20,12 @@
#ifndef BEAST_NET_IPADDRESSV6_H_INCLUDED
#define BEAST_NET_IPADDRESSV6_H_INCLUDED
-#include
+#include
+#include
#include
+#include
#include
-#include "../CStdInt.h"
-
namespace beast {
namespace IP {
@@ -37,9 +37,9 @@ struct AddressV6
/** Arithmetic comparison. */
/** @{ */
friend bool operator== (AddressV6 const&, AddressV6 const&)
- { bassertfalse; return false; }
+ { assert(false); return false; }
friend bool operator< (AddressV6 const&, AddressV6 const&)
- { bassertfalse; return false; }
+ { assert(false); return false; }
friend bool operator!= (AddressV6 const& lhs, AddressV6 const& rhs)
{ return ! (lhs == rhs); }
@@ -73,7 +73,7 @@ bool is_public (AddressV6 const& addr);
/** boost::hash support. */
inline std::size_t hash_value (AddressV6 const&)
- { bassertfalse; return 0; }
+ { assert(false); return 0; }
/** Returns the address represented as a string. */
std::string to_string (AddressV6 const& addr);
diff --git a/src/beast/beast/net/IPEndpoint.h b/src/beast/beast/net/IPEndpoint.h
index 188b60c184..c9b64ddf4b 100644
--- a/src/beast/beast/net/IPEndpoint.h
+++ b/src/beast/beast/net/IPEndpoint.h
@@ -20,16 +20,16 @@
#ifndef BEAST_NET_IPENDPOINT_H_INCLUDED
#define BEAST_NET_IPENDPOINT_H_INCLUDED
-#include
-#include
-
-#include "../CStdInt.h"
#include "IPAddress.h"
+#include
+#include
+#include
+
namespace beast {
namespace IP {
-typedef uint16 Port;
+typedef std::uint16_t Port;
/** A version-independent IP address and port combination. */
class Endpoint
diff --git a/src/beast/beast/net/detail/Parse.h b/src/beast/beast/net/detail/Parse.h
index 415f068cbd..4f4f398b49 100644
--- a/src/beast/beast/net/detail/Parse.h
+++ b/src/beast/beast/net/detail/Parse.h
@@ -61,16 +61,16 @@ struct integer_holder
/** Parse 8-bit unsigned integer. */
template
-InputStream& operator>> (InputStream& is, integer_holder const& i)
+InputStream& operator>> (InputStream& is, integer_holder const& i)
{
- uint16 v;
+ std::uint16_t v;
is >> v;
if (! (v>=0 && v<=255))
{
is.setstate (std::ios_base::failbit);
return is;
}
- i = uint8(v);
+ i = std::uint8_t(v);
return is;
}
diff --git a/src/beast/beast/net/impl/IPAddressV4.cpp b/src/beast/beast/net/impl/IPAddressV4.cpp
index 37af00ef2e..468c770d8c 100644
--- a/src/beast/beast/net/impl/IPAddressV4.cpp
+++ b/src/beast/beast/net/impl/IPAddressV4.cpp
@@ -34,12 +34,12 @@ AddressV4::AddressV4 ()
{
}
-AddressV4::AddressV4 (uint32 value_)
+AddressV4::AddressV4 (std::uint32_t value_)
: value (value_)
{
}
-AddressV4::AddressV4 (uint8 a, uint8 b, uint8 c, uint8 d)
+AddressV4::AddressV4 (std::uint8_t a, std::uint8_t b, std::uint8_t c, std::uint8_t d)
: value ((a<<24)|(b<<16)|(c<<8)|d)
{
}
@@ -166,7 +166,7 @@ std::string to_string (AddressV4 const& addr)
std::istream& operator>> (std::istream& is, AddressV4& addr)
{
- uint8 octet [4];
+ std::uint8_t octet [4];
is >> IP::detail::integer (octet [0]);
for (int i = 1; i < 4; ++i)
{
diff --git a/src/beast/beast/net/tests/IPEndpoint.test.cpp b/src/beast/beast/net/tests/IPEndpoint.test.cpp
index ccbee18cce..503aa67ede 100644
--- a/src/beast/beast/net/tests/IPEndpoint.test.cpp
+++ b/src/beast/beast/net/tests/IPEndpoint.test.cpp
@@ -36,7 +36,7 @@ namespace IP {
class IPEndpoint_test : public unit_test::suite
{
public:
- void shouldParseV4 (std::string const& s, uint32 value)
+ void shouldParseV4 (std::string const& s, std::uint32_t value)
{
std::pair const result (
AddressV4::from_string (s));
diff --git a/src/beast/beast/smart_ptr/SharedObject.h b/src/beast/beast/smart_ptr/SharedObject.h
index 55266c978f..fa0d5ad737 100644
--- a/src/beast/beast/smart_ptr/SharedObject.h
+++ b/src/beast/beast/smart_ptr/SharedObject.h
@@ -63,7 +63,7 @@ namespace beast {
@see SharedPtr, SharedObjectArray, SingleThreadedSharedObject
*/
-class BEAST_API SharedObject : public Uncopyable
+class SharedObject : public Uncopyable
{
public:
//==============================================================================
diff --git a/src/beast/beast/strings/CharPointer_ASCII.h b/src/beast/beast/strings/CharPointer_ASCII.h
index 4275471140..48e96bb46c 100644
--- a/src/beast/beast/strings/CharPointer_ASCII.h
+++ b/src/beast/beast/strings/CharPointer_ASCII.h
@@ -87,7 +87,7 @@ public:
inline bool isEmpty() const noexcept { return *data == 0; }
/** Returns the unicode character that this pointer is pointing to. */
- inline beast_wchar operator*() const noexcept { return (beast_wchar) (uint8) *data; }
+ inline beast_wchar operator*() const noexcept { return (beast_wchar) (std::uint8_t) *data; }
/** Moves this pointer along to the next character in the string. */
inline CharPointer_ASCII operator++() noexcept
@@ -105,7 +105,7 @@ public:
/** Returns the character that this pointer is currently pointing to, and then
advances the pointer to point to the next character. */
- inline beast_wchar getAndAdvance() noexcept { return (beast_wchar) (uint8) *data++; }
+ inline beast_wchar getAndAdvance() noexcept { return (beast_wchar) (std::uint8_t) *data++; }
/** Moves this pointer along to the next character in the string. */
CharPointer_ASCII operator++ (int) noexcept
@@ -332,27 +332,27 @@ public:
/** Returns true if the first character of this string is a letter or digit. */
bool isLetterOrDigit() const { return CharacterFunctions::isLetterOrDigit (*data) != 0; }
/** Returns true if the first character of this string is upper-case. */
- bool isUpperCase() const { return CharacterFunctions::isUpperCase ((beast_wchar) (uint8) *data) != 0; }
+ bool isUpperCase() const { return CharacterFunctions::isUpperCase ((beast_wchar) (std::uint8_t) *data) != 0; }
/** Returns true if the first character of this string is lower-case. */
- bool isLowerCase() const { return CharacterFunctions::isLowerCase ((beast_wchar) (uint8) *data) != 0; }
+ bool isLowerCase() const { return CharacterFunctions::isLowerCase ((beast_wchar) (std::uint8_t) *data) != 0; }
/** Returns an upper-case version of the first character of this string. */
- beast_wchar toUpperCase() const noexcept { return CharacterFunctions::toUpperCase ((beast_wchar) (uint8) *data); }
+ beast_wchar toUpperCase() const noexcept { return CharacterFunctions::toUpperCase ((beast_wchar) (std::uint8_t) *data); }
/** Returns a lower-case version of the first character of this string. */
- beast_wchar toLowerCase() const noexcept { return CharacterFunctions::toLowerCase ((beast_wchar) (uint8) *data); }
+ beast_wchar toLowerCase() const noexcept { return CharacterFunctions::toLowerCase ((beast_wchar) (std::uint8_t) *data); }
/** Parses this string as a 32-bit integer. */
int getIntValue32() const noexcept { return atoi (data); }
/** Parses this string as a 64-bit integer. */
- int64 getIntValue64() const noexcept
+ std::int64_t getIntValue64() const noexcept
{
#if BEAST_LINUX || BEAST_ANDROID
return atoll (data);
#elif BEAST_WINDOWS
return _atoi64 (data);
#else
- return CharacterFunctions::getIntValue (*this);
+ return CharacterFunctions::getIntValue (*this);
#endif
}
diff --git a/src/beast/beast/strings/CharPointer_UTF16.h b/src/beast/beast/strings/CharPointer_UTF16.h
index b34ed4e9e0..987989cbd1 100644
--- a/src/beast/beast/strings/CharPointer_UTF16.h
+++ b/src/beast/beast/strings/CharPointer_UTF16.h
@@ -26,10 +26,11 @@
#include "../Config.h"
#include "../Atomic.h"
-#include "../CStdInt.h"
#include "CharacterFunctions.h"
+#include
+
namespace beast {
//==============================================================================
@@ -44,7 +45,7 @@ public:
#if BEAST_NATIVE_WCHAR_IS_UTF16
typedef wchar_t CharType;
#else
- typedef int16 CharType;
+ typedef std::int16_t CharType;
#endif
inline explicit CharPointer_UTF16 (const CharType* const rawPointer) noexcept
@@ -89,10 +90,10 @@ public:
/** Returns the unicode character that this pointer is pointing to. */
beast_wchar operator*() const noexcept
{
- uint32 n = (uint32) (uint16) *data;
+ std::uint32_t n = (std::uint32_t) (std::uint16_t) *data;
- if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) data[1]) >= 0xdc00)
- n = 0x10000 + (((n - 0xd800) << 10) | (((uint32) (uint16) data[1]) - 0xdc00));
+ if (n >= 0xd800 && n <= 0xdfff && ((std::uint32_t) (std::uint16_t) data[1]) >= 0xdc00)
+ n = 0x10000 + (((n - 0xd800) << 10) | (((std::uint32_t) (std::uint16_t) data[1]) - 0xdc00));
return (beast_wchar) n;
}
@@ -102,7 +103,7 @@ public:
{
const beast_wchar n = *data++;
- if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) *data) >= 0xdc00)
+ if (n >= 0xd800 && n <= 0xdfff && ((std::uint32_t) (std::uint16_t) *data) >= 0xdc00)
++data;
return *this;
@@ -123,10 +124,10 @@ public:
advances the pointer to point to the next character. */
beast_wchar getAndAdvance() noexcept
{
- uint32 n = (uint32) (uint16) *data++;
+ std::uint32_t n = (std::uint32_t) (std::uint16_t) *data++;
- if (n >= 0xd800 && n <= 0xdfff && ((uint32) (uint16) *data) >= 0xdc00)
- n = 0x10000 + ((((n - 0xd800) << 10) | (((uint32) (uint16) *data++) - 0xdc00)));
+ if (n >= 0xd800 && n <= 0xdfff && ((std::uint32_t) (std::uint16_t) *data) >= 0xdc00)
+ n = 0x10000 + ((((n - 0xd800) << 10) | (((std::uint32_t) (std::uint16_t) *data++) - 0xdc00)));
return (beast_wchar) n;
}
@@ -418,12 +419,12 @@ public:
}
/** Parses this string as a 64-bit integer. */
- int64 getIntValue64() const noexcept
+ std::int64_t getIntValue64() const noexcept
{
#if BEAST_WINDOWS
return _wtoi64 (data);
#else
- return CharacterFunctions::getIntValue (*this);
+ return CharacterFunctions::getIntValue (*this);
#endif
}
@@ -447,7 +448,7 @@ public:
while (--maxBytesToRead >= 0 && *dataToTest != 0)
{
- const uint32 n = (uint32) (uint16) *dataToTest++;
+ const std::uint32_t n = (std::uint32_t) (std::uint16_t) *dataToTest++;
if (n >= 0xd800)
{
@@ -459,7 +460,7 @@ public:
if (n > 0xdc00)
return false;
- const uint32 nextChar = (uint32) (uint16) *dataToTest++;
+ const std::uint32_t nextChar = (std::uint32_t) (std::uint16_t) *dataToTest++;
if (nextChar < 0xdc00 || nextChar > 0xdfff)
return false;
@@ -491,10 +492,10 @@ public:
static bool isByteOrderMarkBigEndian (const void* possibleByteOrder) noexcept
{
bassert (possibleByteOrder != nullptr);
- const uint8* const c = static_cast (possibleByteOrder);
+ const std::uint8_t* const c = static_cast (possibleByteOrder);
- return c[0] == (uint8) byteOrderMarkBE1
- && c[1] == (uint8) byteOrderMarkBE2;
+ return c[0] == (std::uint8_t) byteOrderMarkBE1
+ && c[1] == (std::uint8_t) byteOrderMarkBE2;
}
/** Returns true if the first pair of bytes in this pointer are the UTF16 byte-order mark (little endian).
@@ -503,10 +504,10 @@ public:
static bool isByteOrderMarkLittleEndian (const void* possibleByteOrder) noexcept
{
bassert (possibleByteOrder != nullptr);
- const uint8* const c = static_cast (possibleByteOrder);
+ const std::uint8_t* const c = static_cast (possibleByteOrder);
- return c[0] == (uint8) byteOrderMarkLE1
- && c[1] == (uint8) byteOrderMarkLE2;
+ return c[0] == (std::uint8_t) byteOrderMarkLE1
+ && c[1] == (std::uint8_t) byteOrderMarkLE2;
}
private:
diff --git a/src/beast/beast/strings/CharPointer_UTF32.h b/src/beast/beast/strings/CharPointer_UTF32.h
index d5dfa082d0..37ab304ccb 100644
--- a/src/beast/beast/strings/CharPointer_UTF32.h
+++ b/src/beast/beast/strings/CharPointer_UTF32.h
@@ -341,7 +341,7 @@ public:
/** Parses this string as a 32-bit integer. */
int getIntValue32() const noexcept { return CharacterFunctions::getIntValue (*this); }
/** Parses this string as a 64-bit integer. */
- int64 getIntValue64() const noexcept { return CharacterFunctions::getIntValue (*this); }
+ std::int64_t getIntValue64() const noexcept { return CharacterFunctions::getIntValue (*this); }
/** Parses this string as a floating point double. */
double getDoubleValue() const noexcept { return CharacterFunctions::getDoubleValue (*this); }
diff --git a/src/beast/beast/strings/CharPointer_UTF8.h b/src/beast/beast/strings/CharPointer_UTF8.h
index f729c984b1..ac9f709e9f 100644
--- a/src/beast/beast/strings/CharPointer_UTF8.h
+++ b/src/beast/beast/strings/CharPointer_UTF8.h
@@ -90,11 +90,11 @@ public:
const signed char byte = (signed char) *data;
if (byte >= 0)
- return (beast_wchar) (uint8) byte;
+ return (beast_wchar) (std::uint8_t) byte;
- uint32 n = (uint32) (uint8) byte;
- uint32 mask = 0x7f;
- uint32 bit = 0x40;
+ std::uint32_t n = (std::uint32_t) (std::uint8_t) byte;
+ std::uint32_t mask = 0x7f;
+ std::uint32_t bit = 0x40;
size_t numExtraValues = 0;
while ((n & bit) != 0 && bit > 0x10)
@@ -108,7 +108,7 @@ public:
for (size_t i = 1; i <= numExtraValues; ++i)
{
- const uint8 nextByte = (uint8) data [i];
+ const std::uint8_t nextByte = (std::uint8_t) data [i];
if ((nextByte & 0xc0) != 0x80)
break;
@@ -157,11 +157,11 @@ public:
const signed char byte = (signed char) *data++;
if (byte >= 0)
- return (beast_wchar) (uint8) byte;
+ return (beast_wchar) (std::uint8_t) byte;
- uint32 n = (uint32) (uint8) byte;
- uint32 mask = 0x7f;
- uint32 bit = 0x40;
+ std::uint32_t n = (std::uint32_t) (std::uint8_t) byte;
+ std::uint32_t mask = 0x7f;
+ std::uint32_t bit = 0x40;
int numExtraValues = 0;
while ((n & bit) != 0 && bit > 0x8)
@@ -175,7 +175,7 @@ public:
while (--numExtraValues >= 0)
{
- const uint32 nextByte = (uint32) (uint8) *data++;
+ const std::uint32_t nextByte = (std::uint32_t) (std::uint8_t) *data++;
if ((nextByte & 0xc0) != 0x80)
break;
@@ -248,11 +248,11 @@ public:
for (;;)
{
- const uint32 n = (uint32) (uint8) *d++;
+ const std::uint32_t n = (std::uint32_t) (std::uint8_t) *d++;
if ((n & 0x80) != 0)
{
- uint32 bit = 0x40;
+ std::uint32_t bit = 0x40;
while ((n & bit) != 0)
{
@@ -299,7 +299,7 @@ public:
static size_t getBytesRequiredFor (const beast_wchar charToWrite) noexcept
{
size_t num = 1;
- const uint32 c = (uint32) charToWrite;
+ const std::uint32_t c = (std::uint32_t) charToWrite;
if (c >= 0x80)
{
@@ -340,7 +340,7 @@ public:
/** Writes a unicode character to this string, and advances this pointer to point to the next position. */
void write (const beast_wchar charToWrite) noexcept
{
- const uint32 c = (uint32) charToWrite;
+ const std::uint32_t c = (std::uint32_t) charToWrite;
if (c >= 0x80)
{
@@ -352,7 +352,7 @@ public:
++numExtraBytes;
}
- *data++ = (CharType) ((uint32) (0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6)));
+ *data++ = (CharType) ((std::uint32_t) (0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6)));
while (--numExtraBytes >= 0)
*data++ = (CharType) (0x80 | (0x3f & (c >> (numExtraBytes * 6))));
@@ -488,14 +488,14 @@ public:
int getIntValue32() const noexcept { return atoi (data); }
/** Parses this string as a 64-bit integer. */
- int64 getIntValue64() const noexcept
+ std::int64_t getIntValue64() const noexcept
{
#if BEAST_LINUX || BEAST_ANDROID
return atoll (data);
#elif BEAST_WINDOWS
return _atoi64 (data);
#else
- return CharacterFunctions::getIntValue (*this);
+ return CharacterFunctions::getIntValue (*this);
#endif
}
@@ -520,7 +520,7 @@ public:
if (byte < 0)
{
- uint8 bit = 0x40;
+ std::uint8_t bit = 0x40;
int numExtraValues = 0;
while ((byte & bit) != 0)
@@ -569,11 +569,11 @@ public:
static bool isByteOrderMark (const void* possibleByteOrder) noexcept
{
bassert (possibleByteOrder != nullptr);
- const uint8* const c = static_cast (possibleByteOrder);
+ const std::uint8_t* const c = static_cast (possibleByteOrder);
- return c[0] == (uint8) byteOrderMark1
- && c[1] == (uint8) byteOrderMark2
- && c[2] == (uint8) byteOrderMark3;
+ return c[0] == (std::uint8_t) byteOrderMark1
+ && c[1] == (std::uint8_t) byteOrderMark2
+ && c[2] == (std::uint8_t) byteOrderMark3;
}
private:
diff --git a/src/beast/beast/strings/CharacterFunctions.h b/src/beast/beast/strings/CharacterFunctions.h
index f369544129..d05bcdd6db 100644
--- a/src/beast/beast/strings/CharacterFunctions.h
+++ b/src/beast/beast/strings/CharacterFunctions.h
@@ -27,9 +27,10 @@
#include
#include "../Config.h"
-#include "../CStdInt.h"
#include "../Memory.h"
+#include
+
namespace beast {
//==============================================================================
@@ -50,7 +51,7 @@ namespace beast {
/** A platform-independent 32-bit unicode character type. */
typedef wchar_t beast_wchar;
#else
- typedef uint32 beast_wchar;
+ typedef std::uint32_t beast_wchar;
#endif
#ifndef DOXYGEN
@@ -78,7 +79,7 @@ namespace beast {
@see String, CharPointer_UTF8, CharPointer_UTF16, CharPointer_UTF32
*/
-class BEAST_API CharacterFunctions
+class CharacterFunctions
{
public:
//==============================================================================
diff --git a/src/beast/beast/strings/NewLine.h b/src/beast/beast/strings/NewLine.h
index 23dfb0c058..1566402d0a 100644
--- a/src/beast/beast/strings/NewLine.h
+++ b/src/beast/beast/strings/NewLine.h
@@ -41,7 +41,7 @@ namespace beast {
The exact character sequence that will be used for the new-line can be set and
retrieved with OutputStream::setNewLineString() and OutputStream::getNewLineString().
*/
-class BEAST_API NewLine
+class NewLine
{
public:
/** Returns the default new-line sequence that the library uses.
@@ -72,7 +72,7 @@ extern NewLine newLine;
myString << "Hello World" << newLine << newLine;
@endcode
*/
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, const NewLine&);
+String& operator<< (String& string1, const NewLine&);
}
diff --git a/src/beast/beast/strings/String.h b/src/beast/beast/strings/String.h
index 198408ac55..db7a0df480 100644
--- a/src/beast/beast/strings/String.h
+++ b/src/beast/beast/strings/String.h
@@ -25,7 +25,6 @@
#define BEAST_STRINGS_STRING_H_INCLUDED
#include "../Config.h"
-#include "../CStdInt.h"
#include "../Memory.h"
#include "CharacterFunctions.h"
@@ -44,6 +43,7 @@
#include "StringFromNumber.h"
#include "String.h"
+#include
#include
namespace beast {
@@ -66,7 +66,7 @@ namespace beast {
@see StringArray, StringPairArray
*/
-class BEAST_API String
+class String
{
public:
//==============================================================================
@@ -193,7 +193,7 @@ public:
int hashCode() const noexcept;
/** Generates a probably-unique 64-bit hashcode from this string. */
- int64 hashCode64() const noexcept;
+ std::int64_t hashCode64() const noexcept;
/** Returns a hash value suitable for use with std::hash. */
std::size_t hash() const noexcept;
@@ -920,15 +920,13 @@ public:
*/
explicit String (unsigned short decimalInteger);
- /** Creates a string containing this signed 64-bit integer as a decimal number.
- @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString
- */
- explicit String (int64 largeIntegerValue);
+ explicit String (long largeIntegerValue);
- /** Creates a string containing this unsigned 64-bit integer as a decimal number.
- @see getLargeIntValue, getFloatValue, getDoubleValue, toHexString
- */
- explicit String (uint64 largeIntegerValue);
+ explicit String (unsigned long largeIntegerValue);
+
+ explicit String (long long largeIntegerValue);
+
+ explicit String (unsigned long long largeIntegerValue);
/** Creates a string representing this floating-point number.
@param floatValue the value to convert to a string
@@ -971,7 +969,7 @@ public:
@returns the value of the string as a 64 bit signed base-10 integer.
*/
- int64 getLargeIntValue() const noexcept;
+ std::int64_t getLargeIntValue() const noexcept;
/** Parses a decimal number from the end of the string.
@@ -1018,13 +1016,13 @@ public:
@returns a 64-bit number which is the value of the string in hex.
*/
- int64 getHexValue64() const noexcept;
+ std::int64_t getHexValue64() const noexcept;
/** Creates a string representing this 32-bit value in hexadecimal. */
static String toHexString (int number);
/** Creates a string representing this 64-bit value in hexadecimal. */
- static String toHexString (int64 number);
+ static String toHexString (std::int64_t number);
/** Creates a string representing this 16-bit value in hexadecimal. */
static String toHexString (short number);
@@ -1273,103 +1271,103 @@ inline String String::fromNumber (double number, int numberOfDecimalPla
//------------------------------------------------------------------------------
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (const char* string1, const String& string2);
+String operator+ (const char* string1, const String& string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (const wchar_t* string1, const String& string2);
+String operator+ (const wchar_t* string1, const String& string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (char string1, const String& string2);
+String operator+ (char string1, const String& string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (wchar_t string1, const String& string2);
+String operator+ (wchar_t string1, const String& string2);
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (beast_wchar string1, const String& string2);
+String operator+ (beast_wchar string1, const String& string2);
#endif
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, const String& string2);
+String operator+ (String string1, const String& string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, const char* string2);
+String operator+ (String string1, const char* string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, const wchar_t* string2);
+String operator+ (String string1, const wchar_t* string2);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, char characterToAppend);
+String operator+ (String string1, char characterToAppend);
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, wchar_t characterToAppend);
+String operator+ (String string1, wchar_t characterToAppend);
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
/** Concatenates two strings. */
-BEAST_API String BEAST_CALLTYPE operator+ (String string1, beast_wchar characterToAppend);
+String operator+ (String string1, beast_wchar characterToAppend);
#endif
//==============================================================================
/** Appends a character at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, char characterToAppend);
+String& operator<< (String& string1, char characterToAppend);
/** Appends a character at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, wchar_t characterToAppend);
+String& operator<< (String& string1, wchar_t characterToAppend);
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
/** Appends a character at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, beast_wchar characterToAppend);
+String& operator<< (String& string1, beast_wchar characterToAppend);
#endif
/** Appends a string to the end of the first one. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, const char* string2);
+String& operator<< (String& string1, const char* string2);
/** Appends a string to the end of the first one. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, const wchar_t* string2);
+String& operator<< (String& string1, const wchar_t* string2);
/** Appends a string to the end of the first one. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, const String& string2);
+String& operator<< (String& string1, const String& string2);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, short number);
+String& operator<< (String& string1, short number);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, int number);
+String& operator<< (String& string1, int number);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, long number);
+String& operator<< (String& string1, long number);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, int64 number);
+String& operator<< (String& string1, std::int64_t number);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, float number);
+String& operator<< (String& string1, float number);
/** Appends a decimal number at the end of a string. */
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, double number);
+String& operator<< (String& string1, double number);
//==============================================================================
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const String& string2) noexcept;
+bool operator== (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const char* string2) noexcept;
+bool operator== (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const wchar_t* string2) noexcept;
+bool operator== (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const CharPointer_UTF8 string2) noexcept;
+bool operator== (const String& string1, const CharPointer_UTF8 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const CharPointer_UTF16 string2) noexcept;
+bool operator== (const String& string1, const CharPointer_UTF16 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator== (const String& string1, const CharPointer_UTF32 string2) noexcept;
+bool operator== (const String& string1, const CharPointer_UTF32 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const String& string2) noexcept;
+bool operator!= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const char* string2) noexcept;
+bool operator!= (const String& string1, const char* string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const wchar_t* string2) noexcept;
+bool operator!= (const String& string1, const wchar_t* string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const CharPointer_UTF8 string2) noexcept;
+bool operator!= (const String& string1, const CharPointer_UTF8 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const CharPointer_UTF16 string2) noexcept;
+bool operator!= (const String& string1, const CharPointer_UTF16 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& string1, const CharPointer_UTF32 string2) noexcept;
+bool operator!= (const String& string1, const CharPointer_UTF32 string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator> (const String& string1, const String& string2) noexcept;
+bool operator> (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator< (const String& string1, const String& string2) noexcept;
+bool operator< (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator>= (const String& string1, const String& string2) noexcept;
+bool operator>= (const String& string1, const String& string2) noexcept;
/** Case-sensitive comparison of two strings. */
-BEAST_API bool BEAST_CALLTYPE operator<= (const String& string1, const String& string2) noexcept;
+bool operator<= (const String& string1, const String& string2) noexcept;
//==============================================================================
/** This operator allows you to write a beast String directly to std output streams.
This is handy for writing strings to std::cout, std::cerr, etc.
*/
template
-std::basic_ostream & BEAST_CALLTYPE operator<< (std::basic_ostream & stream, const String& stringToWrite)
+std::basic_ostream & operator<< (std::basic_ostream & stream, const String& stringToWrite)
{
return stream << stringToWrite.toRawUTF8();
}
@@ -1378,7 +1376,7 @@ std::basic_ostream & BEAST_CALLTYPE operator<< (std::basic_ostream
This is handy for writing strings to std::wcout, std::wcerr, etc.
*/
template
-std::basic_ostream & BEAST_CALLTYPE operator<< (std::basic_ostream & stream, const String& stringToWrite)
+std::basic_ostream & operator<< (std::basic_ostream & stream, const String& stringToWrite)
{
return stream << stringToWrite.toWideCharPointer();
}
diff --git a/src/beast/beast/strings/StringFromNumber.h b/src/beast/beast/strings/StringFromNumber.h
index b50a989e2b..21d8438b09 100644
--- a/src/beast/beast/strings/StringFromNumber.h
+++ b/src/beast/beast/strings/StringFromNumber.h
@@ -75,13 +75,13 @@ public:
if (std::numeric_limits ::is_signed)
{
if (n >= 0)
- return printDigits (t, static_cast (n));
+ return printDigits (t, static_cast (n));
// NB: this needs to be careful not to call
- // -std::numeric_limits::min(),
+ // -std::numeric_limits::min(),
// which has undefined behaviour
//
- t = printDigits (t, static_cast (-(n + 1)) + 1);
+ t = printDigits (t, static_cast (-(n + 1)) + 1);
*--t = '-';
return t;
}
@@ -123,7 +123,7 @@ public:
{
char* const end = buffer + numChars;
char* t = end;
- int64 v = (int64) (pow (10.0, numDecPlaces) * std::abs (n) + 0.5);
+ std::int64_t v = (std::int64_t) (pow (10.0, numDecPlaces) * std::abs (n) + 0.5);
*--t = (char) 0;
while (numDecPlaces >= 0 || v > 0)
diff --git a/src/beast/beast/strings/impl/String.cpp b/src/beast/beast/strings/impl/String.cpp
index 8a52c1ecca..a9e19a44a8 100644
--- a/src/beast/beast/strings/impl/String.cpp
+++ b/src/beast/beast/strings/impl/String.cpp
@@ -381,8 +381,10 @@ String::String (const int number) : text (NumberToStringConverters::c
String::String (const unsigned int number) : text (NumberToStringConverters::createFromInteger (number)) {}
String::String (const short number) : text (NumberToStringConverters::createFromInteger ((int) number)) {}
String::String (const unsigned short number) : text (NumberToStringConverters::createFromInteger ((unsigned int) number)) {}
-String::String (const int64 number) : text (NumberToStringConverters::createFromInteger (number)) {}
-String::String (const uint64 number) : text (NumberToStringConverters::createFromInteger (number)) {}
+String::String (const long number) : text (NumberToStringConverters::createFromInteger (number)) {}
+String::String (const unsigned long number) : text (NumberToStringConverters::createFromInteger (number)) {}
+String::String (const long long number) : text (NumberToStringConverters::createFromInteger (number)) {}
+String::String (const unsigned long long number) : text (NumberToStringConverters::createFromInteger (number)) {}
String::String (const float number) : text (NumberToStringConverters::createFromDouble ((double) number, 0)) {}
String::String (const double number) : text (NumberToStringConverters::createFromDouble (number, 0)) {}
@@ -434,9 +436,9 @@ int String::hashCode() const noexcept
return detail::HashGenerator ::calculate (text);
}
-int64 String::hashCode64() const noexcept
+std::int64_t String::hashCode64() const noexcept
{
- return detail::HashGenerator ::calculate (text);
+ return detail::HashGenerator ::calculate (text);
}
std::size_t String::hash() const noexcept
@@ -445,22 +447,22 @@ std::size_t String::hash() const noexcept
}
//==============================================================================
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const char* const s2) noexcept { return s1.compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator== (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const char* const s2) noexcept { return s1.compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator!= (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
-BEAST_API bool BEAST_CALLTYPE operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; }
-BEAST_API bool BEAST_CALLTYPE operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; }
-BEAST_API bool BEAST_CALLTYPE operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; }
-BEAST_API bool BEAST_CALLTYPE operator<= (const String& s1, const String& s2) noexcept { return s1.compare (s2) <= 0; }
+bool operator== (const String& s1, const String& s2) noexcept { return s1.compare (s2) == 0; }
+bool operator== (const String& s1, const char* const s2) noexcept { return s1.compare (s2) == 0; }
+bool operator== (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) == 0; }
+bool operator== (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
+bool operator== (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
+bool operator== (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) == 0; }
+bool operator!= (const String& s1, const String& s2) noexcept { return s1.compare (s2) != 0; }
+bool operator!= (const String& s1, const char* const s2) noexcept { return s1.compare (s2) != 0; }
+bool operator!= (const String& s1, const wchar_t* const s2) noexcept { return s1.compare (s2) != 0; }
+bool operator!= (const String& s1, const CharPointer_UTF8 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
+bool operator!= (const String& s1, const CharPointer_UTF16 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
+bool operator!= (const String& s1, const CharPointer_UTF32 s2) noexcept { return s1.getCharPointer().compare (s2) != 0; }
+bool operator> (const String& s1, const String& s2) noexcept { return s1.compare (s2) > 0; }
+bool operator< (const String& s1, const String& s2) noexcept { return s1.compare (s2) < 0; }
+bool operator>= (const String& s1, const String& s2) noexcept { return s1.compare (s2) >= 0; }
+bool operator<= (const String& s1, const String& s2) noexcept { return s1.compare (s2) <= 0; }
bool String::equalsIgnoreCase (const wchar_t* const t) const noexcept
{
@@ -612,52 +614,52 @@ String& String::operator+= (const int number)
}
//==============================================================================
-BEAST_API String BEAST_CALLTYPE operator+ (const char* const string1, const String& string2)
+String operator+ (const char* const string1, const String& string2)
{
String s (string1);
return s += string2;
}
-BEAST_API String BEAST_CALLTYPE operator+ (const wchar_t* const string1, const String& string2)
+String operator+ (const wchar_t* const string1, const String& string2)
{
String s (string1);
return s += string2;
}
-BEAST_API String BEAST_CALLTYPE operator+ (const char s1, const String& s2) { return String::charToString ((beast_wchar) (uint8) s1) + s2; }
-BEAST_API String BEAST_CALLTYPE operator+ (const wchar_t s1, const String& s2) { return String::charToString (s1) + s2; }
+String operator+ (const char s1, const String& s2) { return String::charToString ((beast_wchar) (std::uint8_t) s1) + s2; }
+String operator+ (const wchar_t s1, const String& s2) { return String::charToString (s1) + s2; }
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
-BEAST_API String BEAST_CALLTYPE operator+ (const beast_wchar s1, const String& s2) { return String::charToString (s1) + s2; }
+String operator+ (const beast_wchar s1, const String& s2) { return String::charToString (s1) + s2; }
#endif
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const String& s2) { return s1 += s2; }
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const char* const s2) { return s1 += s2; }
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const wchar_t* s2) { return s1 += s2; }
+String operator+ (String s1, const String& s2) { return s1 += s2; }
+String operator+ (String s1, const char* const s2) { return s1 += s2; }
+String operator+ (String s1, const wchar_t* s2) { return s1 += s2; }
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const char s2) { return s1 += s2; }
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const wchar_t s2) { return s1 += s2; }
+String operator+ (String s1, const char s2) { return s1 += s2; }
+String operator+ (String s1, const wchar_t s2) { return s1 += s2; }
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
-BEAST_API String BEAST_CALLTYPE operator+ (String s1, const beast_wchar s2) { return s1 += s2; }
+String operator+ (String s1, const beast_wchar s2) { return s1 += s2; }
#endif
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const char s2) { return s1 += s2; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const wchar_t s2) { return s1 += s2; }
+String& operator<< (String& s1, const char s2) { return s1 += s2; }
+String& operator<< (String& s1, const wchar_t s2) { return s1 += s2; }
#if ! BEAST_NATIVE_WCHAR_IS_UTF32
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const beast_wchar s2) { return s1 += s2; }
+String& operator<< (String& s1, const beast_wchar s2) { return s1 += s2; }
#endif
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const char* const s2) { return s1 += s2; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const wchar_t* const s2) { return s1 += s2; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const String& s2) { return s1 += s2; }
+String& operator<< (String& s1, const char* const s2) { return s1 += s2; }
+String& operator<< (String& s1, const wchar_t* const s2) { return s1 += s2; }
+String& operator<< (String& s1, const String& s2) { return s1 += s2; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const short number) { return s1 += (int) number; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const int number) { return s1 += number; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const long number) { return s1 += (int) number; }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const int64 number) { return s1 << String (number); }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const float number) { return s1 += String (number); }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& s1, const double number) { return s1 += String (number); }
+String& operator<< (String& s1, const short number) { return s1 += (int) number; }
+String& operator<< (String& s1, const int number) { return s1 += number; }
+String& operator<< (String& s1, const long number) { return s1 += (int) number; }
+String& operator<< (String& s1, const long long number) { return s1 << String (number); }
+String& operator<< (String& s1, const float number) { return s1 += String (number); }
+String& operator<< (String& s1, const double number) { return s1 += String (number); }
-BEAST_API String& BEAST_CALLTYPE operator<< (String& string1, const NewLine&)
+String& operator<< (String& string1, const NewLine&)
{
return string1 += NewLine::getDefault();
}
@@ -1711,7 +1713,7 @@ int String::getTrailingIntValue() const noexcept
return n;
}
-int64 String::getLargeIntValue() const noexcept
+std::int64_t String::getLargeIntValue() const noexcept
{
return text.getIntValue64();
}
@@ -1769,9 +1771,9 @@ String String::toHexString (const int number)
return HexConverter ::hexToString ((unsigned int) number);
}
-String String::toHexString (const int64 number)
+String String::toHexString (const std::int64_t number)
{
- return HexConverter ::hexToString ((uint64) number);
+ return HexConverter ::hexToString ((std::uint64_t) number);
}
String String::toHexString (const short number)
@@ -1808,12 +1810,12 @@ String String::toHexString (const void* const d, const int size, const int group
}
int String::getHexValue32() const noexcept { return HexConverter ::stringToHex (text); }
-int64 String::getHexValue64() const noexcept { return HexConverter::stringToHex (text); }
+std::int64_t String::getHexValue64() const noexcept { return HexConverter::stringToHex (text); }
//==============================================================================
String String::createStringFromData (const void* const unknownData, const int size)
{
- const uint8* const data = static_cast (unknownData);
+ const std::uint8_t* const data = static_cast (unknownData);
if (size <= 0 || data == nullptr)
return empty;
@@ -1828,7 +1830,7 @@ String String::createStringFromData (const void* const unknownData, const int si
StringCreationHelper builder ((size_t) numChars);
- const uint16* const src = (const uint16*) (data + 2);
+ const std::uint16_t* const src = (const std::uint16_t*) (data + 2);
if (CharPointer_UTF16::isByteOrderMarkBigEndian (data))
{
@@ -1845,7 +1847,7 @@ String String::createStringFromData (const void* const unknownData, const int si
return builder.result;
}
- const uint8* start = data;
+ const std::uint8_t* start = data;
if (size >= 3 && CharPointer_UTF8::isByteOrderMark (data))
start += 3;
@@ -1932,7 +1934,7 @@ struct StringCopier
{
static size_t copyToBuffer (const CharPointerType_Src source, typename CharPointerType_Dest::CharType* const buffer, const size_t maxBufferSizeBytes)
{
- bassert (((ssize_t) maxBufferSizeBytes) >= 0); // keep this value positive!
+ bassert (((std::ptrdiff_t) maxBufferSizeBytes) >= 0); // keep this value positive!
if (buffer == nullptr)
return CharPointerType_Dest::getBytesRequiredFor (source) + sizeof (typename CharPointerType_Dest::CharType);
diff --git a/src/beast/beast/threads/ServiceQueue.h b/src/beast/beast/threads/ServiceQueue.h
index 8f2134e79b..c001865c68 100644
--- a/src/beast/beast/threads/ServiceQueue.h
+++ b/src/beast/beast/threads/ServiceQueue.h
@@ -74,13 +74,13 @@ public:
static Page* create (size_type pageBytes)
{
- return new (new uint8[pageBytes + overhead()]) Page (pageBytes);
+ return new (new std::uint8_t[pageBytes + overhead()]) Page (pageBytes);
}
static void destroy (Page* page)
{
page->~Page();
- delete[] ((uint8*)page);
+ delete[] ((std::uint8_t*)page);
}
void reset ()
@@ -599,10 +599,10 @@ private:
(*item)();
- typename Allocator::template rebind ::other a (m_alloc);
+ typename Allocator::template rebind ::other a (m_alloc);
std::size_t const size (item->size());
item->~Item();
- a.deallocate (reinterpret_cast(item), size);
+ a.deallocate (reinterpret_cast(item), size);
return 1;
}
diff --git a/src/beast/beast/threads/SpinLock.h b/src/beast/beast/threads/SpinLock.h
index 88e21fcdbd..4750911eb5 100644
--- a/src/beast/beast/threads/SpinLock.h
+++ b/src/beast/beast/threads/SpinLock.h
@@ -44,7 +44,7 @@ namespace beast {
@see CriticalSection
*/
-class BEAST_API SpinLock : public Uncopyable
+class SpinLock : public Uncopyable
{
public:
/** Provides the type of scoped lock to use for locking a SpinLock. */
diff --git a/src/beast/beast/threads/Thread.h b/src/beast/beast/threads/Thread.h
index 4a89fe4657..aee57d5f0d 100644
--- a/src/beast/beast/threads/Thread.h
+++ b/src/beast/beast/threads/Thread.h
@@ -45,7 +45,7 @@ namespace beast {
@see CriticalSection, WaitableEvent, Process, ThreadWithProgressWindow,
MessageManagerLock
*/
-class BEAST_API Thread : LeakChecked , public Uncopyable
+class Thread : LeakChecked , public Uncopyable
{
public:
//==============================================================================
@@ -185,7 +185,7 @@ public:
@see setCurrentThreadAffinityMask
*/
- void setAffinityMask (uint32 affinityMask);
+ void setAffinityMask (std::uint32_t affinityMask);
/** Changes the affinity mask for the caller thread.
@@ -193,14 +193,14 @@ public:
@see setAffinityMask
*/
- static void setCurrentThreadAffinityMask (uint32 affinityMask);
+ static void setCurrentThreadAffinityMask (std::uint32_t affinityMask);
//==============================================================================
// this can be called from any thread that needs to pause..
- static void BEAST_CALLTYPE sleep (int milliseconds);
+ static void sleep (int milliseconds);
/** Yields the calling thread's current time-slot. */
- static void BEAST_CALLTYPE yield();
+ static void yield();
//==============================================================================
/** Makes the thread wait for a notification.
@@ -275,11 +275,11 @@ private:
RecursiveMutex startStopLock;
WaitableEvent startSuspensionEvent, defaultEvent;
int threadPriority;
- uint32 affinityMask;
+ std::uint32_t affinityMask;
bool volatile shouldExit;
#ifndef DOXYGEN
- friend void BEAST_API beast_threadEntryPoint (void*);
+ friend void beast_threadEntryPoint (void*);
#endif
void launchThread();
diff --git a/src/beast/beast/threads/impl/Thread.cpp b/src/beast/beast/threads/impl/Thread.cpp
index 34c2b71fca..2aa08401bc 100644
--- a/src/beast/beast/threads/impl/Thread.cpp
+++ b/src/beast/beast/threads/impl/Thread.cpp
@@ -106,7 +106,7 @@ void Thread::threadEntryPoint()
}
// used to wrap the incoming call from the platform-specific code
-void BEAST_API beast_threadEntryPoint (void* userData)
+void beast_threadEntryPoint (void* userData)
{
static_cast (userData)->threadEntryPoint();
}
@@ -162,7 +162,7 @@ bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const
// Doh! So how exactly do you expect this thread to wait for itself to stop??
bassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0);
- const uint32 timeoutEnd = Time::getMillisecondCounter() + (uint32) timeOutMilliseconds;
+ const std::uint32_t timeoutEnd = Time::getMillisecondCounter() + (std::uint32_t) timeOutMilliseconds;
while (isThreadRunning())
{
@@ -252,7 +252,7 @@ bool Thread::setCurrentThreadPriority (const int newPriority)
return setThreadPriority (0, newPriority);
}
-void Thread::setAffinityMask (const uint32 newAffinityMask)
+void Thread::setAffinityMask (const std::uint32_t newAffinityMask)
{
affinityMask = newAffinityMask;
}
@@ -299,7 +299,7 @@ namespace beast {
HWND beast_messageWindowHandle = 0; // (this is used by other parts of the codebase)
-void BEAST_API beast_threadEntryPoint (void*);
+void beast_threadEntryPoint (void*);
static unsigned int __stdcall threadEntryProc (void* userData)
{
@@ -367,7 +367,7 @@ void Thread::setCurrentThreadName (const String& name)
Thread::ThreadID Thread::getCurrentThreadId()
{
- return (ThreadID) (pointer_sized_int) GetCurrentThreadId();
+ return (ThreadID) (std::intptr_t) GetCurrentThreadId();
}
bool Thread::setThreadPriority (void* handle, int priority)
@@ -387,7 +387,7 @@ bool Thread::setThreadPriority (void* handle, int priority)
return SetThreadPriority (handle, pri) != FALSE;
}
-void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
+void Thread::setCurrentThreadAffinityMask (const std::uint32_t affinityMask)
{
SetThreadAffinityMask (GetCurrentThread(), affinityMask);
}
@@ -414,7 +414,7 @@ struct SleepEvent
static SleepEvent sleepEvent;
-void BEAST_CALLTYPE Thread::sleep (const int millisecs)
+void Thread::sleep (const int millisecs)
{
if (millisecs >= 10 || sleepEvent.handle == 0)
{
@@ -458,7 +458,7 @@ namespace beast{
namespace beast {
-void BEAST_CALLTYPE Thread::sleep (int millisecs)
+void Thread::sleep (int millisecs)
{
struct timespec time;
time.tv_sec = millisecs / 1000;
@@ -466,7 +466,7 @@ void BEAST_CALLTYPE Thread::sleep (int millisecs)
nanosleep (&time, nullptr);
}
-void BEAST_API beast_threadEntryPoint (void*);
+void beast_threadEntryPoint (void*);
extern "C" void* threadEntryProcBeast (void*);
extern "C" void* threadEntryProcBeast (void* userData)
@@ -576,7 +576,7 @@ void Thread::yield()
#define SUPPORT_AFFINITIES 1
#endif
-void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask)
+void Thread::setCurrentThreadAffinityMask (const std::uint32_t affinityMask)
{
#if SUPPORT_AFFINITIES
cpu_set_t affinity;
diff --git a/src/beast/beast/threads/tests/Atomic.test.cpp b/src/beast/beast/threads/tests/Atomic.test.cpp
index a348c435c6..f6e7640671 100644
--- a/src/beast/beast/threads/tests/Atomic.test.cpp
+++ b/src/beast/beast/threads/tests/Atomic.test.cpp
@@ -93,9 +93,9 @@ public:
int a2[3];
expect (numElementsInArray(a2) == 3);
- expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211);
- expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211);
- expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211));
+ expect (ByteOrder::swap ((std::uint16_t) 0x1122) == 0x2211);
+ expect (ByteOrder::swap ((std::uint32_t) 0x11223344) == 0x44332211);
+ expect (ByteOrder::swap ((std::uint64_t) 0x1122334455667788LL) == 0x8877665544332211LL);
testcase ("int");
testInteger ();
@@ -103,11 +103,11 @@ public:
testcase ("unsigned int");
testInteger ();
- testcase ("int32");
- testInteger ();
+ testcase ("std::int32_t");
+ testInteger ();
- testcase ("uint32");
- testInteger ();
+ testcase ("std::uint32_t");
+ testInteger ();
testcase ("long");
testInteger ();
@@ -122,11 +122,11 @@ public:
testFloat ();
#if ! BEAST_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms
- testcase ("int64");
- testInteger ();
+ testcase ("std::int64_t");
+ testInteger ();
- testcase ("uint64");
- testInteger ();
+ testcase ("std::uint64_t");
+ testInteger ();
testcase ("double");
testFloat ();
diff --git a/src/beast/beast/threads/tests/ServiceQueue.test.cpp b/src/beast/beast/threads/tests/ServiceQueue.test.cpp
index f079d57421..f90aa649f0 100644
--- a/src/beast/beast/threads/tests/ServiceQueue.test.cpp
+++ b/src/beast/beast/threads/tests/ServiceQueue.test.cpp
@@ -39,11 +39,11 @@ public:
void start () { m_startTime = Time::getHighResolutionTicks (); }
double getElapsed ()
{
- int64 const now = Time::getHighResolutionTicks();
+ std::int64_t const now = Time::getHighResolutionTicks();
return Time::highResolutionTicksToSeconds (now - m_startTime);
}
private:
- int64 m_startTime;
+ std::int64_t m_startTime;
};
static int const callsPerThread = 50000;
@@ -57,7 +57,7 @@ public:
Random m_random;
String m_string;
- Consumer (int id, int64 seedValue, ServiceType& service)
+ Consumer (int id, std::int64_t seedValue, ServiceType& service)
: Thread ("C#" + String::fromNumber (id))
, m_service (service)
, m_random (seedValue)
@@ -103,7 +103,7 @@ public:
Random m_random;
String m_string;
- Producer (int id, int64 seedValue, ServiceType& service)
+ Producer (int id, std::int64_t seedValue, ServiceType& service)
: Thread ("P#" + String::fromNumber (id))
, m_service (service)
, m_random (seedValue)
@@ -208,7 +208,7 @@ public:
ServiceQueue& m_service;
String m_string;
- ServiceThread (int id, int64 seedValue,
+ ServiceThread (int id, std::int64_t seedValue,
ServiceQueue& service)
: Thread ("#" + String::fromNumber (id))
, m_random (seedValue)
diff --git a/src/beast/beast/utility/PropertyStream.h b/src/beast/beast/utility/PropertyStream.h
index 3d0a5bc1ad..480b8db4d8 100644
--- a/src/beast/beast/utility/PropertyStream.h
+++ b/src/beast/beast/utility/PropertyStream.h
@@ -20,7 +20,6 @@
#ifndef BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
#define BEAST_UTILITY_PROPERTYSTREAM_H_INCLUDED
-#include "../CStdInt.h"
#include "../Uncopyable.h"
#include "../intrusive/List.h"
#include "../threads/SharedData.h"
diff --git a/src/beast/beast/utility/StaticObject.h b/src/beast/beast/utility/StaticObject.h
index 30ab11cb9d..15fae2d255 100644
--- a/src/beast/beast/utility/StaticObject.h
+++ b/src/beast/beast/utility/StaticObject.h
@@ -98,7 +98,7 @@ private:
static StaticData& get ()
{
- static uint8 storage [sizeof (StaticData)];
+ static std::uint8_t storage [sizeof (StaticData)];
return *(reinterpret_cast (&storage [0]));
}
diff --git a/src/beast/beast/utility/Utility.cpp b/src/beast/beast/utility/Utility.cpp
index ef14dce0d9..e9b8f16929 100644
--- a/src/beast/beast/utility/Utility.cpp
+++ b/src/beast/beast/utility/Utility.cpp
@@ -23,9 +23,6 @@
#include "impl/Error.cpp"
-// For Journal and Debug
-#include "../../modules/beast_core/beast_core.h"
-
#include "impl/Debug.cpp"
#include "impl/Journal.cpp"
#include "impl/LeakChecked.cpp"
diff --git a/src/beast/beast/utility/impl/Debug.cpp b/src/beast/beast/utility/impl/Debug.cpp
index 8448e1888e..0e27385e32 100644
--- a/src/beast/beast/utility/impl/Debug.cpp
+++ b/src/beast/beast/utility/impl/Debug.cpp
@@ -19,6 +19,7 @@
#include "../Debug.h"
#include "../../unit_test/suite.h"
+#include "../../../modules/beast_core/system/SystemStats.h"
namespace beast {
diff --git a/src/beast/beast/utility/impl/Journal.cpp b/src/beast/beast/utility/impl/Journal.cpp
index 42dd56273a..932ae6b752 100644
--- a/src/beast/beast/utility/impl/Journal.cpp
+++ b/src/beast/beast/utility/impl/Journal.cpp
@@ -18,6 +18,7 @@
//==============================================================================
#include "../Journal.h"
+#include "../../../modules/beast_core/memory/SharedSingleton.h"
namespace beast {
diff --git a/src/beast/beast/utility/impl/LeakChecked.cpp b/src/beast/beast/utility/impl/LeakChecked.cpp
index df261e4908..3ac4e52040 100644
--- a/src/beast/beast/utility/impl/LeakChecked.cpp
+++ b/src/beast/beast/utility/impl/LeakChecked.cpp
@@ -18,6 +18,7 @@
//==============================================================================
#include "../LeakChecked.h"
+#include "../../../modules/beast_core/logging/Logger.h"
namespace beast {
diff --git a/src/beast/modules/beast_asio/basics/FixedInputBuffer.h b/src/beast/modules/beast_asio/basics/FixedInputBuffer.h
index 12346875ee..96dbca2bb3 100644
--- a/src/beast/modules/beast_asio/basics/FixedInputBuffer.h
+++ b/src/beast/modules/beast_asio/basics/FixedInputBuffer.h
@@ -35,13 +35,13 @@ class FixedInputBuffer
protected:
struct CtorParams
{
- CtorParams (uint8 const* begin_, std::size_t bytes_)
+ CtorParams (std::uint8_t const* begin_, std::size_t bytes_)
: begin (begin_)
, bytes (bytes_)
{
}
- uint8 const* begin;
+ std::uint8_t const* begin;
std::size_t bytes;
};
@@ -107,7 +107,7 @@ public:
return read_impl (sizeof (T), t) != nullptr;
}
- uint8 operator[] (std::size_t index) const noexcept
+ std::uint8_t operator[] (std::size_t index) const noexcept
{
bassert (index >= 0 && index < size ());
return m_iter [index];
@@ -153,9 +153,9 @@ protected:
}
private:
- uint8 const* m_begin;
- uint8 const* m_iter;
- uint8 const* m_end;
+ std::uint8_t const* m_begin;
+ std::uint8_t const* m_iter;
+ std::uint8_t const* m_end;
};
//------------------------------------------------------------------------------
@@ -170,7 +170,7 @@ protected:
SizedCtorParams (ConstBufferSequence const& buffers, Storage& storage)
{
boost::asio::mutable_buffer buffer (boost::asio::buffer (storage));
- data = boost::asio::buffer_cast (buffer);
+ data = boost::asio::buffer_cast (buffer);
bytes = boost::asio::buffer_copy (buffer, buffers);
}
@@ -179,7 +179,7 @@ protected:
return CtorParams (data, bytes);
}
- uint8 const* data;
+ std::uint8_t const* data;
std::size_t bytes;
};
@@ -191,7 +191,7 @@ public:
}
private:
- boost::array m_storage;
+ boost::array m_storage;
boost::asio::mutable_buffer m_buffer;
};
diff --git a/src/beast/modules/beast_asio/http/HTTPClientType.cpp b/src/beast/modules/beast_asio/http/HTTPClientType.cpp
index dae2052d5e..454976bf5f 100644
--- a/src/beast/modules/beast_asio/http/HTTPClientType.cpp
+++ b/src/beast/modules/beast_asio/http/HTTPClientType.cpp
@@ -21,6 +21,8 @@
#include "../../../beast/asio/placeholders.h"
#include "../../../beast/unit_test/suite.h"
+#include "../../../beast/cxx14/memory.h" //
+
namespace beast {
namespace asio {
@@ -190,7 +192,7 @@ public:
String m_get_string;
WaitableEvent m_done;
- ScopedPointer m_stream;
+ std::unique_ptr m_stream;
struct State
{
@@ -387,7 +389,8 @@ public:
if (m_url.scheme () == "https")
{
typedef boost::asio::ssl::stream ssl_stream;
- m_stream = new socket_wrapper (m_socket, m_context);
+ m_stream = std::make_unique <
+ socket_wrapper > (m_socket, m_context);
/*
m_stream->set_verify_mode (
boost::asio::ssl::verify_peer |
@@ -399,7 +402,7 @@ public:
return;
}
- m_stream = new socket_wrapper (m_socket);
+ m_stream = std::make_unique > (m_socket);
handle_handshake (ec);
}
@@ -637,7 +640,7 @@ public:
void testSync (String const& s, double timeoutSeconds)
{
- ScopedPointer client (
+ std::unique_ptr client (
HTTPClientBase::New (Journal(), timeoutSeconds));
HTTPClientBase::result_type const& result (
@@ -649,7 +652,7 @@ public:
void testAsync (String const& s, double timeoutSeconds)
{
IoServiceThread t;
- ScopedPointer client (
+ std::unique_ptr client (
HTTPClientBase::New (Journal(), timeoutSeconds));
client->async_get (t.get_io_service (), ParsedURL (s).url (),
diff --git a/src/beast/modules/beast_asio/http/HTTPParser.h b/src/beast/modules/beast_asio/http/HTTPParser.h
index 4295310616..3d559e66a4 100644
--- a/src/beast/modules/beast_asio/http/HTTPParser.h
+++ b/src/beast/modules/beast_asio/http/HTTPParser.h
@@ -79,7 +79,7 @@ public:
protected:
Type m_type;
- ScopedPointer m_impl;
+ std::unique_ptr m_impl;
SharedPtr m_request;
SharedPtr m_response;
};
diff --git a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicPROXY.h b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicPROXY.h
index 43fe59dc41..423a6c5d4f 100644
--- a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicPROXY.h
+++ b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicPROXY.h
@@ -50,8 +50,8 @@ public:
IPv4Address sourceAddress;
IPv4Address destAddress;
- uint16 sourcePort;
- uint16 destPort;
+ std::uint16_t sourcePort;
+ std::uint16_t destPort;
};
explicit HandshakeDetectLogicPROXY (arg_type const&)
diff --git a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL2.h b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL2.h
index 76f18f258d..1419242032 100644
--- a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL2.h
+++ b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL2.h
@@ -27,14 +27,14 @@ namespace asio {
//
// http://tools.ietf.org/html/rfc5246#appendix-E.2
//
-// uint8 V2CipherSpec[3];
+// std::uint8_t V2CipherSpec[3];
// struct {
-// uint16 msg_length;
-// uint8 msg_type;
+// std::uint16_t msg_length;
+// std::uint8_t msg_type;
// Version version; Should be 'ProtocolVersion'?
-// uint16 cipher_spec_length;
-// uint16 session_id_length;
-// uint16 challenge_length;
+// std::uint16_t cipher_spec_length;
+// std::uint16_t session_id_length;
+// std::uint16_t challenge_length;
// ...
//
class HandshakeDetectLogicSSL2 : public HandshakeDetectLogic
@@ -67,7 +67,7 @@ public:
FixedInputBufferSize in (buffer);
{
- uint8 byte;
+ std::uint8_t byte;
if (! in.peek (&byte))
return;
@@ -80,7 +80,7 @@ public:
// The remaining bits contain the
// length of the following data in bytes.
//
- uint16 msg_length;
+ std::uint16_t msg_length;
if (! in.readNetworkInteger(&msg_length))
return;
@@ -95,7 +95,7 @@ public:
if (msg_length < 9)
return fail ();
- uint8 msg_type;
+ std::uint8_t msg_type;
if (! in.read (&msg_type))
return;
diff --git a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL3.h b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL3.h
index 721b2fe163..d77bed1edf 100644
--- a/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL3.h
+++ b/src/beast/modules/beast_asio/protocol/HandshakeDetectLogicSSL3.h
@@ -56,10 +56,10 @@ public:
template
void analyze (ConstBufferSequence const& buffer)
{
- uint16 version;
+ std::uint16_t version;
FixedInputBufferSize in (buffer);
- uint8 msg_type;
+ std::uint8_t msg_type;
if (! in.read (&msg_type))
return;
@@ -72,7 +72,7 @@ public:
return;
version = fromNetworkByteOrder (version);
- uint16 length;
+ std::uint16_t length;
if (! in.read (&length))
return;
diff --git a/src/beast/modules/beast_asio/protocol/InputParser.h b/src/beast/modules/beast_asio/protocol/InputParser.h
index 97962b7ef3..f9314d9880 100644
--- a/src/beast/modules/beast_asio/protocol/InputParser.h
+++ b/src/beast/modules/beast_asio/protocol/InputParser.h
@@ -230,7 +230,7 @@ struct Get
// An unsigned 32 bit number expressed as a string
struct UInt32Str
{
- uint32 value;
+ std::uint32_t value;
};
template <>
@@ -239,7 +239,7 @@ struct Get
static State func (Input in, UInt32Str& t)
{
State state;
- uint32 value (0);
+ std::uint32_t value (0);
Digit digit;
// have to have at least one digit
@@ -266,7 +266,7 @@ struct Get
if (value == 0)
return State::fail;
- uint32 newValue = (value * 10) + digit.value;
+ std::uint32_t newValue = (value * 10) + digit.value;
// overflow
if (newValue < value)
@@ -284,7 +284,7 @@ struct Get
// An unsigned 16 bit number expressed as a string
struct UInt16Str
{
- uint16 value;
+ std::uint16_t value;
};
template <>
@@ -298,7 +298,7 @@ struct Get