This commit is contained in:
Birunthan Mohanathas 2012-10-02 21:27:59 +03:00
parent 93c1cf0411
commit 554dae1e09

View File

@ -139,16 +139,21 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
if (g_hClient == NULL) return; if (g_hClient == NULL) return;
MeasureData* measure = (MeasureData*)data; MeasureData* measure = (MeasureData*)data;
WCHAR buffer[256]; WCHAR buffer[128];
bool changed = false; bool changed = false;
int value = 0;
auto logValueError = [&](const WCHAR* option)
{
_snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: %s=%i not valid", option, value);
RmLog(LOG_ERROR, buffer);
};
// Select a WLAN interface, default 0. // Select a WLAN interface, default 0.
int value = RmReadInt(rm, L"WifiIntfID", 0); int value = RmReadInt(rm, L"WifiIntfID", 0);
if (value >= (int)g_pIntfList->dwNumberOfItems) if (value >= (int)g_pIntfList->dwNumberOfItems)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: Adapter (WifiIntfID=%i) not valid.", value); logValueError(L"WifiIntfID");
RmLog(LOG_ERROR, buffer);
value = 0; value = 0;
} }
g_pInterface = &g_pIntfList->InterfaceInfo[value]; g_pInterface = &g_pIntfList->InterfaceInfo[value];
@ -157,9 +162,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
value = RmReadInt(rm, L"WifiListStyle", 0); value = RmReadInt(rm, L"WifiListStyle", 0);
if (value < 0 || value > 3) if (value < 0 || value > 3)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: WifiListStyle=%i not valid.", value); logValueError(L"WifiListStyle");
RmLog(LOG_WARNING, buffer);
value = 0; value = 0;
} }
measure->listStyle = value; measure->listStyle = value;
@ -168,9 +171,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
value = RmReadInt(rm, L"WifiListLimit", 5); value = RmReadInt(rm, L"WifiListLimit", 5);
if (value <= 0) if (value <= 0)
{ {
_snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: WifiListLimit=%i not valid.", data); logValueError(L"WifiListLimit");
RmLog(LOG_WARNING, buffer);
value = 5; value = 5;
} }
measure->listMax = value; measure->listMax = value;
@ -204,7 +205,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
} }
else else
{ {
_snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: WifiInfoType=%s not valid.", type); _snwprintf_s(buffer, _TRUNCATE, L"WifiStatus.dll: WifiInfoType=%s not valid", type);
RmLog(LOG_ERROR, buffer); RmLog(LOG_ERROR, buffer);
} }
if (infoType != measure->type) if (infoType != measure->type)