Merge pull request #1763 from mpilman/fixes/windows-dlopen

Fixed two silly compilation bugs
This commit is contained in:
A.J. Beamon 2019-06-27 12:37:58 -07:00 committed by GitHub
commit a0f0badf0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View File

@ -350,7 +350,11 @@ struct SimpleWorkload : FDBWorkload {
template <class Vec>
double accumulateMetric(const Vec& v) const {
return std::accumulate(v.begin(), v.end(), 0.0) / double(v.size());
double res = 0.0;
for (auto val : v) {
res += val;
}
return res / double(v.size());
}
void getMetrics(std::vector<FDBPerfMetric>& out) const override {

View File

@ -270,8 +270,8 @@ struct JVM {
char* name = charArrays.back();
charArrays.push_back(new char[sigStr.size() + 1]);
char* sig = charArrays.back();
memcpy(name, nameStr.begin(), nameStr.size());
memcpy(sig, sigStr.begin(), sigStr.size());
memcpy(name, nameStr.data(), nameStr.size());
memcpy(sig, sigStr.data(), sigStr.size());
name[nameStr.size()] = '\0';
sig[sigStr.size()] = '\0';
w.name = name;

View File

@ -123,7 +123,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext {
return format("lib%s.so", name.c_str());
#elif defined(__APPLE__)
return format("lib%s.dylib", name.c_str());
#elif defined(__WIN32__)
#elif defined(_WIN32)
return format("lib%s.dll", name.c_str());
#else
#error Port me!

View File

@ -2696,7 +2696,7 @@ void closeLibrary(void* handle) {
#ifdef __unixish__
dlclose(handle);
#else
FreeLibrary(handle);
FreeLibrary(reinterpret_cast<HMODULE>(handle));
#endif
}
@ -2725,7 +2725,7 @@ std::string exePath() {
DWORD bufSize = 1024;
std::unique_ptr<char[]> buf(new char[bufSize]);
while (true) {
auto s = GetModuleFileName(nullptr, buffer.get(), bufSize);
auto s = GetModuleFileName(nullptr, buf.get(), bufSize);
if (s >= 0) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
bufSize *= 2;