Put modules in ripple namespace

This commit is contained in:
Vinnie Falco
2013-06-27 13:41:20 -07:00
parent 8588587b71
commit 638656a597
35 changed files with 198 additions and 234 deletions

View File

@@ -20,6 +20,4 @@
//#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#endif
#define RIPPLE_USE_NAMESPACE 0
#endif

View File

@@ -12,7 +12,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>BOOST_TEST_ALTERNATIVE_INIT_API;BOOST_TEST_NO_MAIN;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<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>

View File

@@ -1593,6 +1593,7 @@
<ClInclude Include="..\..\modules\ripple_basics\containers\ripple_SecureAllocator.h" />
<ClInclude Include="..\..\modules\ripple_basics\containers\ripple_TaggedCache.h" />
<ClInclude Include="..\..\modules\ripple_basics\ripple_basics.h" />
<ClInclude Include="..\..\modules\ripple_basics\system\ripple_BoostIncludes.h" />
<ClInclude Include="..\..\modules\ripple_basics\types\ripple_HashMaps.h" />
<ClInclude Include="..\..\modules\ripple_basics\types\ripple_BasicTypes.h" />
<ClInclude Include="..\..\modules\ripple_basics\types\ripple_UInt256.h" />

View File

@@ -151,6 +151,9 @@
<Filter Include="1. Modules\ripple_app\refactored\misc">
<UniqueIdentifier>{bb14df5d-f96f-4572-9e79-5e330eed30c9}</UniqueIdentifier>
</Filter>
<Filter Include="1. Modules\ripple_basics\system">
<UniqueIdentifier>{2c4e5c32-0aab-4650-b9a1-22708e9ddc92}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\cpp\protobuf_core.cpp">
@@ -1785,6 +1788,9 @@
<ClInclude Include="..\..\modules\ripple_core\functional\ripple_LoadFeeTrack.h">
<Filter>1. Modules\ripple_core\functional</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\ripple_basics\system\ripple_BoostIncludes.h">
<Filter>1. Modules\ripple_basics\system</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\cpp\protobuf\src\google\protobuf\descriptor.proto">

View File

@@ -9,8 +9,6 @@ import os
import platform
import re
LevelDB = bool(1)
OSX = bool(platform.mac_ver()[0])
FreeBSD = bool('FreeBSD' == platform.system())
Linux = bool('Linux' == platform.system())
@@ -162,11 +160,10 @@ env.Append(
)
DEBUGFLAGS = ['-g', '-DDEBUG']
BOOSTFLAGS = ['-DBOOST_TEST_DYN_LINK', '-DBOOST_FILESYSTEM_NO_DEPRECATED']
env.Append(LINKFLAGS = ['-rdynamic', '-pthread'])
env.Append(CCFLAGS = ['-pthread', '-Wall', '-Wno-sign-compare', '-Wno-char-subscripts'])
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+BOOSTFLAGS+DEBUGFLAGS)
env.Append(CXXFLAGS = ['-O0', '-pthread', '-Wno-invalid-offsetof', '-Wformat']+DEBUGFLAGS)
# RTTI is required for Beast and CountedObject.
#

View File

@@ -44,7 +44,6 @@
#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/function.hpp>
@@ -70,12 +69,6 @@
#include <boost/unordered_set.hpp>
#include <boost/weak_ptr.hpp>
#if ! defined (RIPPLE_MAIN_PART) || RIPPLE_MAIN_PART == 1
#include <boost/test/included/unit_test.hpp>
#endif
#include <boost/test/unit_test.hpp>
#include <openssl/buffer.h>
#include <openssl/ec.h>
#include <openssl/evp.h>
@@ -109,10 +102,8 @@
//------------------------------------------------------------------------------
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
// VFALCO NOTE The order of these includes is critical, since they do not
// include their own dependencies. This is what allows us to
@@ -252,16 +243,30 @@ namespace ripple
#include "src/cpp/ripple/WSHandler.h"
#include "src/cpp/ripple/WalletAddTransactor.h"
#if RIPPLE_USE_NAMESPACE
}
#endif
//------------------------------------------------------------------------------
#if RIPPLE_USE_NAMESPACE
// VFALCO TODO Move this to an appropriate header
namespace boost
{
template <>
struct range_mutable_iterator <ripple::LedgerEntrySet>
{
typedef ripple::LedgerEntrySet::iterator type;
};
template <>
struct range_const_iterator <ripple::LedgerEntrySet>
{
typedef ripple::LedgerEntrySet::const_iterator type;
};
}
//------------------------------------------------------------------------------
namespace ripple
{
#endif
//------------------------------------------------------------------------------
@@ -415,9 +420,7 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
//------------------------------------------------------------------------------
#if RIPPLE_USE_NAMESPACE
}
#endif
//------------------------------------------------------------------------------
@@ -435,6 +438,19 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
#include "src/cpp/ripple/ripple_ProofOfWorkFactoryUnitTests.cpp"
#include "src/cpp/ripple/ripple_SerializedTransactionUnitTests.cpp"
//------------------------------------------------------------------------------
namespace ripple
{
extern int rippleMain (int argc, char** argv);
}
// Must be outside the namespace for obvious reasons
int main (int argc, char** argv)
{
return ripple::rippleMain (argc, argv);
}
#endif
//------------------------------------------------------------------------------

View File

