mirror of https://github.com/Icinga/icinga2.git
Merge pull request #5857 from Icinga/fix/compiler-warnings
Fix compiler warnings
This commit is contained in:
commit
1bf12c9685
|
@ -7,14 +7,17 @@ using System.Text;
|
|||
|
||||
namespace Icinga
|
||||
{
|
||||
static class Program
|
||||
internal static class NativeMethods
|
||||
{
|
||||
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
|
||||
internal static extern int MsiEnumProducts(int iProductIndex, StringBuilder lpProductBuf);
|
||||
|
||||
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
|
||||
internal static extern Int32 MsiGetProductInfo(string product, string property, [Out] StringBuilder valueBuf, ref Int32 len);
|
||||
}
|
||||
|
||||
static class Program
|
||||
{
|
||||
[DllImport("msi.dll", SetLastError = true)]
|
||||
static extern int MsiEnumProducts(int iProductIndex, StringBuilder lpProductBuf);
|
||||
|
||||
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
|
||||
static extern Int32 MsiGetProductInfo(string product, string property, [Out] StringBuilder valueBuf, ref Int32 len);
|
||||
|
||||
public static string Icinga2InstallDir
|
||||
{
|
||||
get
|
||||
|
@ -23,13 +26,13 @@ namespace Icinga
|
|||
|
||||
for (int index = 0; ; index++) {
|
||||
szProduct = new StringBuilder(39);
|
||||
if (MsiEnumProducts(index, szProduct) != 0)
|
||||
if (NativeMethods.MsiEnumProducts(index, szProduct) != 0)
|
||||
break;
|
||||
|
||||
int cbName = 128;
|
||||
StringBuilder szName = new StringBuilder(cbName);
|
||||
|
||||
if (MsiGetProductInfo(szProduct.ToString(), "ProductName", szName, ref cbName) != 0)
|
||||
if (NativeMethods.MsiGetProductInfo(szProduct.ToString(), "ProductName", szName, ref cbName) != 0)
|
||||
continue;
|
||||
|
||||
if (szName.ToString() != "Icinga 2")
|
||||
|
@ -37,7 +40,7 @@ namespace Icinga
|
|||
|
||||
int cbLocation = 1024;
|
||||
StringBuilder szLocation = new StringBuilder(cbLocation);
|
||||
if (MsiGetProductInfo(szProduct.ToString(), "InstallLocation", szLocation, ref cbLocation) == 0)
|
||||
if (NativeMethods.MsiGetProductInfo(szProduct.ToString(), "InstallLocation", szLocation, ref cbLocation) == 0)
|
||||
return szLocation.ToString();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ static HANDLE l_Job;
|
|||
static std::vector<String> GetLogLevelCompletionSuggestions(const String& arg)
|
||||
{
|
||||
std::vector<String> result;
|
||||
|
||||
|
||||
String debugLevel = "debug";
|
||||
if (debugLevel.Find(arg) == 0)
|
||||
result.push_back(debugLevel);
|
||||
|
@ -106,7 +106,7 @@ static int Main(void)
|
|||
|
||||
try {
|
||||
autoindex = Convert::ToLong(argv[2]);
|
||||
} catch (const std::invalid_argument& ex) {
|
||||
} catch (const std::invalid_argument&) {
|
||||
Log(LogCritical, "icinga-app")
|
||||
<< "Invalid index for --autocomplete: " << argv[2];
|
||||
return EXIT_FAILURE;
|
||||
|
@ -460,10 +460,10 @@ static int Main(void)
|
|||
} else if (command && command->GetImpersonationLevel() == ImpersonateIcinga) {
|
||||
String group = Application::GetRunAsGroup();
|
||||
String user = Application::GetRunAsUser();
|
||||
|
||||
|
||||
errno = 0;
|
||||
struct group *gr = getgrnam(group.CStr());
|
||||
|
||||
|
||||
if (!gr) {
|
||||
if (errno == 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -475,7 +475,7 @@ static int Main(void)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (getgid() != gr->gr_gid) {
|
||||
if (!vm.count("reload-internal") && setgroups(0, NULL) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -484,17 +484,17 @@ static int Main(void)
|
|||
<< "Please re-run this command as a privileged user or using the \"" << user << "\" account.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (setgid(gr->gr_gid) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "setgid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
errno = 0;
|
||||
struct passwd *pw = getpwnam(user.CStr());
|
||||
|
||||
|
||||
if (!pw) {
|
||||
if (errno == 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -506,7 +506,7 @@ static int Main(void)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// also activate the additional groups the configured user is member of
|
||||
if (getuid() != pw->pw_uid) {
|
||||
if (!vm.count("reload-internal") && initgroups(user.CStr(), pw->pw_gid) < 0) {
|
||||
|
@ -516,7 +516,7 @@ static int Main(void)
|
|||
<< "Please re-run this command as a privileged user or using the \"" << user << "\" account.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (setuid(pw->pw_uid) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "setuid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
|
@ -684,14 +684,15 @@ static int SetupService(bool install, int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
printf("Service successfully installed for user '%s'\n", scmUser);
|
||||
std::cout << "Service successfully installed for user '" << scmUser << "'\n";
|
||||
|
||||
std::ofstream fuser(Utility::GetIcingaDataPath() + "\\etc\\icinga2\\user", std::ios::out | std::ios::trunc);
|
||||
String userFilePath = Utility::GetIcingaDataPath() + "\\etc\\icinga2\\user";
|
||||
|
||||
std::ofstream fuser(userFilePath.CStr(), std::ios::out | std::ios::trunc);
|
||||
if (fuser)
|
||||
fuser << scmUser;
|
||||
else
|
||||
printf("Could not write user to %s\\etc\\icinga2\\user", Utility::GetIcingaDataPath());
|
||||
fuser.close();
|
||||
std::cout << "Could not write user to " << userFilePath << "\n";
|
||||
}
|
||||
|
||||
CloseServiceHandle(schService);
|
||||
|
@ -779,7 +780,7 @@ static VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
|||
break;
|
||||
|
||||
DWORD exitStatus;
|
||||
|
||||
|
||||
if (!GetExitCodeProcess(pi.hProcess, &exitStatus))
|
||||
break;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
VALUE "ProductVersion", VERSION
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0x04E4
|
||||
|
|
|
@ -54,7 +54,7 @@ static bool ExecuteCommand(const std::string& app, const std::string& arguments)
|
|||
sei.nShow = SW_HIDE;
|
||||
if (!ShellExecuteEx(&sei))
|
||||
return false;
|
||||
|
||||
|
||||
if (!sei.hProcess)
|
||||
return false;
|
||||
|
||||
|
@ -221,7 +221,7 @@ static int UpgradeNSIS(void)
|
|||
return 1;
|
||||
|
||||
_rmdir(installPath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -14,57 +14,57 @@
|
|||
MainFormBase::MainFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( 800,569 ), wxDefaultSize );
|
||||
|
||||
|
||||
m_MenuBar = new wxMenuBar( 0 );
|
||||
wxMenu* m_FileMenu;
|
||||
m_FileMenu = new wxMenu();
|
||||
wxMenuItem* m_QuitMenuItem;
|
||||
m_QuitMenuItem = new wxMenuItem( m_FileMenu, wxID_EXIT, wxString( wxT("&Quit") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_FileMenu->Append( m_QuitMenuItem );
|
||||
|
||||
|
||||
m_MenuBar->Append( m_FileMenu, wxT("&File") );
|
||||
|
||||
|
||||
wxMenu* m_HelpMenu;
|
||||
m_HelpMenu = new wxMenu();
|
||||
wxMenuItem* m_AboutMenuItem;
|
||||
m_AboutMenuItem = new wxMenuItem( m_HelpMenu, wxID_ABOUT, wxString( wxT("&About Icinga Studio...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_HelpMenu->Append( m_AboutMenuItem );
|
||||
|
||||
|
||||
m_MenuBar->Append( m_HelpMenu, wxT("&Help") );
|
||||
|
||||
|
||||
this->SetMenuBar( m_MenuBar );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* m_ConnectionDetailsSizer;
|
||||
m_ConnectionDetailsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
m_TypesTree = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( 315,-1 ), wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT );
|
||||
m_ConnectionDetailsSizer->Add( m_TypesTree, 0, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
wxBoxSizer* m_ObjectDetailsSizer;
|
||||
m_ObjectDetailsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_ObjectsList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
||||
m_ObjectDetailsSizer->Add( m_ObjectsList, 1, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
m_PropertyGrid = new wxPropertyGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_DEFAULT_STYLE);
|
||||
m_ObjectDetailsSizer->Add( m_PropertyGrid, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ConnectionDetailsSizer->Add( m_ObjectDetailsSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_DialogSizer->Add( m_ConnectionDetailsSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_StatusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
|
||||
// Connect Events
|
||||
this->Connect( m_QuitMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnQuitClicked ) );
|
||||
this->Connect( m_AboutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnAboutClicked ) );
|
||||
|
@ -79,89 +79,89 @@ MainFormBase::~MainFormBase()
|
|||
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnAboutClicked ) );
|
||||
m_TypesTree->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( MainFormBase::OnTypeSelected ), NULL, this );
|
||||
m_ObjectsList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFormBase::OnObjectSelected ), NULL, this );
|
||||
|
||||
|
||||
}
|
||||
|
||||
ConnectFormBase::ConnectFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxPanel* m_ConnectionDetailsPanel;
|
||||
m_ConnectionDetailsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxStaticBoxSizer* m_DetailsSizer;
|
||||
m_DetailsSizer = new wxStaticBoxSizer( new wxStaticBox( m_ConnectionDetailsPanel, wxID_ANY, wxT("Connection Details") ), wxVERTICAL );
|
||||
|
||||
|
||||
wxStaticText* m_HostLabel;
|
||||
m_HostLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("Host:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_HostLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_HostLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_HostText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_OK, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_HostText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_PortLabel;
|
||||
m_PortLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("Port:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_PortLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_PortLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_PortText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_PortText, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_UserLabel;
|
||||
m_UserLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("API User:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UserLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_UserLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_UserText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_UserText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_PasswordLabel;
|
||||
m_PasswordLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("API Password:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_PasswordLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_PasswordLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_PasswordText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
|
||||
m_DetailsSizer->Add( m_PasswordText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_InfoLabel;
|
||||
m_InfoLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("You can find the username and password for the default user in /etc/icinga2/conf.d/api-users.conf."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoLabel->Wrap( 270 );
|
||||
m_DetailsSizer->Add( m_InfoLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ConnectionDetailsPanel->SetSizer( m_DetailsSizer );
|
||||
m_ConnectionDetailsPanel->Layout();
|
||||
m_DetailsSizer->Fit( m_ConnectionDetailsPanel );
|
||||
m_DialogSizer->Add( m_ConnectionDetailsPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
wxPanel* m_ButtonsPanel;
|
||||
m_ButtonsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_ButtonsSizer;
|
||||
m_ButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
m_Buttons = new wxStdDialogButtonSizer();
|
||||
m_ButtonsOK = new wxButton( m_ButtonsPanel, wxID_OK );
|
||||
m_Buttons->AddButton( m_ButtonsOK );
|
||||
m_ButtonsCancel = new wxButton( m_ButtonsPanel, wxID_CANCEL );
|
||||
m_Buttons->AddButton( m_ButtonsCancel );
|
||||
m_Buttons->Realize();
|
||||
|
||||
|
||||
m_ButtonsSizer->Add( m_Buttons, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ButtonsPanel->SetSizer( m_ButtonsSizer );
|
||||
m_ButtonsPanel->Layout();
|
||||
m_ButtonsSizer->Fit( m_ButtonsPanel );
|
||||
m_DialogSizer->Add( m_ButtonsPanel, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_DialogSizer->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
|
@ -172,65 +172,65 @@ ConnectFormBase::~ConnectFormBase()
|
|||
AboutFormBase::AboutFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* m_InfoSizer;
|
||||
m_InfoSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
wxStaticBitmap* m_ProductIcon;
|
||||
m_ProductIcon = new wxStaticBitmap( this, wxID_ANY, wxBitmap( icinga_xpm ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoSizer->Add( m_ProductIcon, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxBoxSizer* m_AboutInfoSizer;
|
||||
m_AboutInfoSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxStaticText* m_ProductNameLabel;
|
||||
m_ProductNameLabel = new wxStaticText( this, wxID_ANY, wxT("Icinga Studio"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ProductNameLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_ProductNameLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_VersionLabel = new wxStaticText( this, wxID_ANY, wxT("Version"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_VersionLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_VersionLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_CopyrightLabel;
|
||||
m_CopyrightLabel = new wxStaticText( this, wxID_ANY, wxT("Copyright (c) 2015 Icinga Development Team"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_CopyrightLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_CopyrightLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_InfoSizer->Add( m_AboutInfoSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_DialogSizer->Add( m_InfoSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxPanel* m_ButtonsPanel;
|
||||
m_ButtonsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_ButtonsSizer;
|
||||
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxStdDialogButtonSizer* m_Buttons;
|
||||
wxButton* m_ButtonsOK;
|
||||
m_Buttons = new wxStdDialogButtonSizer();
|
||||
m_ButtonsOK = new wxButton( m_ButtonsPanel, wxID_OK );
|
||||
m_Buttons->AddButton( m_ButtonsOK );
|
||||
m_Buttons->Realize();
|
||||
|
||||
|
||||
m_ButtonsSizer->Add( m_Buttons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ButtonsPanel->SetSizer( m_ButtonsSizer );
|
||||
m_ButtonsPanel->Layout();
|
||||
m_ButtonsSizer->Fit( m_ButtonsPanel );
|
||||
m_DialogSizer->Add( m_ButtonsPanel, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_DialogSizer->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
|
|
|
@ -42,27 +42,27 @@
|
|||
class MainFormBase : public wxFrame
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_MenuBar;
|
||||
wxTreeCtrl* m_TypesTree;
|
||||
wxListCtrl* m_ObjectsList;
|
||||
wxPropertyGrid* m_PropertyGrid;
|
||||
wxStatusBar* m_StatusBar;
|
||||
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnQuitClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAboutClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTypeSelected( wxTreeEvent& event ) { event.Skip(); }
|
||||
virtual void OnObjectSelected( wxListEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
MainFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Icinga Studio"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,569 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
|
||||
|
||||
|
||||
~MainFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -71,7 +71,7 @@ class MainFormBase : public wxFrame
|
|||
class ConnectFormBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxTextCtrl* m_HostText;
|
||||
wxTextCtrl* m_PortText;
|
||||
|
@ -80,12 +80,12 @@ class ConnectFormBase : public wxDialog
|
|||
wxStdDialogButtonSizer* m_Buttons;
|
||||
wxButton* m_ButtonsOK;
|
||||
wxButton* m_ButtonsCancel;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
ConnectFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Icinga Studio - Connect"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~ConnectFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -94,15 +94,15 @@ class ConnectFormBase : public wxDialog
|
|||
class AboutFormBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxStaticText* m_VersionLabel;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
AboutFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("About Icinga Studio"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~AboutFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__FORMS_H__
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
VALUE "ProductVersion", VERSION
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0x04E4
|
||||
|
|
|
@ -45,7 +45,7 @@ MainForm::MainForm(wxWindow *parent, const Url::Ptr& url)
|
|||
SetTitle(title);
|
||||
|
||||
m_ObjectsList->InsertColumn(0, "Name", 0, 300);
|
||||
|
||||
|
||||
m_PropertyGrid->SetColumnCount(3);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
|
|||
return prop;
|
||||
} else if (value.IsObjectType<Dictionary>()) {
|
||||
wxStringProperty *prop = new wxStringProperty(name.GetData(), wxPG_LABEL);
|
||||
|
||||
|
||||
Dictionary::Ptr dict = value;
|
||||
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ REGISTER_PRIMITIVE_TYPE(Array, Object, Array::GetPrototype());
|
|||
* @param index The index.
|
||||
* @returns The value.
|
||||
*/
|
||||
Value Array::Get(unsigned int index) const
|
||||
Value Array::Get(SizeType index) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
|
@ -49,7 +49,7 @@ Value Array::Get(unsigned int index) const
|
|||
* @param index The index.
|
||||
* @param value The value.
|
||||
*/
|
||||
void Array::Set(unsigned int index, const Value& value)
|
||||
void Array::Set(SizeType index, const Value& value)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void Array::Set(unsigned int index, const Value& value)
|
|||
* @param index The index.
|
||||
* @param value The value.
|
||||
*/
|
||||
void Array::Set(unsigned int index, Value&& value)
|
||||
void Array::Set(SizeType index, Value&& value)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
|
@ -124,7 +124,7 @@ bool Array::Contains(const Value& value) const
|
|||
* @param index The index
|
||||
* @param value The value to add
|
||||
*/
|
||||
void Array::Insert(unsigned int index, const Value& value)
|
||||
void Array::Insert(SizeType index, const Value& value)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
|
@ -138,7 +138,7 @@ void Array::Insert(unsigned int index, const Value& value)
|
|||
*
|
||||
* @param index The index.
|
||||
*/
|
||||
void Array::Remove(unsigned int index)
|
||||
void Array::Remove(SizeType index)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
|
@ -157,11 +157,11 @@ void Array::Remove(Array::Iterator it)
|
|||
m_Data.erase(it);
|
||||
}
|
||||
|
||||
void Array::Resize(size_t new_size)
|
||||
void Array::Resize(SizeType newSize)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
m_Data.resize(new_size);
|
||||
m_Data.resize(newSize);
|
||||
}
|
||||
|
||||
void Array::Clear(void)
|
||||
|
@ -171,11 +171,11 @@ void Array::Clear(void)
|
|||
m_Data.clear();
|
||||
}
|
||||
|
||||
void Array::Reserve(size_t new_size)
|
||||
void Array::Reserve(SizeType newSize)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
m_Data.reserve(new_size);
|
||||
m_Data.reserve(newSize);
|
||||
}
|
||||
|
||||
void Array::CopyTo(const Array::Ptr& dest) const
|
||||
|
@ -207,12 +207,12 @@ Array::Ptr Array::ShallowClone(void) const
|
|||
Object::Ptr Array::Clone(void) const
|
||||
{
|
||||
Array::Ptr arr = new Array();
|
||||
|
||||
|
||||
ObjectLock olock(this);
|
||||
for (const Value& val : m_Data) {
|
||||
arr->Add(val.Clone());
|
||||
}
|
||||
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,9 +57,9 @@ public:
|
|||
inline ~Array(void)
|
||||
{ }
|
||||
|
||||
Value Get(unsigned int index) const;
|
||||
void Set(unsigned int index, const Value& value);
|
||||
void Set(unsigned int index, Value&& value);
|
||||
Value Get(SizeType index) const;
|
||||
void Set(SizeType index, const Value& value);
|
||||
void Set(SizeType index, Value&& value);
|
||||
void Add(const Value& value);
|
||||
void Add(Value&& value);
|
||||
|
||||
|
@ -94,14 +94,14 @@ public:
|
|||
size_t GetLength(void) const;
|
||||
bool Contains(const Value& value) const;
|
||||
|
||||
void Insert(unsigned int index, const Value& value);
|
||||
void Remove(unsigned int index);
|
||||
void Insert(SizeType index, const Value& value);
|
||||
void Remove(SizeType index);
|
||||
void Remove(Iterator it);
|
||||
|
||||
void Resize(size_t new_size);
|
||||
void Resize(SizeType newSize);
|
||||
void Clear(void);
|
||||
|
||||
void Reserve(size_t new_size);
|
||||
void Reserve(SizeType newSize);
|
||||
|
||||
void CopyTo(const Array::Ptr& dest) const;
|
||||
Array::Ptr ShallowClone(void) const;
|
||||
|
|
|
@ -52,7 +52,7 @@ String Base64::Decode(const String& input)
|
|||
BIO_set_flags(bio64, BIO_FLAGS_BASE64_NO_NL);
|
||||
|
||||
char *outbuf = new char[input.GetLength()];
|
||||
|
||||
|
||||
size_t len = 0;
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
std::vector<String> GetKeys(void) const;
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
|
||||
virtual Object::Ptr Clone(void) const override;
|
||||
|
||||
virtual String ToString(void) const override;
|
||||
|
|
|
@ -25,15 +25,20 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
#define I2_TOKENPASTE(x, y) x ## y
|
||||
#define I2_TOKENPASTE2(x, y) I2_TOKENPASTE(x, y)
|
||||
|
||||
#define I2_UNIQUE_NAME(prefix) I2_TOKENPASTE2(prefix, __COUNTER__)
|
||||
|
||||
I2_BASE_API bool InitializeOnceHelper(void (*func)(void), int priority = 0);
|
||||
|
||||
#define INITIALIZE_ONCE(func) \
|
||||
namespace { namespace UNIQUE_NAME(io) { \
|
||||
namespace { namespace I2_UNIQUE_NAME(io) { \
|
||||
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func)); \
|
||||
} }
|
||||
|
||||
#define INITIALIZE_ONCE_WITH_PRIORITY(func, priority) \
|
||||
namespace { namespace UNIQUE_NAME(io) { \
|
||||
namespace { namespace I2_UNIQUE_NAME(io) { \
|
||||
I2_EXPORT bool l_InitializeOnce(icinga::InitializeOnceHelper(func, priority)); \
|
||||
} }
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ static int DecodeEndMapOrArray(void *ctx)
|
|||
static int DecodeStartArray(void *ctx)
|
||||
{
|
||||
JsonContext *context = static_cast<JsonContext *>(ctx);
|
||||
|
||||
|
||||
try {
|
||||
context->Push(new Array());
|
||||
} catch (...) {
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
#endif /* I2_DEBUG */
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
|
||||
virtual Object::Ptr Clone(void) const;
|
||||
|
||||
static intrusive_ptr<Type> TypeInstance;
|
||||
|
|
|
@ -115,7 +115,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
|
|||
return object;
|
||||
|
||||
Object::Ptr instance;
|
||||
|
||||
|
||||
if (object)
|
||||
instance = object;
|
||||
else
|
||||
|
@ -127,7 +127,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
|
|||
continue;
|
||||
|
||||
int fid = type->GetFieldId(kv.first);
|
||||
|
||||
|
||||
if (fid < 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -330,29 +330,30 @@ size_t Socket::Read(void *buffer, size_t count)
|
|||
*/
|
||||
Socket::Ptr Socket::Accept(void)
|
||||
{
|
||||
int fd;
|
||||
sockaddr_storage addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
fd = accept(GetFD(), (sockaddr *)&addr, &addrlen);
|
||||
SOCKET fd = accept(GetFD(), (sockaddr *)&addr, &addrlen);
|
||||
|
||||
if (fd < 0) {
|
||||
#ifndef _WIN32
|
||||
if (fd < 0) {
|
||||
Log(LogCritical, "Socket")
|
||||
<< "accept() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
<< "accept() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
|
||||
BOOST_THROW_EXCEPTION(socket_error()
|
||||
<< boost::errinfo_api_function("accept")
|
||||
<< boost::errinfo_errno(errno));
|
||||
#else /* _WIN32 */
|
||||
Log(LogCritical, "Socket")
|
||||
<< "accept() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\"";
|
||||
|
||||
BOOST_THROW_EXCEPTION(socket_error()
|
||||
<< boost::errinfo_api_function("accept")
|
||||
<< errinfo_win32_error(WSAGetLastError()));
|
||||
#endif /* _WIN32 */
|
||||
<< boost::errinfo_api_function("accept")
|
||||
<< boost::errinfo_errno(errno));
|
||||
}
|
||||
#else /* _WIN32 */
|
||||
if (fd == INVALID_SOCKET) {
|
||||
Log(LogCritical, "Socket")
|
||||
<< "accept() failed with error code " << WSAGetLastError() << ", \"" << Utility::FormatErrorNumber(WSAGetLastError()) << "\"";
|
||||
|
||||
BOOST_THROW_EXCEPTION(socket_error()
|
||||
<< boost::errinfo_api_function("accept")
|
||||
<< errinfo_win32_error(WSAGetLastError()));
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
return new Socket(fd);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ void TcpSocket::Connect(const String& node, const String& service)
|
|||
<< errinfo_getaddrinfo_error(rc));
|
||||
}
|
||||
|
||||
int fd = INVALID_SOCKET;
|
||||
SOCKET fd = INVALID_SOCKET;
|
||||
|
||||
for (addrinfo *info = result; info != NULL; info = info->ai_next) {
|
||||
fd = socket(info->ai_family, info->ai_socktype, info->ai_protocol);
|
||||
|
|
|
@ -440,10 +440,10 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
|
||||
X509_REQ_set_version(req, 0);
|
||||
X509_REQ_set_pubkey(req, key);
|
||||
|
||||
|
||||
X509_NAME *name = X509_REQ_get_subject_name(req);
|
||||
X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (unsigned char *)cn.CStr(), -1, -1, 0);
|
||||
|
||||
|
||||
if (!ca) {
|
||||
String san = "DNS:" + cn;
|
||||
X509_EXTENSION *subjectAltNameExt = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, const_cast<char *>(san.CStr()));
|
||||
|
@ -457,10 +457,10 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
}
|
||||
|
||||
X509_REQ_sign(req, key, EVP_sha256());
|
||||
|
||||
|
||||
Log(LogInformation, "base")
|
||||
<< "Writing certificate signing request to '" << csrfile << "'.";
|
||||
|
||||
|
||||
bio = BIO_new_file(const_cast<char *>(csrfile.CStr()), "w");
|
||||
|
||||
if (!bio) {
|
||||
|
@ -482,7 +482,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
}
|
||||
|
||||
BIO_free(bio);
|
||||
|
||||
|
||||
X509_REQ_free(req);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
virtual Value GetField(int id) const override;
|
||||
|
||||
virtual std::vector<String> GetLoadDependencies(void) const;
|
||||
|
||||
|
||||
typedef std::function<void (const Object::Ptr&, const Value&)> AttributeHandler;
|
||||
virtual void RegisterAttributeHandler(int fieldId, const AttributeHandler& callback);
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
virtual int GetFieldId(const String& name) const override;
|
||||
virtual Field GetFieldInfo(int id) const override;
|
||||
virtual int GetFieldCount(void) const override;
|
||||
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -35,7 +35,7 @@ static void TypeRegisterAttributeHandler(const String& fieldName, const Function
|
|||
{
|
||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||
Type::Ptr self = static_cast<Type::Ptr>(vframe->Self);
|
||||
|
||||
|
||||
int fid = self->GetFieldId(fieldName);
|
||||
self->RegisterAttributeHandler(fid, std::bind(&InvokeAttributeHandlerHelper, callback, _1, _2));
|
||||
}
|
||||
|
|
|
@ -1780,7 +1780,7 @@ String Utility::CreateTempFile(const String& path, int mode, std::fstream& fp)
|
|||
|
||||
try {
|
||||
fp.open(&targetPath[0], std::ios_base::trunc | std::ios_base::out);
|
||||
} catch (const std::fstream::failure& e) {
|
||||
} catch (const std::fstream::failure&) {
|
||||
close(fd);
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ public:
|
|||
String GetTypeName(void) const;
|
||||
|
||||
Type::Ptr GetReflectionType(void) const;
|
||||
|
||||
|
||||
Value Clone(void) const;
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -29,9 +29,4 @@
|
|||
# define I2_HIDDEN
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define TOKENPASTE(x, y) x ## y
|
||||
#define TOKENPASTE2(x, y) TOKENPASTE(x, y)
|
||||
|
||||
#define UNIQUE_NAME(prefix) TOKENPASTE2(prefix, __COUNTER__)
|
||||
|
||||
#endif /* VISIBILITY_H */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
int WorkQueue::m_NextID = 1;
|
||||
std::atomic<int> WorkQueue::m_NextID(1);
|
||||
boost::thread_specific_ptr<WorkQueue *> l_ThreadWorkQueue;
|
||||
|
||||
WorkQueue::WorkQueue(size_t maxItems, int threadCount)
|
||||
|
@ -196,7 +196,7 @@ void WorkQueue::StatusTimerHandler(void)
|
|||
|
||||
ASSERT(!m_Name.IsEmpty());
|
||||
|
||||
int pending = m_Tasks.size();
|
||||
size_t pending = m_Tasks.size();
|
||||
|
||||
double now = Utility::GetTime();
|
||||
double gradient = (pending - m_PendingTasks) / (now - m_PendingTasksTimestamp);
|
||||
|
@ -295,7 +295,7 @@ void WorkQueue::IncreaseTaskCount(void)
|
|||
m_TaskStats.InsertValue(now, 1);
|
||||
}
|
||||
|
||||
int WorkQueue::GetTaskCount(RingBuffer::SizeType span)
|
||||
size_t WorkQueue::GetTaskCount(RingBuffer::SizeType span)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_StatsMutex);
|
||||
return m_TaskStats.UpdateAndGetValues(Utility::GetTime(), span);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <boost/exception_ptr.hpp>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
#include <atomic>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
bool IsWorkerThread(void) const;
|
||||
|
||||
size_t GetLength(void) const;
|
||||
int GetTaskCount(RingBuffer::SizeType span);
|
||||
size_t GetTaskCount(RingBuffer::SizeType span);
|
||||
|
||||
void SetExceptionCallback(const ExceptionCallback& callback);
|
||||
|
||||
|
@ -107,7 +108,7 @@ protected:
|
|||
private:
|
||||
int m_ID;
|
||||
String m_Name;
|
||||
static int m_NextID;
|
||||
static std::atomic<int> m_NextID;
|
||||
int m_ThreadCount;
|
||||
bool m_Spawned;
|
||||
|
||||
|
@ -128,7 +129,7 @@ private:
|
|||
|
||||
mutable boost::mutex m_StatsMutex;
|
||||
RingBuffer m_TaskStats;
|
||||
int m_PendingTasks;
|
||||
size_t m_PendingTasks;
|
||||
double m_PendingTasksTimestamp;
|
||||
|
||||
void WorkerThreadProc(void);
|
||||
|
|
|
@ -515,7 +515,7 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::
|
|||
if (eptr) {
|
||||
try {
|
||||
boost::rethrow_exception(eptr);
|
||||
} catch (const ScriptError& ex) {
|
||||
} catch (const ScriptError&) {
|
||||
eptrOut = boost::current_exception();
|
||||
} catch (const std::exception& ex) {
|
||||
Log(LogCritical, "ConsoleCommand")
|
||||
|
|
|
@ -68,10 +68,10 @@ void CompatLogger::Start(bool runtimeCreated)
|
|||
Downtime::OnDowntimeTriggered.connect(std::bind(&CompatLogger::TriggerDowntimeHandler, this, _1));
|
||||
Downtime::OnDowntimeRemoved.connect(std::bind(&CompatLogger::RemoveDowntimeHandler, this, _1));
|
||||
Checkable::OnEventCommandExecuted.connect(std::bind(&CompatLogger::EventCommandHandler, this, _1));
|
||||
|
||||
|
||||
Checkable::OnFlappingChanged.connect(std::bind(&CompatLogger::FlappingChangedHandler, this, _1));
|
||||
Checkable::OnEnableFlappingChanged.connect(std::bind(&CompatLogger::EnableFlappingChangedHandler, this, _1));
|
||||
|
||||
|
||||
ExternalCommandProcessor::OnNewExternalCommand.connect(std::bind(&CompatLogger::ExternalCommandHandler, this, _2, _3));
|
||||
|
||||
m_RotationTimer = new Timer();
|
||||
|
@ -315,7 +315,7 @@ void CompatLogger::FlappingChangedHandler(const Checkable::Ptr& checkable)
|
|||
|
||||
String flapping_state_str;
|
||||
String flapping_output;
|
||||
|
||||
|
||||
if (checkable->IsFlapping()) {
|
||||
flapping_output = "Checkable appears to have started flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change >= " + Convert::ToString(checkable->GetFlappingThresholdHigh()) + "% threshold)";
|
||||
flapping_state_str = "STARTED";
|
||||
|
@ -356,7 +356,7 @@ void CompatLogger::EnableFlappingChangedHandler(const Checkable::Ptr& checkable)
|
|||
|
||||
if (checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
String flapping_output = "Flap detection has been disabled";
|
||||
String flapping_state_str = "DISABLED";
|
||||
|
||||
|
|
|
@ -674,7 +674,7 @@ lterm: T_LIBRARY rterm
|
|||
}
|
||||
| rterm_side_effect
|
||||
;
|
||||
|
||||
|
||||
rterm_items: /* empty */
|
||||
{
|
||||
$$ = new std::vector<Expression *>();
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
void SetZone(const String& zone);
|
||||
String GetZone(void) const;
|
||||
|
||||
|
||||
void SetPackage(const String& package);
|
||||
String GetPackage(void) const;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
Dictionary::Ptr GetScope(void) const;
|
||||
|
||||
ConfigObject::Ptr GetObject(void) const;
|
||||
|
||||
|
||||
static ConfigItem::Ptr GetByTypeAndName(const Type::Ptr& type,
|
||||
const String& name);
|
||||
|
||||
|
|
|
@ -948,7 +948,7 @@ ExpressionResult TryExceptExpression::DoEvaluate(ScriptFrame& frame, DebugHint *
|
|||
try {
|
||||
ExpressionResult tryResult = m_TryBody->Evaluate(frame, dhint);
|
||||
CHECK_RESULT(tryResult);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
ExpressionResult exceptResult = m_ExceptBody->Evaluate(frame, dhint);
|
||||
CHECK_RESULT(exceptResult);
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ public:
|
|||
BinaryExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
|
||||
: DebuggableExpression(debugInfo), m_Operand1(operand1), m_Operand2(operand2)
|
||||
{ }
|
||||
|
||||
|
||||
~BinaryExpression(void)
|
||||
{
|
||||
delete m_Operand1;
|
||||
|
@ -325,7 +325,7 @@ private:
|
|||
|
||||
friend I2_CONFIG_API void BindToScope(Expression *& expr, ScopeSpecifier scopeSpec);
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NegateExpression : public UnaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalNegateExpression : public UnaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API SubtractExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -369,7 +369,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API MultiplyExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API DivideExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -424,7 +424,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API BinaryOrExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -435,7 +435,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ShiftLeftExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -446,7 +446,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ShiftRightExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -457,7 +457,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API EqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NotEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -479,7 +479,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LessThanExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -490,7 +490,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API GreaterThanExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -501,7 +501,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LessThanOrEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -512,7 +512,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API GreaterThanOrEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -523,7 +523,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API InExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -534,7 +534,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NotInExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -545,7 +545,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalAndExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalOrExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -567,7 +567,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API FunctionCallExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -590,7 +590,7 @@ public:
|
|||
Expression *m_FName;
|
||||
std::vector<Expression *> m_Args;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ArrayExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -610,7 +610,7 @@ protected:
|
|||
private:
|
||||
std::vector<Expression *> m_Expressions;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API DictExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -635,7 +635,7 @@ private:
|
|||
|
||||
friend I2_CONFIG_API void BindToScope(Expression *& expr, ScopeSpecifier scopeSpec);
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API SetExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -924,7 +924,7 @@ private:
|
|||
std::map<String, Expression *> *m_ClosedVars;
|
||||
std::shared_ptr<Expression> m_Expression;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ForExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1182,7 +1182,7 @@ void DbEvents::AddFlappingChangedLogHistory(const Checkable::Ptr& checkable)
|
|||
{
|
||||
String flapping_state_str;
|
||||
String flapping_output;
|
||||
|
||||
|
||||
if (checkable->IsFlapping()) {
|
||||
flapping_output = "Service appears to have started flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change >= " + Convert::ToString(checkable->GetFlappingThresholdHigh()) + "% threshold)";
|
||||
flapping_state_str = "STARTED";
|
||||
|
@ -1219,7 +1219,7 @@ void DbEvents::AddEnableFlappingChangedLogHistory(const Checkable::Ptr& checkabl
|
|||
{
|
||||
if (!checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
String flapping_output = "Flap detection has been disabled";
|
||||
String flapping_state_str = "DISABLED";
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ void DbEvents::AddEnableFlappingChangedHistory(const Checkable::Ptr& checkable)
|
|||
|
||||
if (!checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
fields1->Set("event_type", 1001);
|
||||
fields1->Set("reason_type", 2);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -91,7 +91,7 @@ void Dependency::OnAllConfigLoaded(void)
|
|||
else
|
||||
m_Child = childHost->GetServiceByShortName(GetChildServiceName());
|
||||
}
|
||||
|
||||
|
||||
if (!m_Child)
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Dependency '" + GetName() + "' references a child host/service which doesn't exist.", GetDebugInfo()));
|
||||
|
||||
|
@ -105,7 +105,7 @@ void Dependency::OnAllConfigLoaded(void)
|
|||
else
|
||||
m_Parent = parentHost->GetServiceByShortName(GetParentServiceName());
|
||||
}
|
||||
|
||||
|
||||
if (!m_Parent)
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Dependency '" + GetName() + "' references a parent host/service which doesn't exist.", GetDebugInfo()));
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -134,7 +134,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -123,7 +123,7 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -49,9 +49,9 @@ public:
|
|||
|
||||
protected:
|
||||
Aggregator(void);
|
||||
|
||||
|
||||
Filter::Ptr GetFilter(void) const;
|
||||
|
||||
|
||||
private:
|
||||
Filter::Ptr m_Filter;
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ void ApiClient::GetTypes(const TypesCompletionCallback& callback) const
|
|||
req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password));
|
||||
req->AddHeader("Accept", "application/json");
|
||||
m_Connection->SubmitRequest(req, std::bind(TypesHttpCompletionCallback, _1, _2, callback));
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), std::vector<ApiType::Ptr>());
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ void ApiClient::GetObjects(const String& pluralType, const ObjectsCompletionCall
|
|||
req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password));
|
||||
req->AddHeader("Accept", "application/json");
|
||||
m_Connection->SubmitRequest(req, std::bind(ObjectsHttpCompletionCallback, _1, _2, callback));
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), std::vector<ApiObject::Ptr>());
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void ApiClient::ExecuteScript(const String& session, const String& command, bool
|
|||
req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password));
|
||||
req->AddHeader("Accept", "application/json");
|
||||
m_Connection->SubmitRequest(req, std::bind(ExecuteScriptHttpCompletionCallback, _1, _2, callback));
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), Empty);
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ void ApiClient::ExecuteScriptHttpCompletionCallback(HttpRequest& request,
|
|||
}
|
||||
|
||||
callback(boost::exception_ptr(), result);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), Empty);
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void ApiClient::AutocompleteScript(const String& session, const String& command,
|
|||
req->AddHeader("Authorization", "Basic " + Base64::Encode(m_User + ":" + m_Password));
|
||||
req->AddHeader("Accept", "application/json");
|
||||
m_Connection->SubmitRequest(req, std::bind(AutocompleteScriptHttpCompletionCallback, _1, _2, callback));
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ void ApiClient::AutocompleteScriptHttpCompletionCallback(HttpRequest& request,
|
|||
}
|
||||
|
||||
callback(boost::exception_ptr(), suggestions);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(boost::current_exception(), nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
typedef std::function<void(boost::exception_ptr, const Value&)> ExecuteScriptCompletionCallback;
|
||||
void ExecuteScript(const String& session, const String& command, bool sandboxed,
|
||||
const ExecuteScriptCompletionCallback& callback) const;
|
||||
|
||||
|
||||
typedef std::function<void(boost::exception_ptr, const Array::Ptr&)> AutocompleteScriptCompletionCallback;
|
||||
void AutocompleteScript(const String& session, const String& command, bool sandboxed,
|
||||
const AutocompleteScriptCompletionCallback& callback) const;
|
||||
|
|
|
@ -449,7 +449,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
|
|||
|
||||
try {
|
||||
tlsStream->Handshake();
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
Log(LogCritical, "ApiListener")
|
||||
<< "Client TLS handshake failed (" << conninfo << ")";
|
||||
return;
|
||||
|
|
|
@ -91,12 +91,12 @@ public:
|
|||
|
||||
/* filesync */
|
||||
static Value ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
|
||||
/* configsync */
|
||||
static void ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, const Value& cookie);
|
||||
static Value ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
static Value ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
|
||||
static Value HelloAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
static void UpdateObjectAuthority(void);
|
||||
|
|
|
@ -264,7 +264,7 @@ static void AddSuggestions(std::vector<String>& matches, const String& word, con
|
|||
}
|
||||
|
||||
std::vector<String> ConsoleHandler::GetAutocompletionSuggestions(const String& word, ScriptFrame& frame)
|
||||
{
|
||||
{
|
||||
std::vector<String> matches;
|
||||
|
||||
for (const String& keyword : ConfigWriter::GetKeywords()) {
|
||||
|
|
|
@ -271,7 +271,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
|||
provider->FindTargets(type, std::bind(&FilteredAddTarget,
|
||||
std::ref(permissionFrame), permissionFilter,
|
||||
std::ref(frame), ufilter, std::ref(result), variableName, _1));
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
delete ufilter;
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ bool HttpClientConnection::ProcessMessage(void)
|
|||
|
||||
try {
|
||||
res = response.Parse(m_Context, false);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
callback(request, response);
|
||||
|
||||
m_Stream->Shutdown();
|
||||
|
|
|
@ -322,18 +322,17 @@ void JsonRpcConnection::TimeoutTimerHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
int JsonRpcConnection::GetWorkQueueCount(void)
|
||||
size_t JsonRpcConnection::GetWorkQueueCount(void)
|
||||
{
|
||||
return l_JsonRpcConnectionWorkQueueCount;
|
||||
}
|
||||
|
||||
int JsonRpcConnection::GetWorkQueueLength(void)
|
||||
size_t JsonRpcConnection::GetWorkQueueLength(void)
|
||||
{
|
||||
int itemCount = 0;
|
||||
size_t itemCount = 0;
|
||||
|
||||
for (int i = 0; i < GetWorkQueueCount(); i++) {
|
||||
for (size_t i = 0; i < GetWorkQueueCount(); i++)
|
||||
itemCount += l_JsonRpcConnectionWorkQueues[i].GetLength();
|
||||
}
|
||||
|
||||
return itemCount;
|
||||
}
|
||||
|
@ -341,15 +340,14 @@ int JsonRpcConnection::GetWorkQueueLength(void)
|
|||
double JsonRpcConnection::GetWorkQueueRate(void)
|
||||
{
|
||||
double rate = 0.0;
|
||||
int count = GetWorkQueueCount();
|
||||
size_t count = GetWorkQueueCount();
|
||||
|
||||
/* If this is a standalone environment, we don't have any queues. */
|
||||
if (count == 0)
|
||||
return 0.0;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (size_t i = 0; i < count; i++)
|
||||
rate += l_JsonRpcConnectionWorkQueues[i].GetTaskCount(60) / 60.0;
|
||||
}
|
||||
|
||||
return rate / count;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public:
|
|||
static void HeartbeatTimerHandler(void);
|
||||
static Value HeartbeatAPIHandler(const intrusive_ptr<MessageOrigin>& origin, const Dictionary::Ptr& params);
|
||||
|
||||
static int GetWorkQueueCount(void);
|
||||
static int GetWorkQueueLength(void);
|
||||
static size_t GetWorkQueueCount(void);
|
||||
static size_t GetWorkQueueLength(void);
|
||||
static double GetWorkQueueRate(void);
|
||||
|
||||
static void SendCertificateRequest(const JsonRpcConnection::Ptr& aclient, const intrusive_ptr<MessageOrigin>& origin, const String& path);
|
||||
|
|
|
@ -58,7 +58,7 @@ Dictionary::Ptr ObjectQueryHandler::SerializeObjectAttrs(const Object::Ptr& obje
|
|||
ObjectLock olock(attrs);
|
||||
for (const String& attr : attrs) {
|
||||
String userAttr;
|
||||
|
||||
|
||||
if (isJoin) {
|
||||
String::SizeType dpos = attr.FindFirstOf(".");
|
||||
if (dpos == String::NPos)
|
||||
|
|
|
@ -51,7 +51,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
ret = check_drives(vDrives, printInfo.exclude_drives);
|
||||
else
|
||||
ret = check_drives(vDrives, printInfo);
|
||||
|
||||
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
@ -165,7 +165,7 @@ static INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoSt
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vm.count("path"))
|
||||
printInfo.drives = vm["path"].as<std::vector<std::wstring>>();
|
||||
|
||||
|
@ -186,7 +186,7 @@ static INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoSt
|
|||
printInfo.unit = BunitB;
|
||||
}
|
||||
|
||||
printInfo.showUsed = vm.count("show-used");
|
||||
printInfo.showUsed = vm.count("show-used") > 0;
|
||||
|
||||
if (vm.count("debug"))
|
||||
debug = TRUE;
|
||||
|
@ -208,7 +208,7 @@ static INT printOutput(printInfoStruct& printInfo, std::vector<drive>& vDrives)
|
|||
|
||||
if (printInfo.showUsed)
|
||||
output = L"DISK OK - used space:";
|
||||
|
||||
|
||||
double tCap = 0, tFree = 0, tUsed = 0;
|
||||
|
||||
for (std::vector<drive>::iterator it = vDrives.begin(); it != vDrives.end(); it++) {
|
||||
|
@ -249,7 +249,7 @@ static INT printOutput(printInfoStruct& printInfo, std::vector<drive>& vDrives)
|
|||
|
||||
if (state == WARNING) {
|
||||
output = L"DISK WARNING - free space:";
|
||||
|
||||
|
||||
if (printInfo.showUsed)
|
||||
output = L"DISK WARNING - used space:";
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
ret = check_network(vInterfaces);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
||||
return printOutput(printInfo, vInterfaces, mapNames);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vm.count("debug"))
|
||||
debug = TRUE;
|
||||
|
||||
|
@ -249,11 +249,11 @@ INT check_network(std::vector <nInterface>& vInterfaces)
|
|||
err = PdhAddEnglishCounter(phQuery, perfIn, NULL, &phCounterIn);
|
||||
if (!SUCCEEDED(err))
|
||||
goto die;
|
||||
|
||||
|
||||
err = PdhAddEnglishCounter(phQuery, perfOut, NULL, &phCounterOut);
|
||||
if (!SUCCEEDED(err))
|
||||
goto die;
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Collecting first batch of query data" << '\n';
|
||||
|
||||
|
@ -275,13 +275,13 @@ INT check_network(std::vector <nInterface>& vInterfaces)
|
|||
|
||||
if (debug)
|
||||
std::wcout << L"Creating formatted counter arrays" << '\n';
|
||||
|
||||
|
||||
err = PdhGetFormattedCounterArray(phCounterIn, PDH_FMT_LONG, &dwBufferSizeIn, &dwItemCount, pDisplayValuesIn);
|
||||
if (err == PDH_MORE_DATA || SUCCEEDED(err))
|
||||
pDisplayValuesIn = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwItemCount*dwBufferSizeIn]);
|
||||
else
|
||||
goto die;
|
||||
|
||||
|
||||
err = PdhGetFormattedCounterArray(phCounterOut, PDH_FMT_LONG, &dwBufferSizeOut, &dwItemCount, pDisplayValuesOut);
|
||||
if (err == PDH_MORE_DATA || SUCCEEDED(err))
|
||||
pDisplayValuesOut = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwItemCount*dwBufferSizeIn]);
|
||||
|
|
|
@ -146,7 +146,7 @@ static int FormatOutput(const Dictionary::Ptr& result)
|
|||
Dictionary::Ptr payload;
|
||||
try {
|
||||
payload = payloads->Get(0);
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
std::cout << "UNKNOWN: Answer format error: 'payload' was not a Dictionary.\n";
|
||||
return 3;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ static int FormatOutput(const Dictionary::Ptr& result)
|
|||
Dictionary::Ptr line;
|
||||
try {
|
||||
line = vline;
|
||||
} catch (const std::exception& ex) {
|
||||
} catch (const std::exception&) {
|
||||
std::cout << "UNKNOWN: Answer format error: 'lines' entry was not a Dictionary.\n";
|
||||
return 3;
|
||||
}
|
||||
|
|
|
@ -119,9 +119,9 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
wprintf(
|
||||
L"\nIt will take at least timeout times number of pings to run\n"
|
||||
L"Then it will output a string looking something like this:\n\n"
|
||||
L"\tPING WARNING RTA: 72ms Packet loss: 20% | ping=72ms;40;80;71;77 pl=20%;20;50;0;100\n\n"
|
||||
L"\tPING WARNING RTA: 72ms Packet loss: 20%% | ping=72ms;40;80;71;77 pl=20%%;20;50;0;100\n\n"
|
||||
L"\"PING\" being the type of the check, \"WARNING\" the returned status\n"
|
||||
L"and \"RTA: 72ms Packet loss: 20%\" the relevant information.\n"
|
||||
L"and \"RTA: 72ms Packet loss: 20%%\" the relevant information.\n"
|
||||
L"The performance data is found behind the \"|\", in order:\n"
|
||||
L"returned value, warning threshold, critical threshold, minimal value and,\n"
|
||||
L"if applicable, the maximal value. \n\n"
|
||||
|
@ -145,8 +145,8 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
L"Does nothing if the plugin does not accept percentages, or only uses\n"
|
||||
L"percentage thresholds. Ranges can be used with \"%%\", but both range values need\n"
|
||||
L"to end with a percentage sign.\n\n"
|
||||
L"All of these options work with the critical threshold \"-c\" too."
|
||||
, progName);
|
||||
L"All of these options work with the critical threshold \"-c\" too.",
|
||||
progName);
|
||||
std::cout << '\n';
|
||||
return 0;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ INT check_ping6(CONST printInfoStruct& pi, response& response)
|
|||
std::wcout << L"Dropped: echo reply status " << pEchoReply->Status << '\n';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
rtt += pEchoReply->RoundTripTime;
|
||||
|
||||
if (debug)
|
||||
|
|
|
@ -292,7 +292,7 @@ INT countProcs(CONST std::wstring user)
|
|||
DomainName = NULL;
|
||||
dwAcctName = 1;
|
||||
dwDomainName = 1;
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Looking up SID" << '\n';
|
||||
|
||||
|
@ -301,7 +301,7 @@ INT countProcs(CONST std::wstring user)
|
|||
(LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &sidNameUse)
|
||||
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
continue;
|
||||
|
||||
|
||||
AcctName = reinterpret_cast<LPWSTR>(new WCHAR[dwAcctName]);
|
||||
DomainName = reinterpret_cast<LPWSTR>(new WCHAR[dwDomainName]);
|
||||
|
||||
|
@ -316,7 +316,7 @@ INT countProcs(CONST std::wstring user)
|
|||
if (debug)
|
||||
std::wcout << L"Is process of " << wuser << L" (" << numProcs << L")" << '\n';
|
||||
}
|
||||
|
||||
|
||||
delete[] reinterpret_cast<LPWSTR>(AcctName);
|
||||
delete[] reinterpret_cast<LPWSTR>(DomainName);
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
|
||||
if (vm.count("D"))
|
||||
debug = TRUE;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ DWORD ServiceStatus(CONST printInfoStruct& printInfo)
|
|||
{
|
||||
SC_HANDLE hSCM;
|
||||
SC_HANDLE hService;
|
||||
DWORD cbBufSize, lpServicesReturned, pcbBytesNeeded;
|
||||
DWORD cbBufSize;
|
||||
DWORD lpResumeHandle = 0;
|
||||
LPBYTE lpBuf = NULL;
|
||||
|
||||
|
@ -267,7 +267,7 @@ DWORD ServiceStatus(CONST printInfoStruct& printInfo)
|
|||
hService = OpenService(hSCM, printInfo.service.c_str(), SERVICE_QUERY_STATUS);
|
||||
if (hService == NULL)
|
||||
goto die;
|
||||
|
||||
|
||||
QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, NULL, 0, &cbBufSize);
|
||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
goto die;
|
||||
|
|
|
@ -40,7 +40,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
INT ret = parseArguments(argc, argv, vm, printInfo);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
||||
ret = check_update(printInfo);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
|
|
@ -35,7 +35,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
po::variables_map vm;
|
||||
printInfoStruct printInfo = { };
|
||||
INT ret = parseArguments(argc, argv, vm, printInfo);
|
||||
|
||||
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
@ -51,7 +51,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
WCHAR *progName = PathFindFileName(namePath);
|
||||
|
||||
po::options_description desc;
|
||||
|
||||
|
||||
desc.add_options()
|
||||
("help,h", "Print help message and exit")
|
||||
("version,V", "Print version and exit")
|
||||
|
@ -198,7 +198,7 @@ VOID getUptime(printInfoStruct& printInfo)
|
|||
std::wcout << L"Getting uptime in milliseconds" << '\n';
|
||||
|
||||
boost::chrono::milliseconds uptime = boost::chrono::milliseconds(GetTickCount64());
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Converting requested unit (default: seconds)" << '\n';
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ INT check_users(printInfoStruct& printInfo)
|
|||
|
||||
if (debug)
|
||||
std::wcout << L"Trying to enumerate terminal sessions" << '\n';
|
||||
|
||||
|
||||
if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pSessionInfo, &count)) {
|
||||
std::wcout << L"Failed to enumerate terminal sessions" << '\n';
|
||||
die();
|
||||
|
@ -218,7 +218,7 @@ INT check_users(printInfoStruct& printInfo)
|
|||
|
||||
if (!len)
|
||||
continue;
|
||||
|
||||
|
||||
if (pSessionInfo[index].State == WTSActive || pSessionInfo[index].State == WTSDisconnected) {
|
||||
users++;
|
||||
if (debug)
|
||||
|
|
|
@ -122,14 +122,14 @@ std::wstring threshold::pString(CONST DOUBLE max)
|
|||
.append(upperStr).append(L"]");
|
||||
} else
|
||||
s.append(lowerStr);
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
std::wstring removeZero(DOUBLE val)
|
||||
{
|
||||
std::wstring ret = boost::lexical_cast<std::wstring>(val);
|
||||
INT pos = ret.length();
|
||||
std::wstring::size_type pos = ret.length();
|
||||
if (ret.find_first_of(L".") == std::string::npos)
|
||||
return ret;
|
||||
for (std::wstring::reverse_iterator rit = ret.rbegin(); rit != ret.rend(); ++rit) {
|
||||
|
|
|
@ -355,7 +355,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount();" << std::endl
|
||||
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::TypeInstance->GetFieldInfo(id); }" << std::endl;
|
||||
|
||||
if (klass.Fields.size() > 0) {
|
||||
if (!klass.Fields.empty()) {
|
||||
m_Impl << "\t" << "switch (";
|
||||
|
||||
if (!klass.Parent.empty())
|
||||
|
@ -387,7 +387,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||
|
||||
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||
|
||||
if (klass.Fields.size() > 0)
|
||||
if (!klass.Fields.empty())
|
||||
m_Impl << "\t" << "}" << std::endl;
|
||||
|
||||
m_Impl << "}" << std::endl << std::endl;
|
||||
|
@ -437,29 +437,34 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||
m_Impl << "\t" << "int real_id = fieldId - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
||||
<< "\t" << "if (real_id < 0) { " << klass.Parent << "::TypeInstance->RegisterAttributeHandler(fieldId, callback); return; }" << std::endl;
|
||||
|
||||
m_Impl << "\t" << "switch (";
|
||||
if (!klass.Fields.empty()) {
|
||||
m_Impl << "\t" << "switch (";
|
||||
|
||||
if (!klass.Parent.empty())
|
||||
m_Impl << "real_id";
|
||||
else
|
||||
m_Impl << "fieldId";
|
||||
if (!klass.Parent.empty())
|
||||
m_Impl << "real_id";
|
||||
else
|
||||
m_Impl << "fieldId";
|
||||
|
||||
m_Impl << ") {" << std::endl;
|
||||
m_Impl << ") {" << std::endl;
|
||||
|
||||
int num = 0;
|
||||
for (const Field& field : klass.Fields) {
|
||||
m_Impl << "\t\t" << "case " << num << ":" << std::endl
|
||||
<< "\t\t\t" << "ObjectImpl<" << klass.Name << ">::On" << field.GetFriendlyName() << "Changed.connect(callback);" << std::endl
|
||||
<< "\t\t\t" << "break;" << std::endl;
|
||||
num++;
|
||||
int num = 0;
|
||||
for (const Field& field : klass.Fields) {
|
||||
m_Impl << "\t\t" << "case " << num << ":" << std::endl
|
||||
<< "\t\t\t" << "ObjectImpl<" << klass.Name << ">::On" << field.GetFriendlyName() << "Changed.connect(callback);" << std::endl
|
||||
<< "\t\t\t" << "break;" << std::endl;
|
||||
num++;
|
||||
}
|
||||
|
||||
m_Impl << "\t\t" << "default:" << std::endl
|
||||
<< "\t\t";
|
||||
}
|
||||
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||
|
||||
m_Impl << "\t\t" << "default:" << std::endl
|
||||
<< "\t\t\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl
|
||||
<< "\t" << "}" << std::endl;
|
||||
if (!klass.Fields.empty())
|
||||
m_Impl << "\t" << "}" << std::endl;
|
||||
|
||||
m_Impl << "}" << std::endl << std::endl;
|
||||
|
||||
|
||||
m_Header << "};" << std::endl << std::endl;
|
||||
|
||||
m_Header << std::endl;
|
||||
|
@ -749,28 +754,43 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||
m_Impl << "\t" << "int real_id = id - " << klass.Parent << "::TypeInstance->GetFieldCount(); " << std::endl
|
||||
<< "\t" << "if (real_id < 0) { return " << klass.Parent << "::NavigateField(id); }" << std::endl;
|
||||
|
||||
m_Impl << "\t" << "switch (";
|
||||
bool haveNavigationFields = false;
|
||||
|
||||
if (!klass.Parent.empty())
|
||||
m_Impl << "real_id";
|
||||
else
|
||||
m_Impl << "id";
|
||||
|
||||
m_Impl << ") {" << std::endl;
|
||||
|
||||
num = 0;
|
||||
for (const Field& field : klass.Fields) {
|
||||
if (field.Attributes & FANavigation) {
|
||||
m_Impl << "\t\t" << "case " << num << ":" << std::endl
|
||||
<< "\t\t\t" << "return Navigate" << field.GetFriendlyName() << "();" << std::endl;
|
||||
haveNavigationFields = true;
|
||||
break;
|
||||
}
|
||||
|
||||
num++;
|
||||
}
|
||||
|
||||
m_Impl << "\t\t" << "default:" << std::endl
|
||||
<< "\t\t\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl
|
||||
<< "\t" << "}" << std::endl;
|
||||
if (haveNavigationFields) {
|
||||
m_Impl << "\t" << "switch (";
|
||||
|
||||
if (!klass.Parent.empty())
|
||||
m_Impl << "real_id";
|
||||
else
|
||||
m_Impl << "id";
|
||||
|
||||
m_Impl << ") {" << std::endl;
|
||||
|
||||
num = 0;
|
||||
for (const Field& field : klass.Fields) {
|
||||
if (field.Attributes & FANavigation) {
|
||||
m_Impl << "\t\t" << "case " << num << ":" << std::endl
|
||||
<< "\t\t\t" << "return Navigate" << field.GetFriendlyName() << "();" << std::endl;
|
||||
}
|
||||
|
||||
num++;
|
||||
}
|
||||
|
||||
m_Impl << "\t\t" << "default:" << std::endl
|
||||
<< "\t\t";
|
||||
}
|
||||
|
||||
m_Impl << "\t" << "throw std::runtime_error(\"Invalid field ID.\");" << std::endl;
|
||||
|
||||
if (haveNavigationFields)
|
||||
m_Impl << "\t" << "}" << std::endl;
|
||||
|
||||
m_Impl << "}" << std::endl << std::endl;
|
||||
|
||||
|
|
Loading…
Reference in New Issue