1
0
Fork 0

fixes for Visual Studio

This commit is contained in:
jsteemann 2016-12-08 17:32:46 +01:00
parent 6920bb65f1
commit 350da367bd
4 changed files with 8 additions and 10 deletions

View File

@ -462,7 +462,7 @@ void Supervision::run() {
}
}
}
_cv.wait(1000000 * _frequency);
_cv.wait(static_cast<uint64_t>(1000000 * _frequency));
}
}
if (shutdown) {

View File

@ -135,7 +135,7 @@ int EnumerateCollectionBlock::initialize() {
inSync = std::find(followers.begin(), followers.end(), ServerState::instance()->getId()) != followers.end();
if (!inSync) {
if (endTime - now < waitInterval) {
waitInterval = endTime - now;
waitInterval = static_cast<unsigned long>(endTime - now);
}
usleep(waitInterval);
}

View File

@ -2733,7 +2733,7 @@ static void JS_DecodeRev(v8::FunctionCallbackInfo<v8::Value> const& args) {
#endif
char buffer[32];
strftime(buffer, 32, "%Y-%m-%dT%H:%M:%S.000Z", &date);
buffer[20] = (millis / 100) + '0';
buffer[20] = static_cast<char>(millis / 100) + '0';
buffer[21] = ((millis / 10) % 10) + '0';
buffer[22] = (millis % 10) + '0';
buffer[24] = 0;
@ -2742,7 +2742,7 @@ static void JS_DecodeRev(v8::FunctionCallbackInfo<v8::Value> const& args) {
result->Set(TRI_V8_ASCII_STRING("date"),
TRI_V8_ASCII_STRING(buffer));
result->Set(TRI_V8_ASCII_STRING("count"),
v8::Number::New(isolate, count));
v8::Number::New(isolate, static_cast<double>(count)));
TRI_V8_RETURN(result);

View File

@ -24,6 +24,8 @@
*/
#include "fasthash.h"
static constexpr uint64_t m = 0x880355f21e6d1965ULL;
// Compression function for Merkle-Damgard construction.
// This function is generated using the framework provided.
@ -37,9 +39,7 @@ static inline uint64_t mix(uint64_t h) {
}
uint64_t fasthash64_uint64(uint64_t value, uint64_t seed) {
size_t const len = sizeof(uint64_t);
uint64_t const m = 0x880355f21e6d1965ULL;
uint64_t h = seed ^ (len * m);
uint64_t h = seed ^ 4619197404915747624ULL; // this is h = seed ^ (sizeof(uint64_t) * m), but prevents VS warning C4307: integral constant overflow
h ^= mix(value);
h *= m;
@ -51,7 +51,6 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
// byte-wise hashing to support platforms that don't permit
// unaligned accesses of uint64_t values (which is the default
// memory access strategy of fasthash64)
uint64_t const m = 0x880355f21e6d1965ULL;
uint8_t const* pos = (uint8_t const*)buf;
uint8_t const* end = pos + len;
uint64_t h = seed ^ (len * m);
@ -92,7 +91,6 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
// uint64_t-wise hashing for platforms that allow dereferencing
// unaligned pointers to uint64_t memory
// this is the original version of fasthash64
uint64_t const m = 0x880355f21e6d1965ULL;
uint64_t const* pos = (uint64_t const*)buf;
uint64_t const* end = pos + (len / 8);
const unsigned char* pos2;
@ -104,7 +102,7 @@ uint64_t fasthash64(const void* buf, size_t len, uint64_t seed) {
h ^= mix(v);
h *= m;
}
pos2 = (const unsigned char*)pos;
v = 0;