mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Replace std::vector<unsigned char> with Blob
This commit is contained in:
@@ -134,6 +134,7 @@ namespace boost {
|
||||
#include "containers/ripple_SecureAllocator.h"
|
||||
#include "containers/ripple_TaggedCache.h"
|
||||
|
||||
#include "types/ripple_Types.h"
|
||||
#include "utility/ripple_ByteOrder.h"
|
||||
#include "utility/ripple_DiffieHellmanUtil.h"
|
||||
#include "utility/ripple_InstanceCounter.h"
|
||||
|
||||
13
modules/ripple_basics/types/ripple_Types.h
Normal file
13
modules/ripple_basics/types/ripple_Types.h
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef RIPPLE_TYPES_H
|
||||
#define RIPPLE_TYPES_H
|
||||
|
||||
/** Storage for linear binary data.
|
||||
|
||||
Blocks of binary data appear often in various idioms and structures.
|
||||
*/
|
||||
typedef std::vector <unsigned char> Blob;
|
||||
|
||||
#endif
|
||||
@@ -415,7 +415,7 @@ public:
|
||||
pn[i] = b.pn[i];
|
||||
}
|
||||
|
||||
explicit uint128(const std::vector<unsigned char>& vch)
|
||||
explicit uint128(Blob const& vch)
|
||||
{
|
||||
if (vch.size() == size())
|
||||
memcpy(pn, &vch[0], size());
|
||||
@@ -472,7 +472,7 @@ public:
|
||||
SetHex(str);
|
||||
}
|
||||
|
||||
explicit uint256(const std::vector<unsigned char>& vch)
|
||||
explicit uint256(Blob const& vch)
|
||||
{
|
||||
if (vch.size() == sizeof(pn))
|
||||
memcpy(pn, &vch[0], sizeof(pn));
|
||||
@@ -689,7 +689,7 @@ public:
|
||||
SetHex(str);
|
||||
}
|
||||
|
||||
explicit uint160(const std::vector<unsigned char>& vch)
|
||||
explicit uint160(Blob const& vch)
|
||||
{
|
||||
if (vch.size() == sizeof(pn))
|
||||
memcpy(pn, &vch[0], sizeof(pn));
|
||||
|
||||
@@ -51,7 +51,7 @@ inline uint256 SHA256Hash(const T1 p1begin, const T1 p1end,
|
||||
return hash2;
|
||||
}
|
||||
|
||||
inline uint160 Hash160(const std::vector<unsigned char>& vch)
|
||||
inline uint160 Hash160(Blob const& vch)
|
||||
{
|
||||
uint256 hash1;
|
||||
SHA256(&vch[0], vch.size(), (unsigned char*)&hash1);
|
||||
|
||||
@@ -90,7 +90,7 @@ int strUnHex(std::string& strDst, const std::string& strSrc)
|
||||
return iBytes;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> strUnHex(const std::string& strSrc)
|
||||
Blob strUnHex(const std::string& strSrc)
|
||||
{
|
||||
std::string strTmp;
|
||||
|
||||
@@ -113,9 +113,9 @@ uint64_t uintFromHex(const std::string& strSrc)
|
||||
// Misc string
|
||||
//
|
||||
|
||||
std::vector<unsigned char> strCopy(const std::string& strSrc)
|
||||
Blob strCopy(const std::string& strSrc)
|
||||
{
|
||||
std::vector<unsigned char> vucDst;
|
||||
Blob vucDst;
|
||||
|
||||
vucDst.resize(strSrc.size());
|
||||
|
||||
@@ -124,7 +124,7 @@ std::vector<unsigned char> strCopy(const std::string& strSrc)
|
||||
return vucDst;
|
||||
}
|
||||
|
||||
std::string strCopy(const std::vector<unsigned char>& vucSrc)
|
||||
std::string strCopy(Blob const& vucSrc)
|
||||
{
|
||||
std::string strDst;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ inline const std::string strHex(const std::string& strSrc)
|
||||
return strHex(strSrc.begin(), strSrc.size());
|
||||
}
|
||||
|
||||
inline std::string strHex(const std::vector<unsigned char>& vucData)
|
||||
inline std::string strHex(Blob const& vucData)
|
||||
{
|
||||
return strHex(vucData.begin(), vucData.size());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ inline static std::string sqlEscape(const std::string& strSrc)
|
||||
return str(boost::format(f) % strHex(strSrc));
|
||||
}
|
||||
|
||||
inline static std::string sqlEscape(const std::vector<unsigned char>& vecSrc)
|
||||
inline static std::string sqlEscape(Blob const& vecSrc)
|
||||
{
|
||||
size_t size = vecSrc.size();
|
||||
if (size == 0)
|
||||
@@ -156,10 +156,10 @@ int strUnHex(std::string& strDst, const std::string& strSrc);
|
||||
|
||||
uint64_t uintFromHex(const std::string& strSrc);
|
||||
|
||||
std::vector<unsigned char> strUnHex(const std::string& strSrc);
|
||||
Blob strUnHex(const std::string& strSrc);
|
||||
|
||||
std::vector<unsigned char> strCopy(const std::string& strSrc);
|
||||
std::string strCopy(const std::vector<unsigned char>& vucSrc);
|
||||
Blob strCopy(const std::string& strSrc);
|
||||
std::string strCopy(Blob const& vucSrc);
|
||||
|
||||
bool parseIpPort(const std::string& strSource, std::string& strIP, int& iPort);
|
||||
bool parseQuality(const std::string& strSource, uint32& uQuality);
|
||||
|
||||
Reference in New Issue
Block a user