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>
|
||||
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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue