mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-20 21:43:00 +08:00
Merge pull request #1086 from mpilman/features/c++-compiler-errors
Fixed several minor code issues
This commit is contained in:
commit
ec32d3308b
fdbclient
fdbserver
fdbservice
flow
@ -63,7 +63,7 @@ void parse( std::vector<RegionInfo>* regions, ValueRef const& v ) {
|
||||
RegionInfo info;
|
||||
json_spirit::mArray datacenters;
|
||||
dc.get("datacenters", datacenters);
|
||||
bool nonSatelliteDatacenters = 0;
|
||||
int nonSatelliteDatacenters = 0;
|
||||
for (StatusObjectReader s : datacenters) {
|
||||
std::string idStr;
|
||||
if (s.has("satellite") && s.last().get_int() == 1) {
|
||||
|
@ -1014,7 +1014,7 @@ namespace oldTLog {
|
||||
state Reference<LogData> logData;
|
||||
|
||||
loop {
|
||||
bool foundCount = 0;
|
||||
int foundCount = 0;
|
||||
for(auto it : self->id_data) {
|
||||
if(!it.second->stopped) {
|
||||
logData = it.second;
|
||||
@ -1023,7 +1023,7 @@ namespace oldTLog {
|
||||
}
|
||||
|
||||
ASSERT(foundCount < 2);
|
||||
if(!foundCount) {
|
||||
if(foundCount == 0) {
|
||||
wait( self->newLogData.onTrigger() );
|
||||
continue;
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ static inline int commonPrefixLength(uint8_t const* ap, uint8_t const* bp, int c
|
||||
const int wordEnd = cl - sizeof(Word) + 1;
|
||||
|
||||
for(; i < wordEnd; i += sizeof(Word)) {
|
||||
register Word a = *(Word *)ap;
|
||||
register Word b = *(Word *)bp;
|
||||
Word a = *(Word *)ap;
|
||||
Word b = *(Word *)bp;
|
||||
if(a != b) {
|
||||
return i + ctzll(a ^ b) / 8;
|
||||
}
|
||||
@ -238,14 +238,14 @@ struct PrefixTree {
|
||||
|
||||
void init(const Node *n) {
|
||||
node = n;
|
||||
register union {
|
||||
union {
|
||||
const uint8_t *p8;
|
||||
const uint16_t *p16;
|
||||
};
|
||||
p8 = (const uint8_t *)&n->flags + 1;
|
||||
|
||||
register int flags = n->flags;
|
||||
register bool large = flags & USE_LARGE_LENGTHS;
|
||||
int flags = n->flags;
|
||||
bool large = flags & USE_LARGE_LENGTHS;
|
||||
|
||||
prefixLen = large ? *p16++ : *p8++;
|
||||
|
||||
@ -265,7 +265,7 @@ struct PrefixTree {
|
||||
if(flags & HAS_VALUE)
|
||||
rightPos += (large ? *p16++ : *p8++);
|
||||
|
||||
register int header = 2; // flags byte, first prefix len byte
|
||||
int header = 2; // flags byte, first prefix len byte
|
||||
if(large)
|
||||
++header; // second prefix len byte
|
||||
if(flags & HAS_SPLIT)
|
||||
|
@ -394,7 +394,7 @@ void sendResult( ReplyPromise<T>& reply, Optional<ErrorOr<T>> const& result ) {
|
||||
}
|
||||
|
||||
ACTOR Future<Void> runWorkloadAsync( Database cx, WorkloadInterface workIface, TestWorkload *workload, double databasePingDelay ) {
|
||||
state auto_ptr<TestWorkload> delw(workload);
|
||||
state unique_ptr<TestWorkload> delw(workload);
|
||||
state Optional<ErrorOr<Void>> setupResult;
|
||||
state Optional<ErrorOr<Void>> startResult;
|
||||
state Optional<ErrorOr<bool>> checkResult;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
T *object, ULONG flags = WT_EXECUTELONGFUNCTION)
|
||||
{
|
||||
typedef std::pair<void (T::*)(), T *> CallbackType;
|
||||
std::auto_ptr<CallbackType> p(new CallbackType(function, object));
|
||||
std::unique_ptr<CallbackType> p(new CallbackType(function, object));
|
||||
|
||||
if (::QueueUserWorkItem(ThreadProc<T>, p.get(), flags))
|
||||
{
|
||||
@ -72,9 +72,9 @@ private:
|
||||
{
|
||||
typedef std::pair<void (T::*)(), T *> CallbackType;
|
||||
|
||||
std::auto_ptr<CallbackType> p(static_cast<CallbackType *>(context));
|
||||
std::unique_ptr<CallbackType> p(static_cast<CallbackType *>(context));
|
||||
|
||||
(p->second->*p->first)();
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
10
flow/Deque.h
10
flow/Deque.h
@ -103,11 +103,13 @@ public:
|
||||
end++;
|
||||
}
|
||||
|
||||
template<class U>
|
||||
void emplace_back(U && val) {
|
||||
template<class... U>
|
||||
reference emplace_back(U&&... val) {
|
||||
if (full()) grow();
|
||||
new (&arr[end&mask]) T(std::forward<U>(val));
|
||||
new (&arr[end&mask]) T(std::forward<U>(val)...);
|
||||
reference result = arr[end & mask];
|
||||
end++;
|
||||
return result;
|
||||
}
|
||||
|
||||
void pop_back() {
|
||||
@ -181,4 +183,4 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <deque>
|
||||
#include <random>
|
||||
#include "flow/UnitTest.h"
|
||||
|
||||
template <class Node>
|
||||
@ -383,11 +384,12 @@ TEST_CASE("/flow/IndexedSet/comparison to std::set") {
|
||||
|
||||
TEST_CASE("/flow/IndexedSet/all numbers") {
|
||||
IndexedSet<int, int64_t> is;
|
||||
std::mt19937_64 urng(g_random->randomUInt32());
|
||||
|
||||
std::vector<int> allNumbers;
|
||||
for (int i = 0; i<1000000; i++)
|
||||
allNumbers.push_back(i);
|
||||
std::random_shuffle(allNumbers.begin(), allNumbers.end());
|
||||
std::shuffle(allNumbers.begin(), allNumbers.end(), urng);
|
||||
|
||||
for (int i = 0; i<allNumbers.size(); i++)
|
||||
is.insert(allNumbers[i], allNumbers[i]);
|
||||
@ -426,4 +428,4 @@ TEST_CASE("/flow/IndexedSet/all numbers") {
|
||||
return Void();
|
||||
}
|
||||
|
||||
void forceLinkIndexedSetTests() {}
|
||||
void forceLinkIndexedSetTests() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user