diff --git a/src/analyzers/analyzerbase.cpp b/src/analyzers/analyzerbase.cpp index d23a3fd75..523c063f1 100644 --- a/src/analyzers/analyzerbase.cpp +++ b/src/analyzers/analyzerbase.cpp @@ -16,13 +16,15 @@ ***************************************************************************/ #include "analyzerbase.h" -#include "engines/enginebase.h" + #include //interpolate() + #include //event() #include #include #include +#include "engines/enginebase.h" // INSTRUCTIONS Base2D // 1. do anything that depends on height() in init(), Base2D will call it before you are shown diff --git a/src/devices/wmdmlister.cpp b/src/devices/wmdmlister.cpp index 0a0ef849e..412be383a 100644 --- a/src/devices/wmdmlister.cpp +++ b/src/devices/wmdmlister.cpp @@ -143,14 +143,6 @@ void WmdmLister::ShutDown() { metaObject()->invokeMethod(this, "ReallyShutdown", Qt::BlockingQueuedConnection); } -template -qint64 GetSpaceValue(F f) { - DWORD low, high; - f(&low, &high); - - return (qint64)high << 32 | (qint64)low; -} - WmdmLister::DeviceInfo WmdmLister::ReadDeviceInfo(IWMDMDevice2* device) { qLog(Debug) << "Reading device info"; @@ -424,13 +416,28 @@ void WmdmLister::DoUpdateDriveFreeSpace(const QString& id) { emit DeviceChanged(id); } +namespace { +qint64 GetSpaceValue( + IWMDMStorageGlobals* globals, + LONG (IWMDMStorageGlobals::*f)(DWORD*,DWORD*)) { + DWORD low, high; + ((globals)->*(f))(&low, &high); + + return (qint64)high << 32 | (qint64)low; +} +} + void WmdmLister::UpdateFreeSpace(DeviceInfo* info) { IWMDMStorageGlobals* globals; info->storage_->GetStorageGlobals(&globals); - info->total_bytes_ = GetSpaceValue(boost::bind(&IWMDMStorageGlobals::GetTotalSize, globals, _1, _2)); - info->free_bytes_ = GetSpaceValue(boost::bind(&IWMDMStorageGlobals::GetTotalFree, globals, _1, _2)); - info->free_bytes_ -= GetSpaceValue(boost::bind(&IWMDMStorageGlobals::GetTotalBad, globals, _1, _2)); + DWORD low, high; + + globals->GetTotalSize(&low, &high); + info->total_bytes_ = (qint64)high << 32 | (qint64)low; + + globals->GetTotalFree(&low, &high); + info->free_bytes_ = (qint64)high << 32 | (qint64)low; globals->Release(); } diff --git a/src/engines/enginebase.h b/src/engines/enginebase.h index 2faee25d2..4d6402959 100644 --- a/src/engines/enginebase.h +++ b/src/engines/enginebase.h @@ -22,14 +22,17 @@ #ifndef AMAROK_ENGINEBASE_H #define AMAROK_ENGINEBASE_H -#include -#include -#include - +#include #include + #include + #include +#include +#include +#include + #include "engine_fwd.h" namespace Engine {