Module: check_mk
Branch: master
Commit: aa0ff9887b1979c04217299dc59679e1535860af
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=aa0ff9887b1979…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 16 15:30:11 2013 +0100
Windows agent: fix code indentation
---
agents/windows/check_mk_agent.cc | 75 +++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 38 deletions(-)
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index adeda0f..34cafea 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -1067,7 +1067,6 @@ bool output_eventlog_entry(SOCKET &out, char *dllpath,
EVENTLOGRECORD *event, ch
dwFlags |= FORMAT_MESSAGE_FROM_HMODULE;
DWORD len = FormatMessageW(
- // DWORD len = FormatMessage(
dwFlags,
dll,
event->EventID,
@@ -1075,46 +1074,46 @@ bool output_eventlog_entry(SOCKET &out, char *dllpath,
EVENTLOGRECORD *event, ch
wmsgbuffer,
// msgbuffer,
2048,
- (char **)strings);
+ (char **)strings
+ );
- if (dll)
- FreeLibrary(dll);
+ if (dll)
+ FreeLibrary(dll);
- if (len)
- {
- // convert message to UTF-8
- len = WideCharToMultiByte(CP_UTF8, 0, wmsgbuffer, -1, msgbuffer,
sizeof(msgbuffer), NULL, NULL);
- }
+ if (len) {
+ // convert message to UTF-8
+ len = WideCharToMultiByte(CP_UTF8, 0, wmsgbuffer, -1, msgbuffer,
sizeof(msgbuffer), NULL, NULL);
+ }
- if (len == 0) // message could not be converted
- {
- // if conversion was not successfull while trying to load a DLL, we
return a
- // failure. Our parent function will then retry later without a DLL
path.
- if (dllpath)
- return false;
-
- // if message cannot be converted, then at least output the text
strings.
- // We render all messages one after the other into msgbuffer, separated
- // by spaces.
- memset(msgbuffer, 0, sizeof(msgbuffer)); // avoids problems with
0-termination
- char *w = msgbuffer;
- int sizeleft = sizeof(msgbuffer) - 1; // leave one byte for termination
- int n = 0;
- while (strings[n]) // string array is zero terminated
- {
- WCHAR *s = strings[n];
- DWORD len = WideCharToMultiByte(CP_UTF8, 0, s, -1, w, sizeleft, NULL,
NULL);
- if (!len)
- break;
- sizeleft -= len;
- w += len;
- if (sizeleft <= 0)
- break;
- n++;
- if (strings[n])
- *w++ = ' ';
- }
- }
+ if (len == 0) // message could not be converted
+ {
+ // if conversion was not successfull while trying to load a DLL, we return a
+ // failure. Our parent function will then retry later without a DLL path.
+ if (dllpath)
+ return false;
+
+ // if message cannot be converted, then at least output the text strings.
+ // We render all messages one after the other into msgbuffer, separated
+ // by spaces.
+ memset(msgbuffer, 0, sizeof(msgbuffer)); // avoids problems with 0-termination
+ char *w = msgbuffer;
+ int sizeleft = sizeof(msgbuffer) - 1; // leave one byte for termination
+ int n = 0;
+ while (strings[n]) // string array is zero terminated
+ {
+ WCHAR *s = strings[n];
+ DWORD len = WideCharToMultiByte(CP_UTF8, 0, s, -1, w, sizeleft, NULL, NULL);
+ if (!len)
+ break;
+ sizeleft -= len;
+ w += len;
+ if (sizeleft <= 0)
+ break;
+ n++;
+ if (strings[n])
+ *w++ = ' ';
+ }
+ }
// replace newlines with spaces. check_mk expects one message each line.
char *w = msgbuffer;