mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Use beast for bind, placeholders, and function
This commit is contained in:
@@ -22,9 +22,15 @@
|
|||||||
|
|
||||||
// beast_basics flags
|
// beast_basics flags
|
||||||
|
|
||||||
#ifndef BEAST_USE_BOOST
|
#define BEAST_USE_BOOST 1
|
||||||
#define BEAST_USE_BOOST 0
|
|
||||||
#endif
|
// We bind functions that take references, which is
|
||||||
|
// unsupported on some platforms
|
||||||
|
//
|
||||||
|
// VFALCO TODO Rewrite functions to use pointers instead
|
||||||
|
// of references so we can get off boost::bind
|
||||||
|
//
|
||||||
|
//#define BEAST_BIND_USES_BOOST 1
|
||||||
|
|
||||||
#ifndef BEAST_USE_LEAKCHECKED
|
#ifndef BEAST_USE_LEAKCHECKED
|
||||||
#define BEAST_USE_LEAKCHECKED BEAST_CHECK_MEMORY_LEAKS
|
#define BEAST_USE_LEAKCHECKED BEAST_CHECK_MEMORY_LEAKS
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_VARIADIC_MAX=8;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees;$(RepoDir)\Subtrees\leveldb;$(RepoDir)\Subtrees\leveldb\include;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees;$(RepoDir)\Subtrees\leveldb;$(RepoDir)\Subtrees\leveldb\include;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
|||||||
3
TODO.txt
3
TODO.txt
@@ -27,6 +27,9 @@ TODO
|
|||||||
- lift beast into the ripple namespace, remove ripple's duplicated integer types
|
- lift beast into the ripple namespace, remove ripple's duplicated integer types
|
||||||
- lift unique_ptr / auto_ptr into ripple namespace, or replace with ScopedPointer
|
- lift unique_ptr / auto_ptr into ripple namespace, or replace with ScopedPointer
|
||||||
|
|
||||||
|
- Rewrite functions passed to bind to not take reference parameters, so we can
|
||||||
|
used std::bind instead of boost.
|
||||||
|
|
||||||
- Make LevelDB and Ripple code work with both Unicode and non-Unicode Windows APIs
|
- Make LevelDB and Ripple code work with both Unicode and non-Unicode Windows APIs
|
||||||
|
|
||||||
- Raise the warning level and fix everything
|
- Raise the warning level and fix everything
|
||||||
|
|||||||
@@ -7,36 +7,30 @@
|
|||||||
#ifndef RIPPLE_PLATFORMMACROS_H
|
#ifndef RIPPLE_PLATFORMMACROS_H
|
||||||
#define RIPPLE_PLATFORMMACROS_H
|
#define RIPPLE_PLATFORMMACROS_H
|
||||||
|
|
||||||
|
#define FUNCTION_TYPE beast::function
|
||||||
|
#define BIND_TYPE beast::bind
|
||||||
|
#define P_1 beast::_1
|
||||||
|
#define P_2 beast::_2
|
||||||
|
#define P_3 beast::_3
|
||||||
|
#define P_4 beast::_4
|
||||||
|
|
||||||
// VFALCO TODO Clean this up
|
// VFALCO TODO Clean this up
|
||||||
|
|
||||||
#if (!defined(FORCE_NO_C11X) && (__cplusplus > 201100L)) || defined(FORCE_C11X)
|
#if (!defined(FORCE_NO_C11X) && (__cplusplus > 201100L)) || defined(FORCE_C11X)
|
||||||
|
|
||||||
// VFALCO TODO replace BIND_TYPE with a namespace lift
|
// VFALCO TODO Get rid of the C11X macro
|
||||||
|
|
||||||
#define C11X
|
#define C11X
|
||||||
#define UPTR_T std::unique_ptr
|
#define UPTR_T std::unique_ptr
|
||||||
#define MOVE_P(p) std::move(p)
|
#define MOVE_P(p) std::move(p)
|
||||||
#define BIND_TYPE std::bind
|
|
||||||
#define FUNCTION_TYPE std::function
|
|
||||||
#define P_1 std::placeholders::_1
|
|
||||||
#define P_2 std::placeholders::_2
|
|
||||||
#define P_3 std::placeholders::_3
|
|
||||||
#define P_4 std::placeholders::_4
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define UPTR_T std::auto_ptr
|
#define UPTR_T std::auto_ptr
|
||||||
#define MOVE_P(p) (p)
|
#define MOVE_P(p) (p)
|
||||||
#define BIND_TYPE boost::bind
|
|
||||||
#define FUNCTION_TYPE boost::function
|
|
||||||
#define P_1 _1
|
|
||||||
#define P_2 _2
|
|
||||||
#define P_3 _3
|
|
||||||
#define P_4 _4
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VFALCO TODO Clean this junk up
|
// VFALCO TODO Clean this stuff up. Remove as much as possible
|
||||||
#define nothing() do {} while (0)
|
#define nothing() do {} while (0)
|
||||||
#define fallthru() do {} while (0)
|
#define fallthru() do {} while (0)
|
||||||
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
|
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ class JobQueue
|
|||||||
public:
|
public:
|
||||||
explicit JobQueue (boost::asio::io_service&);
|
explicit JobQueue (boost::asio::io_service&);
|
||||||
|
|
||||||
|
// VFALCO TODO make convenience functions that allow the caller to not
|
||||||
|
// have to call bind.
|
||||||
|
//
|
||||||
void addJob (JobType type, const std::string& name, const FUNCTION_TYPE<void (Job&)>& job);
|
void addJob (JobType type, const std::string& name, const FUNCTION_TYPE<void (Job&)>& job);
|
||||||
|
|
||||||
int getJobCount (JobType t); // Jobs waiting at this priority
|
int getJobCount (JobType t); // Jobs waiting at this priority
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ extern void callRPC (
|
|||||||
const std::string& strUsername, const std::string& strPassword,
|
const std::string& strUsername, const std::string& strPassword,
|
||||||
const std::string& strPath, const std::string& strMethod,
|
const std::string& strPath, const std::string& strMethod,
|
||||||
const Json::Value& jvParams, const bool bSSL,
|
const Json::Value& jvParams, const bool bSSL,
|
||||||
FUNCTION_TYPE<void (const Json::Value& jvInput)> callbackFuncP = 0);
|
FUNCTION_TYPE<void (const Json::Value& jvInput)> callbackFuncP = FUNCTION_TYPE<void (const Json::Value& jvInput)> ());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
@@ -1285,6 +1285,10 @@ void PeerImp::recvHaveTxSet (protocol::TMHaveTransactionSet& packet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
|
|
||||||
|
// VFALCO TODO There should be no use of memcpy() throughout the program.
|
||||||
|
// TODO Clean up this magic number
|
||||||
|
//
|
||||||
memcpy (hash.begin (), packet.hash ().data (), 32);
|
memcpy (hash.begin (), packet.hash ().data (), 32);
|
||||||
|
|
||||||
if (packet.status () == protocol::tsHAVE)
|
if (packet.status () == protocol::tsHAVE)
|
||||||
|
|||||||
Reference in New Issue
Block a user