mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-05 08:48:03 +00:00
Fix VS2013 warnings about integer conversions
This commit is contained in:
@@ -294,7 +294,7 @@ public:
|
||||
The semantics of this method are the same as malloc() and calloc(), but it
|
||||
uses realloc() to keep as much of the existing data as possible.
|
||||
*/
|
||||
void realloc (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
|
||||
void reallocate (const size_t newNumElements, const size_t elementSize = sizeof (ElementType))
|
||||
{
|
||||
data = static_cast <ElementType*> (data == nullptr ? std::malloc (newNumElements * elementSize)
|
||||
: std::realloc (data, newNumElements * elementSize));
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
/** Frees any currently-allocated data.
|
||||
This will free the data and reset this object to be a null pointer.
|
||||
*/
|
||||
void free()
|
||||
void free_up()
|
||||
{
|
||||
std::free (data);
|
||||
data = nullptr;
|
||||
|
||||
@@ -183,7 +183,8 @@ void SpookyHash::Hash128(
|
||||
remainder = (length - ((const uint8 *)end-(const uint8 *)message));
|
||||
memcpy(buf, end, remainder);
|
||||
memset(((uint8 *)buf)+remainder, 0, sc_blockSize-remainder);
|
||||
((uint8 *)buf)[sc_blockSize-1] = remainder;
|
||||
((uint8 *)buf)[sc_blockSize-1] =
|
||||
static_cast<uint8>(remainder);
|
||||
|
||||
// do some final mixing
|
||||
End(buf, h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
||||
|
||||
@@ -114,10 +114,11 @@ public:
|
||||
}
|
||||
|
||||
/** Build the inverse mapping table from characters to digits. */
|
||||
static std::vector <int> invert (std::string const& alphabet, std::size_t radix)
|
||||
static std::vector <int>
|
||||
invert (std::string const& alphabet, int radix)
|
||||
{
|
||||
std::vector <int> table (256, -1);
|
||||
for (std::size_t i (0); i < radix; ++i)
|
||||
for (int i (0); i < radix; ++i)
|
||||
table [alphabet [i]] = i;
|
||||
return table;
|
||||
}
|
||||
@@ -183,11 +184,12 @@ public:
|
||||
}
|
||||
|
||||
/** Build the inverse mapping table from characters to digits. */
|
||||
static std::vector <int> invert (std::string const& alphabet, std::size_t radix)
|
||||
static std::vector <int>
|
||||
invert (std::string const& alphabet, int radix)
|
||||
{
|
||||
std::vector <int> table (256, -1);
|
||||
for (std::size_t i (0); i < radix; ++i)
|
||||
table [alphabet [i]] = i;
|
||||
for (int i (0); i < radix; ++i)
|
||||
table [alphabet [i]] = int(i);
|
||||
return table;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -430,7 +430,7 @@ private:
|
||||
public:
|
||||
typedef Allocator allocator_type; // for std::uses_allocator<>
|
||||
|
||||
explicit ServiceQueueType (int expectedConcurrency = 1,
|
||||
explicit ServiceQueueType (std::size_t expectedConcurrency = 1,
|
||||
Allocator alloc = Allocator())
|
||||
: m_alloc (alloc)
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename Allocator>
|
||||
void testThreads (std::size_t nConsumers, std::size_t nProducers)
|
||||
void testThreads (int nConsumers, int nProducers)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss <<
|
||||
@@ -147,11 +147,11 @@ public:
|
||||
|
||||
Random r;
|
||||
|
||||
for (std::size_t i = 0; i < nConsumers; ++i)
|
||||
for (int i = 0; i < nConsumers; ++i)
|
||||
consumers.emplace_back (new Consumer <ServiceType> (i + 1,
|
||||
r.nextInt64(), service));
|
||||
|
||||
for (std::size_t i = 0; i < nProducers; ++i)
|
||||
for (int i = 0; i < nProducers; ++i)
|
||||
producers.emplace_back (new Producer <ServiceType> (i + 1,
|
||||
r.nextInt64(), service));
|
||||
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
|
||||
static std::size_t const totalCalls = 10000;
|
||||
|
||||
void testThreads (std::size_t n)
|
||||
void testThreads (int n)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << n << " threads";
|
||||
@@ -270,7 +270,7 @@ public:
|
||||
ServiceQueue service (n);
|
||||
std::vector <std::unique_ptr <ServiceThread> > threads;
|
||||
threads.reserve (n);
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
for (int i = 0; i < n; ++i)
|
||||
threads.emplace_back (new ServiceThread (i + 1,
|
||||
r.nextInt64(), service));
|
||||
for (std::size_t i = n * callsPerThread; i; --i)
|
||||
|
||||
Reference in New Issue
Block a user