summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-11-29 15:30:09 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-11-29 15:30:09 +0000
commitfe076d92eca402b27979bacf4062563e759e7279 (patch)
treeacca86039c851dd4a85240c195f0e759787aecbe /plugins
parent425e0f8eb79c6779ebe40f75cce92194ed103389 (diff)
-Fixed a bug in Ping and other small things reported in #837
git-svn-id: http://svn.miranda-ng.org/main/trunk@11151 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp16
-rw-r--r--plugins/Ping/src/rawping.cpp33
2 files changed, 28 insertions, 21 deletions
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index d623f56707..5b176c7a3f 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -1176,20 +1176,15 @@ static void BTN_ReadItem(char *itemName, char *file)
void IMG_LoadItems()
{
- char *szSections = NULL;
- char *p;
DBVARIANT dbv;
- char szFileName[MAX_PATH];
- TCHAR tszFileName[MAX_PATH];
- int i = 0;
-
if (cfg::getTString(NULL, "CLC", "AdvancedSkin", &dbv))
return;
+ TCHAR tszFileName[MAX_PATH];
MY_pathToAbsolute(dbv.ptszVal, tszFileName);
// TODO: rewrite the skin loading in TCHAR manner
-
+ char szFileName[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, tszFileName, MAX_PATH, szFileName, MAX_PATH, 0, 0);
db_free(&dbv);
@@ -1197,15 +1192,16 @@ void IMG_LoadItems()
if (!PathFileExists(tszFileName))
return;
+ int i = 0;
+
IMG_DeleteItems();
- szSections = reinterpret_cast<char *>(malloc(3002));
+ char *szSections = reinterpret_cast<char *>(malloc(3002));
ZeroMemory(szSections, 3002);
- p = szSections;
GetPrivateProfileSectionNamesA(szSections, 3000, szFileName);
szSections[3001] = szSections[3000] = 0;
- p = szSections;
+ char *p = szSections;
while (lstrlenA(p) > 1) {
if (p[0] == '$' || p[0] == '@')
IMG_ReadItem(p, szFileName);
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp
index 007200fa23..f31868db5a 100644
--- a/plugins/Ping/src/rawping.cpp
+++ b/plugins/Ping/src/rawping.cpp
@@ -149,38 +149,48 @@ extern int raw_ping(char *host, int timeout)
if (bread == SOCKET_ERROR) {
if(WSAGetLastError() != WSAETIMEDOUT) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: socket error...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: socket error...cycling"), 0);
}
continue;
}
- if(reply_header->proto != ICMP_PROTO)
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: packet not ICMP...cycling"), 0);
+ if(reply_header->proto != ICMP_PROTO) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: packet not ICMP...cycling"), 0);
continue;
+ }
- if(reply_header->tos != 0)
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: TOS not 0...cycling"), 0);
+ if(reply_header->tos != 0) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: TOS not 0...cycling"), 0);
continue;
+ }
reply = (ICMPHeader *)(recv_buff + reply_header->h_len * 4);
if((unsigned)bread < reply_header->h_len * 4 + sizeof(ICMPHeader)) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: short header"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: short header"), 0);
continue;
}
- if(reply->id != (USHORT)GetCurrentProcessId())
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong ID...cycling"), 0);
+ if(reply->id != (USHORT)GetCurrentProcessId()) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong ID...cycling"), 0);
continue;
+ }
if(reply->type != PT_ICMP_ECHO_REPLY && reply->type != PT_ICMP_SOURCE_QUENCH) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong type...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong type...cycling"), 0);
continue;
}
//if(reply->seq < seq_no) continue;
//if(reply->seq > seq_no) return -1;
if(reply->seq != seq_no) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong sequence number...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong sequence number...cycling"), 0);
continue;
}
@@ -197,7 +207,8 @@ extern int raw_ping(char *host, int timeout)
} else
return current_time - send_time;
}
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: timeout"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: timeout"), 0);
return -1;
}