@@ -3,10 +3,13 @@
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
BOOST_AUTO_TEST_SUITE (RangeSet_suite)
BOOST_AUTO_TEST_CASE (RangeSet_test)
{
using namespace ripple;
WriteLog (lsTRACE, RangeSet) << "RangeSet test begins";
RangeSet r1, r2;

View File

@@ -34,6 +34,8 @@
#include <boost/asio.hpp> // VFALCO NOTE just for parseIpPort (!)
#include <boost/regex.hpp>
//#include <boost/test/included/unit_test.hpp>
// VFALCO TODO Replace OpenSSL randomness with a dependency-free implementation
// Perhaps Schneier's Fortuna or a variant. Abstract the collection of
// entropy and provide OS-specific implementation. We can re-use the
@@ -50,10 +52,12 @@
#include <Winsock2.h> // for ripple_ByteOrder.cpp
#endif
#if RIPPLE_USE_NAMESPACE
// This brings in the definitions for the Unit Test Framework.
//
#include <boost/test/included/unit_test.hpp>
namespace ripple
{
#endif
#include "containers/ripple_RangeSet.cpp"
#include "containers/ripple_TaggedCache.cpp"
@@ -74,9 +78,7 @@ namespace ripple
#include "types/ripple_UInt256.cpp"
#if RIPPLE_USE_NAMESPACE
}
#endif
// These must be outside the namespace (because of boost)
#include "containers/ripple_RangeSetUnitTests.cpp"

View File

@@ -38,11 +38,12 @@
#error Ripple requires Boost version 1.47 or later
#endif
#include "system/ripple_BoostIncludes.h"
// VFALCO TODO Move all boost includes into ripple_BoostHeaders.h
//
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/function.hpp>
@@ -79,10 +80,8 @@
#include "../ripple_json/ripple_json.h"
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "utility/ripple_IntegerTypes.h" // must come first
#include "utility/ripple_Log.h" // Needed by others
@@ -110,8 +109,6 @@ namespace ripple
#include "containers/ripple_SecureAllocator.h"
#include "containers/ripple_TaggedCache.h"
#if RIPPLE_USE_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
#ifndef RIPPLE_BOOSTINCLUDES_RIPPLEHEADER
#define RIPPLE_BOOSTINCLUDES_RIPPLEHEADER
// All Boost includes used throughout Ripple.
//
// This shows all the dependencies in one place. Please do not add
// boost includes anywhere else in the source code. If possible, do
// not add any more includes.
//
// A long term goal is to reduce and hopefully eliminate the usage of boost.
//
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
//------------------------------------------------------------------------------
// Boost Unit Test Framework
#define BOOST_TEST_NO_LIB
#define BOOST_TEST_ALTERNATIVE_INIT_API
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
#endif

View File

@@ -8,6 +8,8 @@ BOOST_AUTO_TEST_SUITE ( Utils)
BOOST_AUTO_TEST_CASE ( ParseUrl )
{
using namespace ripple;
std::string strScheme;
std::string strDomain;
int iPort;

View File

@@ -7,6 +7,8 @@ BOOST_AUTO_TEST_SUITE (LoadManager_test)
BOOST_AUTO_TEST_CASE (LoadFeeTrack_test)
{
using namespace ripple;
WriteLog (lsDEBUG, LoadManager) << "Running load fee track test";
Config d; // get a default configuration object

View File

@@ -19,10 +19,8 @@
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "functional/ripple_Config.cpp"
#include "functional/ripple_LoadFeeTrack.h" // private
@@ -32,9 +30,7 @@ namespace ripple
#include "functional/ripple_LoadEvent.cpp"
#include "functional/ripple_LoadMonitor.cpp"
#if RIPPLE_USE_NAMESPACE
}
#endif
// These must be outside the namespace

View File

@@ -32,10 +32,8 @@
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp>
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
// VFALCO NOTE Indentation shows dependency hierarchy
//
@@ -46,8 +44,6 @@ namespace ripple
/*.*/#include "functional/ripple_Job.h"
/**/#include "functional/ripple_JobQueue.h"
#if RIPPLE_USE_NAMESPACE
}
#endif
#endif

View File

@@ -7,6 +7,8 @@ BOOST_AUTO_TEST_SUITE (DeterministicKeys_test)
BOOST_AUTO_TEST_CASE (DeterminsticKeys_test1)
{
using namespace ripple;
Log (lsDEBUG) << "Beginning deterministic key test";
uint128 seed1, seed2;

View File

@@ -7,6 +7,8 @@ BOOST_AUTO_TEST_SUITE (ripple_address)
BOOST_AUTO_TEST_CASE ( check_crypto )
{
using namespace ripple;
// Construct a seed.
RippleAddress naSeed;

View File

@@ -5,6 +5,9 @@
//==============================================================================
// For unit tests:
namespace ripple
{
static STAmount serdes (const STAmount& s)
{
Serializer ser;
@@ -16,12 +19,75 @@ static STAmount serdes (const STAmount& s)
return STAmount::deserialize (sit);
}
static bool roundTest (int n, int d, int m)
{
// check STAmount rounding
STAmount num (CURRENCY_ONE, ACCOUNT_ONE, n);
STAmount den (CURRENCY_ONE, ACCOUNT_ONE, d);
STAmount mul (CURRENCY_ONE, ACCOUNT_ONE, m);
STAmount quot = STAmount::divide (n, d, CURRENCY_ONE, ACCOUNT_ONE);
STAmount res = STAmount::multiply (quot, mul, CURRENCY_ONE, ACCOUNT_ONE);
if (res.isNative ())
BOOST_FAIL ("Product is native");
res.roundSelf ();
STAmount cmp (CURRENCY_ONE, ACCOUNT_ONE, (n * m) / d);
if (cmp.isNative ())
BOOST_FAIL ("Comparison amount is native");
if (res == cmp)
return true;
cmp.throwComparable (res);
WriteLog (lsWARNING, STAmount) << "(" << num.getText () << "/" << den.getText () << ") X " << mul.getText () << " = "
<< res.getText () << " not " << cmp.getText ();
BOOST_FAIL ("Round fail");
return false;
}
static void mulTest (int a, int b)
{
STAmount aa (CURRENCY_ONE, ACCOUNT_ONE, a);
STAmount bb (CURRENCY_ONE, ACCOUNT_ONE, b);
STAmount prod1 (STAmount::multiply (aa, bb, CURRENCY_ONE, ACCOUNT_ONE));
if (prod1.isNative ())
BOOST_FAIL ("product is native");
STAmount prod2 (CURRENCY_ONE, ACCOUNT_ONE, static_cast<uint64> (a) * static_cast<uint64> (b));
if (prod1 != prod2)
{
WriteLog (lsWARNING, STAmount) << "nn(" << aa.getFullText () << " * " << bb.getFullText () << ") = " << prod1.getFullText ()
<< " not " << prod2.getFullText ();
BOOST_WARN ("Multiplication result is not exact");
}
aa = a;
prod1 = STAmount::multiply (aa, bb, CURRENCY_ONE, ACCOUNT_ONE);
if (prod1 != prod2)
{
WriteLog (lsWARNING, STAmount) << "n(" << aa.getFullText () << " * " << bb.getFullText () << ") = " << prod1.getFullText ()
<< " not " << prod2.getFullText ();
BOOST_WARN ("Multiplication result is not exact");
}
}
}
//------------------------------------------------------------------------------
BOOST_AUTO_TEST_SUITE (amount)
BOOST_AUTO_TEST_CASE ( setValue_test )
{
using namespace ripple;
STAmount saTmp;
#if 0
@@ -45,6 +111,8 @@ BOOST_AUTO_TEST_CASE ( setValue_test )
BOOST_AUTO_TEST_CASE ( NativeCurrency_test )
{
using namespace ripple;
STAmount zero, one (1), hundred (100);
if (serdes (zero) != zero) BOOST_FAIL ("STAmount fail");
@@ -184,6 +252,8 @@ BOOST_AUTO_TEST_CASE ( NativeCurrency_test )
BOOST_AUTO_TEST_CASE ( CustomCurrency_test )
{
using namespace ripple;
STAmount zero (CURRENCY_ONE, ACCOUNT_ONE), one (CURRENCY_ONE, ACCOUNT_ONE, 1), hundred (CURRENCY_ONE, ACCOUNT_ONE, 100);
serdes (one).getRaw ();
@@ -364,67 +434,10 @@ BOOST_AUTO_TEST_CASE ( CustomCurrency_test )
//------------------------------------------------------------------------------
static bool roundTest (int n, int d, int m)
{
// check STAmount rounding
STAmount num (CURRENCY_ONE, ACCOUNT_ONE, n);
STAmount den (CURRENCY_ONE, ACCOUNT_ONE, d);
STAmount mul (CURRENCY_ONE, ACCOUNT_ONE, m);
STAmount quot = STAmount::divide (n, d, CURRENCY_ONE, ACCOUNT_ONE);
STAmount res = STAmount::multiply (quot, mul, CURRENCY_ONE, ACCOUNT_ONE);
if (res.isNative ())
BOOST_FAIL ("Product is native");
res.roundSelf ();
STAmount cmp (CURRENCY_ONE, ACCOUNT_ONE, (n * m) / d);
if (cmp.isNative ())
BOOST_FAIL ("Comparison amount is native");
if (res == cmp)
return true;
cmp.throwComparable (res);
WriteLog (lsWARNING, STAmount) << "(" << num.getText () << "/" << den.getText () << ") X " << mul.getText () << " = "
<< res.getText () << " not " << cmp.getText ();
BOOST_FAIL ("Round fail");
return false;
}
static void mulTest (int a, int b)
{
STAmount aa (CURRENCY_ONE, ACCOUNT_ONE, a);
STAmount bb (CURRENCY_ONE, ACCOUNT_ONE, b);
STAmount prod1 (STAmount::multiply (aa, bb, CURRENCY_ONE, ACCOUNT_ONE));
if (prod1.isNative ())
BOOST_FAIL ("product is native");
STAmount prod2 (CURRENCY_ONE, ACCOUNT_ONE, static_cast<uint64> (a) * static_cast<uint64> (b));
if (prod1 != prod2)
{
WriteLog (lsWARNING, STAmount) << "nn(" << aa.getFullText () << " * " << bb.getFullText () << ") = " << prod1.getFullText ()
<< " not " << prod2.getFullText ();
BOOST_WARN ("Multiplication result is not exact");
}
aa = a;
prod1 = STAmount::multiply (aa, bb, CURRENCY_ONE, ACCOUNT_ONE);
if (prod1 != prod2)
{
WriteLog (lsWARNING, STAmount) << "n(" << aa.getFullText () << " * " << bb.getFullText () << ") = " << prod1.getFullText ()
<< " not " << prod2.getFullText ();
BOOST_WARN ("Multiplication result is not exact");
}
}
BOOST_AUTO_TEST_CASE ( CurrencyMulDivTests )
{
using namespace ripple;
CBigNum b;
for (int i = 0; i < 16; ++i)
@@ -483,6 +496,8 @@ BOOST_AUTO_TEST_CASE ( CurrencyMulDivTests )
BOOST_AUTO_TEST_CASE ( UnderFlowTests )
{
using namespace ripple;
STAmount bigNative (STAmount::cMaxNative / 2);
STAmount bigValue (CURRENCY_ONE, ACCOUNT_ONE,
(STAmount::cMinValue + STAmount::cMaxValue) / 2, STAmount::cMaxOffset - 1);
@@ -536,6 +551,8 @@ BOOST_AUTO_TEST_SUITE (amountRound)
BOOST_AUTO_TEST_CASE ( amountRound_test )
{
using namespace ripple;
uint64 value = 25000000000000000ull;
int offset = -14;
STAmount::canonicalizeRound (false, value, offset, true);

View File

@@ -8,6 +8,8 @@ BOOST_AUTO_TEST_SUITE (SerializedObject)
BOOST_AUTO_TEST_CASE ( FieldManipulation_test )
{
using namespace ripple;
if (sfGeneric.isUseful ())
BOOST_FAIL ("sfGeneric must not be useful");

View File

@@ -8,6 +8,8 @@ BOOST_AUTO_TEST_SUITE (Serializer_suite)
BOOST_AUTO_TEST_CASE ( Serializer_PrefixHash_test )
{
using namespace ripple;
Serializer s1;
s1.add32 (3);
s1.add256 (uint256 ());

View File

@@ -54,10 +54,8 @@
#undef min
#endif
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "crypto/ripple_Base58.h" // for RippleAddress
#include "crypto/ripple_CKey.h" // needs RippleAddress VFALCO TODO remove this dependency cycle
@@ -93,9 +91,7 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
#include "utility/ripple_JSONCache.cpp"
#if RIPPLE_USE_NAMESPACE
}
#endif
// These must be outside the namespace because of boost
#include "crypto/ripple_CKeyDeterministicUnitTests.cpp"

View File

@@ -52,10 +52,8 @@
// additional hierarchy via directories.
#include "ripple.pb.h"
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "crypto/ripple_CBigNum.h"
#include "crypto/ripple_Base58.h" // VFALCO TODO Can be moved to .cpp if we clean up setAlphabet stuff
@@ -80,11 +78,8 @@ namespace ripple
#include "utility/ripple_JSONCache.h"
#include "utility/ripple_UptimeTimerAdapter.h"
#if RIPPLE_USE_NAMESPACE
}
#endif
#if RIPPLE_USE_NAMESPACE
namespace boost
{
template <>
@@ -135,57 +130,5 @@ namespace boost
typedef ripple::STArray::const_iterator type;
};
}
#else
namespace boost
{
template <>
struct range_mutable_iterator <STPath>
{
typedef std::vector <STPathElement>::iterator type;
};
template <>
struct range_const_iterator <STPath>
{
typedef std::vector <STPathElement>::const_iterator type;
};
template <>
struct range_mutable_iterator <STPathSet>
{
typedef std::vector <STPath>::iterator type;
};
template <>
struct range_const_iterator <STPathSet>
{
typedef std::vector <STPath>::const_iterator type;
};
template <>
struct range_mutable_iterator <STObject>
{
typedef STObject::iterator type;
};
template <>
struct range_const_iterator <STObject>
{
typedef STObject::const_iterator type;
};
template <>
struct range_mutable_iterator <STArray>
{
typedef STArray::iterator type;
};
template <>
struct range_const_iterator <STArray>
{
typedef STArray::const_iterator type;
};
}
#endif
#endif

View File

@@ -30,15 +30,11 @@
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "json/json_reader.cpp"
#include "json/json_value.cpp"
#include "json/json_writer.cpp"
#if RIPPLE_USE_NAMESPACE
}
#endif

View File

@@ -25,6 +25,8 @@
#include <string>
#include <vector>
#include "BeastConfig.h"
#include "json/json_config.h" // Needed before these cpptl includes
#ifndef JSON_USE_CPPTL_SMALLMAP
@@ -37,10 +39,8 @@
# include <cpptl/forwards.h>
#endif
#if RIPPLE_USE_NAMESPACE
namespace ripple
{
#endif
#include "json/json_forwards.h"
#include "json/json_features.h"
@@ -48,8 +48,6 @@ namespace ripple
#include "json/json_reader.h"
#include "json/json_writer.h"
#if RIPPLE_USE_NAMESPACE
}
#endif
#endif

View File

@@ -4,8 +4,4 @@
*/
//==============================================================================
#if RIPPLE_USE_NAMESPACE
ripple::LogPartition AutoSocket::AutoSocketPartition ("AutoSocket");
#else
LogPartition AutoSocket::AutoSocketPartition ("AutoSocket");
#endif

View File

@@ -73,9 +73,7 @@ public:
static bool rfc2818_verify (const std::string& domain, bool preverified, boost::asio::ssl::verify_context& ctx)
{
#if RIPPLE_USE_NAMESPACE
using namespace ripple;
#endif
if (boost::asio::ssl::rfc2818_verification (domain) (preverified, ctx))
return true;
@@ -228,9 +226,7 @@ public:
protected:
void handle_autodetect (callback cbFunc, const error_code& ec, size_t bytesTransferred)
{
#if RIPPLE_USE_NAMESPACE
using namespace ripple;
#endif
if (ec)
{
@@ -261,11 +257,7 @@ protected:
}
private:
#if RIPPLE_USE_NAMESPACE
static ripple::LogPartition AutoSocketPartition;
#else
static LogPartition AutoSocketPartition;
#endif
socket_ptr mSocket;
bool mSecure;

View File

@@ -12,7 +12,6 @@ namespace websocketpp
namespace log
{
#if RIPPLE_USE_NAMESPACE
using namespace ripple;
LogPartition websocketPartition ("WebSocket");
@@ -48,37 +47,6 @@ void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
if (websocketPartition.doLog (s))
Log (s, websocketPartition) << entry;
}
#else
LogPartition websocketPartition ("WebSocket");
void websocketLog (websocketpp::log::alevel::value v, const std::string& entry)
{
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
{
if (websocketPartition.doLog (lsTRACE))
Log (lsDEBUG, websocketPartition) << entry;
}
else if (websocketPartition.doLog (lsDEBUG))
Log (lsDEBUG, websocketPartition) << entry;
}
void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
{
LogSeverity s = lsDEBUG;
if ((v & websocketpp::log::elevel::INFO) != 0)
s = lsINFO;
else if ((v & websocketpp::log::elevel::FATAL) != 0)
s = lsFATAL;
else if ((v & websocketpp::log::elevel::RERROR) != 0)
s = lsERROR;
else if ((v & websocketpp::log::elevel::WARN) != 0)
s = lsWARNING;
if (websocketPartition.doLog (s))
Log (s, websocketPartition) << entry;
}
#endif
}
}

View File

@@ -8,6 +8,8 @@ BOOST_AUTO_TEST_SUITE (quality)
BOOST_AUTO_TEST_CASE ( getquality )
{
using namespace ripple;
uint256 uBig ("D2DC44E5DC189318DB36EF87D2104CDF0A0FE3A4B698BEEE55038D7EA4C68000");
if (6125895493223874560 != Ledger::getQuality (uBig))

View File

@@ -119,7 +119,7 @@ void printHelp (const po::options_description& desc)
// cerr << " trust_set <seed> <paying_account> <destination_account> <limit_amount> <currency> [<quality_in>] [<quality_out>]" << endl;
}
int main (int argc, char* argv[])
int rippleMain (int argc, char** argv)
{
setCallingThreadName ("main");
int iResult = 0;

View File

@@ -267,17 +267,5 @@ inline LedgerEntrySet::iterator range_end (LedgerEntrySet& x)
{
return x.end ();
}
namespace boost
{
template<> struct range_mutable_iterator<LedgerEntrySet>
{
typedef LedgerEntrySet::iterator type;
};
template<> struct range_const_iterator<LedgerEntrySet>
{
typedef LedgerEntrySet::const_iterator type;
};
}
#endif
// vim:ts=4

View File

@@ -10,8 +10,6 @@
// A pathfinding request submitted by a client
// The request issuer must maintain a strong pointer
class InfoSub;
class STAmount;
class RippleLineCache;
// Return values from parseJson <0 = invalid, >0 = valid

View File

@@ -8,6 +8,8 @@ BOOST_AUTO_TEST_SUITE (ProofOfWork_suite)
BOOST_AUTO_TEST_CASE ( ProofOfWork_test )
{
using namespace ripple;
ProofOfWorkFactory gen;
ProofOfWork pow = gen.getProof ();
WriteLog (lsINFO, ProofOfWork) << "Estimated difficulty: " << pow.getDifficulty ();

View File

@@ -8,6 +8,9 @@
#define SMS_DEBUG
#endif
namespace ripple
{
static SHAMapItem::pointer makeRandomAS ()
{
Serializer s;
@@ -55,10 +58,14 @@ static bool confuseMap (SHAMap& map, int count)
return true;
}
}
BOOST_AUTO_TEST_SUITE ( SHAMapSync )
BOOST_AUTO_TEST_CASE ( SHAMapSync_test )
{
using namespace ripple;
WriteLog (lsTRACE, SHAMap) << "begin sync test";
unsigned int seed;
RAND_pseudo_bytes (reinterpret_cast<unsigned char*> (&seed), sizeof (seed));

View File

@@ -6,20 +6,25 @@
// VFALCO TODO Rename this to createFilledVector and pass an unsigned char, tidy up
//
static Blob IntToVUC (int v)
namespace ripple
{
Blob vuc;
static Blob IntToVUC (int v)
{
Blob vuc;
for (int i = 0; i < 32; ++i)
vuc.push_back (static_cast<unsigned char> (v));
for (int i = 0; i < 32; ++i)
vuc.push_back (static_cast<unsigned char> (v));
return vuc;
return vuc;
}
}
BOOST_AUTO_TEST_SUITE (SHAMap_suite)
BOOST_AUTO_TEST_CASE ( SHAMap_test )
{
using namespace ripple;
// h3 and h4 differ only in the leaf, same terminal node (level 19)
WriteLog (lsTRACE, SHAMap) << "SHAMap test";
uint256 h1, h2, h3, h4, h5;

View File

@@ -7,6 +7,8 @@ BOOST_AUTO_TEST_SUITE (SerializedTransactionTS)
BOOST_AUTO_TEST_CASE ( STrans_test )
{
using namespace ripple;
RippleAddress seed;
seed.setSeedRandom ();
RippleAddress generator = RippleAddress::createGeneratorPublic (seed);

View File

@@ -7,9 +7,6 @@
#ifndef RIPPLE_SQLITEDATABASE_RIPPLEHEADER
#define RIPPLE_SQLITEDATABASE_RIPPLEHEADER
struct sqlite3;
struct sqlite3_stmt;
class SqliteDatabase : public Database
{
public: