Merge pull request #1763 from mpilman/fixes/windows-dlopen
Fixed two silly compilation bugs
This commit is contained in:
commit
a0f0badf0b
|
@ -350,7 +350,11 @@ struct SimpleWorkload : FDBWorkload {
|
||||||
|
|
||||||
template <class Vec>
|
template <class Vec>
|
||||||
double accumulateMetric(const Vec& v) const {
|
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 {
|
void getMetrics(std::vector<FDBPerfMetric>& out) const override {
|
||||||
|
|
|
@ -270,8 +270,8 @@ struct JVM {
|
||||||
char* name = charArrays.back();
|
char* name = charArrays.back();
|
||||||
charArrays.push_back(new char[sigStr.size() + 1]);
|
charArrays.push_back(new char[sigStr.size() + 1]);
|
||||||
char* sig = charArrays.back();
|
char* sig = charArrays.back();
|
||||||
memcpy(name, nameStr.begin(), nameStr.size());
|
memcpy(name, nameStr.data(), nameStr.size());
|
||||||
memcpy(sig, sigStr.begin(), sigStr.size());
|
memcpy(sig, sigStr.data(), sigStr.size());
|
||||||
name[nameStr.size()] = '\0';
|
name[nameStr.size()] = '\0';
|
||||||
sig[sigStr.size()] = '\0';
|
sig[sigStr.size()] = '\0';
|
||||||
w.name = name;
|
w.name = name;
|
||||||
|
|
|
@ -123,7 +123,7 @@ struct ExternalWorkload : TestWorkload, FDBWorkloadContext {
|
||||||
return format("lib%s.so", name.c_str());
|
return format("lib%s.so", name.c_str());
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
return format("lib%s.dylib", name.c_str());
|
return format("lib%s.dylib", name.c_str());
|
||||||
#elif defined(__WIN32__)
|
#elif defined(_WIN32)
|
||||||
return format("lib%s.dll", name.c_str());
|
return format("lib%s.dll", name.c_str());
|
||||||
#else
|
#else
|
||||||
#error Port me!
|
#error Port me!
|
||||||
|
|
|
@ -2696,7 +2696,7 @@ void closeLibrary(void* handle) {
|
||||||
#ifdef __unixish__
|
#ifdef __unixish__
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
#else
|
#else
|
||||||
FreeLibrary(handle);
|
FreeLibrary(reinterpret_cast<HMODULE>(handle));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2725,7 +2725,7 @@ std::string exePath() {
|
||||||
DWORD bufSize = 1024;
|
DWORD bufSize = 1024;
|
||||||
std::unique_ptr<char[]> buf(new char[bufSize]);
|
std::unique_ptr<char[]> buf(new char[bufSize]);
|
||||||
while (true) {
|
while (true) {
|
||||||
auto s = GetModuleFileName(nullptr, buffer.get(), bufSize);
|
auto s = GetModuleFileName(nullptr, buf.get(), bufSize);
|
||||||
if (s >= 0) {
|
if (s >= 0) {
|
||||||
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
|
||||||
bufSize *= 2;
|
bufSize *= 2;
|
||||||
|
|
Loading…
Reference in New Issue