Merge pull request #5893 from Icinga/fix/whitespace

Whitespace fix
This commit is contained in:
Jean Flach 2017-12-20 15:02:30 +01:00 committed by GitHub
commit 9b75548b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
314 changed files with 2968 additions and 2984 deletions

View File

@ -194,16 +194,13 @@ namespace Icinga
string master_host, master_port; string master_host, master_port;
GetMasterHostPort(out master_host, out master_port); GetMasterHostPort(out master_host, out master_port);
args += " --master_host " + master_host args += " --master_host " + master_host + "," + master_port;
+ "," + master_port;
foreach (ListViewItem lvi in lvwEndpoints.Items) { foreach (ListViewItem lvi in lvwEndpoints.Items) {
args += " --endpoint " + lvi.SubItems[0].Text.Trim(); args += " --endpoint " + lvi.SubItems[0].Text.Trim();
if (lvi.SubItems.Count > 1) { if (lvi.SubItems.Count > 1)
args += "," + lvi.SubItems[1].Text.Trim() args += "," + lvi.SubItems[1].Text.Trim() + "," + lvi.SubItems[2].Text.Trim();
+ "," + lvi.SubItems[2].Text.Trim();
}
} }
}); });

View File

@ -179,11 +179,9 @@ protected:
private: private:
static Application::Ptr m_Instance; /**< The application instance. */ static Application::Ptr m_Instance; /**< The application instance. */
static bool m_ShuttingDown; /**< Whether the application is in the process of static bool m_ShuttingDown; /**< Whether the application is in the process of shutting down. */
shutting down. */
static bool m_RequestRestart; /**< A restart was requested through SIGHUP */ static bool m_RequestRestart; /**< A restart was requested through SIGHUP */
static pid_t m_ReloadProcess; /**< The PID of a subprocess doing a reload, static pid_t m_ReloadProcess; /**< The PID of a subprocess doing a reload, only valid when l_Restarting==true */
only valid when l_Restarting==true */
static bool m_RequestReopenLogs; /**< Whether we should re-open log files. */ static bool m_RequestReopenLogs; /**< Whether we should re-open log files. */
static int m_ArgC; /**< The number of command-line arguments. */ static int m_ArgC; /**< The number of command-line arguments. */

View File

@ -89,8 +89,7 @@ private:
public: public:
template <typename FuncType, int Arity> template <typename FuncType, int Arity>
auto operator() (FuncType f, const std::vector<Value>& args) auto operator() (FuncType f, const std::vector<Value>& args) -> decltype(Invoke(f, args, BuildIndices<Arity>{}))
-> decltype(Invoke(f, args, BuildIndices<Arity>{}))
{ {
return Invoke(f, args, BuildIndices<Arity>{}); return Invoke(f, args, BuildIndices<Arity>{});
} }

View File

@ -143,9 +143,7 @@ void StackTrace::Print(std::ostream& fp, int ignoreFrames) const
# endif /* HAVE_BACKTRACE_SYMBOLS */ # endif /* HAVE_BACKTRACE_SYMBOLS */
#else /* _WIN32 */ #else /* _WIN32 */
for (int i = ignoreFrames + 1; i < m_Count; i++) { for (int i = ignoreFrames + 1; i < m_Count; i++) {
fp << "\t(" << i - ignoreFrames - 1 << "): " fp << "\t(" << i - ignoreFrames - 1 << "): " << Utility::GetSymbolName(m_Frames[i]) << std::endl;
<< Utility::GetSymbolName(m_Frames[i])
<< std::endl;
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
} }

View File

@ -50,7 +50,8 @@ typedef int SOCKET;
#ifndef SUN_LEN #ifndef SUN_LEN
/* TODO: Ideally this should take into the account how /* TODO: Ideally this should take into the account how
long the socket path really is. */ * long the socket path really is.
*/
# define SUN_LEN(sun) (sizeof(sockaddr_un)) # define SUN_LEN(sun) (sizeof(sockaddr_un))
#endif /* SUN_LEN */ #endif /* SUN_LEN */

View File

@ -773,7 +773,8 @@ void Utility::RemoveDirRecursive(const String& path)
Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, std::ref(paths)), GlobFile | GlobDirectory); Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, std::ref(paths)), GlobFile | GlobDirectory);
/* This relies on the fact that GlobRecursive lists the parent directory /* This relies on the fact that GlobRecursive lists the parent directory
first before recursing into subdirectories. */ * first before recursing into subdirectories.
*/
std::reverse(paths.begin(), paths.end()); std::reverse(paths.begin(), paths.end());
for (const String& path : paths) { for (const String& path : paths) {
@ -1801,12 +1802,13 @@ String Utility::CreateTempFile(const String& path, int mode, std::fstream& fp)
#ifdef _WIN32 #ifdef _WIN32
/* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright /* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright
(C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc. * (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
*
The GNU C Library is free software; you can redistribute it and/or * The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. */ * version 2.1 of the License, or (at your option) any later version.
*/
#define _O_EXCL 0x0400 #define _O_EXCL 0x0400
#define _O_CREAT 0x0100 #define _O_CREAT 0x0100
@ -1818,9 +1820,10 @@ String Utility::CreateTempFile(const String& path, int mode, std::fstream& fp)
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must match the /* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed * rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
does not exist at the time of the call to mkstemp. TMPL is * does not exist at the time of the call to mkstemp. TMPL is
overwritten with the result. */ * overwritten with the result.
*/
int Utility::MksTemp(char *tmpl) int Utility::MksTemp(char *tmpl)
{ {
int len; int len;
@ -1832,15 +1835,17 @@ int Utility::MksTemp(char *tmpl)
int save_errno = errno; int save_errno = errno;
/* A lower bound on the number of temporary files to attempt to /* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that * generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be * can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable * necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to * number of names is tried (we define reasonable as 62**3) fail to
give the system administrator the chance to remove the problems. */ * give the system administrator the chance to remove the problems.
*/
#define ATTEMPTS_MIN (62 * 62 * 62) #define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To /* The number of times to attempt to generate a temporary file
conform to POSIX, this must be no smaller than TMP_MAX. */ * To conform to POSIX, this must be no smaller than TMP_MAX.
*/
#if ATTEMPTS_MIN < TMP_MAX #if ATTEMPTS_MIN < TMP_MAX
unsigned int attempts = TMP_MAX; unsigned int attempts = TMP_MAX;
#else #else

View File

@ -272,8 +272,7 @@ void WorkQueue::WorkerThreadProc(void)
m_ExceptionCallback(boost::current_exception()); m_ExceptionCallback(boost::current_exception());
} }
/* clear the task so whatever other resources it holds are released /* clear the task so whatever other resources it holds are released _before_ we re-acquire the mutex */
_before_ we re-acquire the mutex */
task = Task(); task = Task();
IncreaseTaskCount(); IncreaseTaskCount();

View File

@ -74,8 +74,7 @@ public:
static bool ParseCommand(int argc, char **argv, boost::program_options::options_description& visibleDesc, static bool ParseCommand(int argc, char **argv, boost::program_options::options_description& visibleDesc,
boost::program_options::options_description& hiddenDesc, boost::program_options::options_description& hiddenDesc,
boost::program_options::positional_options_description& positionalDesc, boost::program_options::positional_options_description& positionalDesc,
boost::program_options::variables_map& vm, String& cmdname, boost::program_options::variables_map& vm, String& cmdname, CLICommand::Ptr& command, bool autocomplete);
CLICommand::Ptr& command, bool autocomplete);
static void ShowCommands(int argc, char **argv, static void ShowCommands(int argc, char **argv,
boost::program_options::options_description *visibleDesc = nullptr, boost::program_options::options_description *visibleDesc = nullptr,

View File

@ -144,8 +144,7 @@ void StatusDataWriter::DumpTimePeriod(std::ostream& fp, const TimePeriod::Ptr& t
} }
} }
fp << "\t" "}" "\n" fp << "\t" "}" "\n" "\n";
"\n";
} }
void StatusDataWriter::DumpCommand(std::ostream& fp, const Command::Ptr& command) void StatusDataWriter::DumpCommand(std::ostream& fp, const Command::Ptr& command)
@ -161,8 +160,7 @@ void StatusDataWriter::DumpCommand(std::ostream& fp, const Command::Ptr& command
DumpCustomAttributes(fp, command); DumpCustomAttributes(fp, command);
fp << "\n" "\t" "}" "\n" fp << "\n" "\t" "}" "\n" "\n";
"\n";
} }
void StatusDataWriter::DumpDowntimes(std::ostream& fp, const Checkable::Ptr& checkable) void StatusDataWriter::DumpDowntimes(std::ostream& fp, const Checkable::Ptr& checkable)
@ -205,8 +203,7 @@ void StatusDataWriter::DumpDowntimes(std::ostream& fp, const Checkable::Ptr& che
void StatusDataWriter::DumpHostStatus(std::ostream& fp, const Host::Ptr& host) void StatusDataWriter::DumpHostStatus(std::ostream& fp, const Host::Ptr& host)
{ {
fp << "hoststatus {" << "\n" fp << "hoststatus {" "\n" "\t" "host_name=" << host->GetName() << "\n";
<< "\t" << "host_name=" << host->GetName() << "\n";
{ {
ObjectLock olock(host); ObjectLock olock(host);
@ -218,8 +215,7 @@ void StatusDataWriter::DumpHostStatus(std::ostream& fp, const Host::Ptr& host)
"\t" "last_time_down=" << host->GetLastStateDown() << "\n" "\t" "last_time_down=" << host->GetLastStateDown() << "\n"
"\t" "last_time_unreachable=" << host->GetLastStateUnreachable() << "\n"; "\t" "last_time_unreachable=" << host->GetLastStateUnreachable() << "\n";
fp << "\t" "}" "\n" fp << "\t" "}" "\n" "\n";
"\n";
DumpDowntimes(fp, host); DumpDowntimes(fp, host);
DumpComments(fp, host); DumpComments(fp, host);
@ -327,8 +323,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
DumpCustomAttributes(fp, host); DumpCustomAttributes(fp, host);
fp << "\t" "}" "\n" fp << "\t" "}" "\n" "\n";
"\n";
} }
void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkable::Ptr& checkable) void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkable::Ptr& checkable)
@ -415,8 +410,7 @@ void StatusDataWriter::DumpServiceStatus(std::ostream& fp, const Service::Ptr& s
DumpCheckableStatusAttrs(fp, service); DumpCheckableStatusAttrs(fp, service);
} }
fp << "\t" "}" "\n" fp << "\t" "}" "\n" "\n";
"\n";
DumpDowntimes(fp, service); DumpDowntimes(fp, service);
DumpComments(fp, service); DumpComments(fp, service);
@ -512,8 +506,7 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
DumpCustomAttributes(fp, service); DumpCustomAttributes(fp, service);
fp << "\t" "}" "\n" fp << "\t" "}" "\n" "\n";
"\n";
} }
void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObject::Ptr& object) void StatusDataWriter::DumpCustomAttributes(std::ostream& fp, const CustomVarObject::Ptr& object)
@ -599,8 +592,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
tempobjectfp << "\t" "members" "\t"; tempobjectfp << "\t" "members" "\t";
DumpNameList(tempobjectfp, hg->GetMembers()); DumpNameList(tempobjectfp, hg->GetMembers());
tempobjectfp << "\n" tempobjectfp << "\n" "\t" "}" "\n";
"\t" "}" "\n";
objectfp << tempobjectfp.str(); objectfp << tempobjectfp.str();
} }
@ -640,8 +632,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
DumpStringList(tempobjectfp, sglist); DumpStringList(tempobjectfp, sglist);
tempobjectfp << "\n" tempobjectfp << "\n" "}" "\n";
"}" "\n";
objectfp << tempobjectfp.str(); objectfp << tempobjectfp.str();
} }

View File

@ -416,7 +416,8 @@ object:
} }
$$ = new ObjectExpression(abstract, std::unique_ptr<Expression>($3), std::unique_ptr<Expression>($4), $$ = new ObjectExpression(abstract, std::unique_ptr<Expression>($3), std::unique_ptr<Expression>($4),
std::move(filter), context->GetZone(), context->GetPackage(), std::move(*$5), $6, $7, std::unique_ptr<Expression>($9), DebugInfoRange(@2, @7)); std::move(filter), context->GetZone(), context->GetPackage(), std::move(*$5), $6, $7,
std::unique_ptr<Expression>($9), DebugInfoRange(@2, @7));
delete $5; delete $5;
} }
; ;

View File

@ -477,8 +477,9 @@ void Checkable::ExecuteCheck(void)
listener->SyncSendMessage(endpoint, message); listener->SyncSendMessage(endpoint, message);
/* Re-schedule the check so we don't run it again until after we've received /* Re-schedule the check so we don't run it again until after we've received
a check result from the remote instance. The check will be re-scheduled * a check result from the remote instance. The check will be re-scheduled
using the proper check interval once we've received a check result. */ * using the proper check interval once we've received a check result.
*/
SetNextCheck(Utility::GetTime() + GetCheckCommand()->GetTimeout() + 30); SetNextCheck(Utility::GetTime() + GetCheckCommand()->GetTimeout() + 30);
} else if (!endpoint->GetSyncing() && Application::GetInstance()->GetStartTime() < Utility::GetTime() - 300) { } else if (!endpoint->GetSyncing() && Application::GetInstance()->GetStartTime() < Utility::GetTime() - 300) {
/* fail to perform check on unconnected endpoint */ /* fail to perform check on unconnected endpoint */

View File

@ -178,8 +178,7 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
} }
return bag; return bag;
} else if (type.Contains("HOST DOWNTIME ALERT") || } else if (type.Contains("HOST DOWNTIME ALERT") || type.Contains("HOST FLAPPING ALERT")) {
type.Contains("HOST FLAPPING ALERT")) {
if (tokens.size() < 3) if (tokens.size() < 3)
return bag; return bag;

View File

@ -318,8 +318,7 @@ String InfluxdbWriter::EscapeValue(const Value& value)
{ {
if (value.IsObjectType<InfluxdbInteger>()) { if (value.IsObjectType<InfluxdbInteger>()) {
std::ostringstream os; std::ostringstream os;
os << static_cast<InfluxdbInteger::Ptr>(value)->GetValue() os << static_cast<InfluxdbInteger::Ptr>(value)->GetValue() << "i";
<< "i";
return os.str(); return os.str();
} }

View File

@ -59,7 +59,8 @@ void HttpClientConnection::Reconnect(void)
else else
ASSERT(!"Non-TLS HTTP connections not supported."); ASSERT(!"Non-TLS HTTP connections not supported.");
/* m_Stream = new NetworkStream(socket); /* m_Stream = new NetworkStream(socket);
-- does not currently work because the NetworkStream class doesn't support async I/O */ * -- does not currently work because the NetworkStream class doesn't support async I/O
*/
/* the stream holds an owning reference to this object through the callback we're registering here */ /* the stream holds an owning reference to this object through the callback we're registering here */
m_Stream->RegisterDataHandler(std::bind(&HttpClientConnection::DataAvailableHandler, HttpClientConnection::Ptr(this), _1)); m_Stream->RegisterDataHandler(std::bind(&HttpClientConnection::DataAvailableHandler, HttpClientConnection::Ptr(this), _1));

View File

@ -44,8 +44,7 @@ static Timer::Ptr l_HeartbeatTimer;
JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated, JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated,
const TlsStream::Ptr& stream, ConnectionRole role) const TlsStream::Ptr& stream, ConnectionRole role)
: m_ID(l_JsonRpcConnectionNextID++), m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream), : m_ID(l_JsonRpcConnectionNextID++), m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream),
m_Role(role), m_Timestamp(Utility::GetTime()), m_Seen(Utility::GetTime()), m_Role(role), m_Timestamp(Utility::GetTime()), m_Seen(Utility::GetTime()), m_NextHeartbeat(0), m_HeartbeatTimeout(0)
m_NextHeartbeat(0), m_HeartbeatTimeout(0)
{ {
boost::call_once(l_JsonRpcConnectionOnceFlag, &JsonRpcConnection::StaticInitialize); boost::call_once(l_JsonRpcConnectionOnceFlag, &JsonRpcConnection::StaticInitialize);

View File

@ -152,8 +152,7 @@ BOOL ParseArguments(CONST INT ac, WCHAR **av, po::variables_map& vm, printInfoSt
} }
BOOL GetIntstancesAndCountersOfObject(CONST std::wstring wsObject, BOOL GetIntstancesAndCountersOfObject(CONST std::wstring wsObject,
std::vector<std::wstring>& vecInstances, std::vector<std::wstring>& vecInstances, std::vector<std::wstring>& vecCounters)
std::vector<std::wstring>& vecCounters)
{ {
LPWSTR szDataSource = NULL, szMachineName = NULL, LPWSTR szDataSource = NULL, szMachineName = NULL,
mszCounterList = NULL, mszInstanceList = NULL; mszCounterList = NULL, mszInstanceList = NULL;
@ -315,8 +314,8 @@ BOOL QueryPerfData(printInfoStruct& pI)
goto die; goto die;
/* /*
/* Most counters need two queries to provide a value. * Most counters need two queries to provide a value.
/* Those which need only one will return the second. * Those which need only one will return the second.
*/ */
Sleep(pI.dwPerformanceWait); Sleep(pI.dwPerformanceWait);
@ -324,14 +323,12 @@ BOOL QueryPerfData(printInfoStruct& pI)
if (FAILED(status)) if (FAILED(status))
goto die; goto die;
status = PdhGetFormattedCounterArray(hCounter, pI.dwRequestedType, status = PdhGetFormattedCounterArray(hCounter, pI.dwRequestedType, &dwBufferSize, &dwItemCount, pDisplayValues);
&dwBufferSize, &dwItemCount, pDisplayValues);
if (status != PDH_MORE_DATA) if (status != PDH_MORE_DATA)
goto die; goto die;
pDisplayValues = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwBufferSize]); pDisplayValues = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwBufferSize]);
status = PdhGetFormattedCounterArray(hCounter, pI.dwRequestedType, status = PdhGetFormattedCounterArray(hCounter, pI.dwRequestedType, &dwBufferSize, &dwItemCount, pDisplayValues);
&dwBufferSize, &dwItemCount, pDisplayValues);
if (FAILED(status)) if (FAILED(status))
goto die; goto die;

View File

@ -191,7 +191,7 @@ INT printOutput(printInfoStruct& printInfo)
return state; return state;
} }
INT check_swap(printInfoStruct& printInfo) INT check_swap(printInfoStruct& printInfo
{ {
MEMORYSTATUSEX MemBuf; MEMORYSTATUSEX MemBuf;
MemBuf.dwLength = sizeof(MemBuf); MemBuf.dwLength = sizeof(MemBuf);

View File

@ -183,10 +183,10 @@ INT check_update(printInfoStruct& printInfo)
pSession->CreateUpdateSearcher(&pSearcher); pSession->CreateUpdateSearcher(&pSearcher);
/* /*
IsInstalled = 0: All updates, including languagepacks and features * IsInstalled = 0: All updates, including languagepacks and features
BrowseOnly = 0: No features or languagepacks, security and unnamed * BrowseOnly = 0: No features or languagepacks, security and unnamed
BrowseOnly = 1: Nothing, broken * BrowseOnly = 1: Nothing, broken
RebootRequired = 1: Reboot required * RebootRequired = 1: Reboot required
*/ */
criteria = SysAllocString(CRITERIA); criteria = SysAllocString(CRITERIA);

View File

@ -114,7 +114,7 @@ std::wstring threshold::pString(CONST DOUBLE max)
upperAbs = upper / 100.0 * max; upperAbs = upper / 100.0 * max;
} }
std::wstring s, lowerStr = removeZero(lowerAbs), std::wstring s, lowerStr = removeZero(lowerAbs)
upperStr = removeZero(upperAbs); upperStr = removeZero(upperAbs);
if (lower != upper) { if (lower != upper) {

View File

@ -47,8 +47,9 @@ static void LogFlapping(const Checkable::Ptr& obj)
std::bitset<20> stateChangeBuf = obj->GetFlappingBuffer(); std::bitset<20> stateChangeBuf = obj->GetFlappingBuffer();
int oldestIndex = (obj->GetFlappingBuffer() & 0xFF00000) >> 20; int oldestIndex = (obj->GetFlappingBuffer() & 0xFF00000) >> 20;
std::cout << "Flapping: " << obj->IsFlapping() << "\nHT: " << obj->GetFlappingThresholdHigh() << " LT: " << obj->GetFlappingThresholdLow() std::cout << "Flapping: " << obj->IsFlapping() << "\nHT: " << obj->GetFlappingThresholdHigh() << " LT: "
<< "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex << " Buf: " << stateChangeBuf.to_ulong() << '\n'; << obj->GetFlappingThresholdLow() << "\nOur value: " << obj->GetFlappingCurrent() << "\nPtr: " << oldestIndex
<< " Buf: " << stateChangeBuf.to_ulong() << '\n';
} }

View File

@ -113,9 +113,8 @@ int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
void yyerror(YYLTYPE *locp, ClassCompiler *, const char *err) void yyerror(YYLTYPE *locp, ClassCompiler *, const char *err)
{ {
std::cerr << "in " << locp->path << " at " << locp->first_line << ":" << locp->first_column << "-" << locp->last_line << ":" << locp->last_column << ": " std::cerr << "in " << locp->path << " at " << locp->first_line << ":" << locp->first_column << "-"
<< err << locp->last_line << ":" << locp->last_column << ": " << err << std::endl;
<< std::endl;
std::exit(1); std::exit(1);
} }