mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-08-07 00:21:48 +02:00
Update POCO to 1.11.0
This commit is contained in:
17
vendor/POCO/Util/include/Poco/Util/Application.h
vendored
17
vendor/POCO/Util/include/Poco/Util/Application.h
vendored
@@ -118,6 +118,12 @@ public:
|
||||
PRIO_SYSTEM = 100
|
||||
};
|
||||
|
||||
struct WindowSize
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
Application();
|
||||
/// Creates the Application.
|
||||
|
||||
@@ -294,6 +300,15 @@ public:
|
||||
/// help information has been encountered and no other things
|
||||
/// besides displaying help shall be done.
|
||||
|
||||
static WindowSize windowSize();
|
||||
/// Returns the current window size of the console window,
|
||||
/// if available.
|
||||
///
|
||||
/// Currently implemented for POSIX platforms (via TIOCGWINSZ ioctl())
|
||||
/// and Windows (GetConsoleScreenBufferInfo()).
|
||||
///
|
||||
/// Returns zero width and height if the window size cannot be determined.
|
||||
|
||||
const char* name() const;
|
||||
|
||||
protected:
|
||||
@@ -489,7 +504,7 @@ inline Poco::Timespan Application::uptime() const
|
||||
//
|
||||
// Macro to implement main()
|
||||
//
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32)
|
||||
#define POCO_APP_MAIN(App) \
|
||||
int wmain(int argc, wchar_t** argv) \
|
||||
{ \
|
||||
|
48
vendor/POCO/Util/src/Application.cpp
vendored
48
vendor/POCO/Util/src/Application.cpp
vendored
@@ -40,6 +40,8 @@
|
||||
#endif
|
||||
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS)
|
||||
#include "Poco/SignalHandler.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
|
||||
@@ -94,12 +96,12 @@ Application::~Application()
|
||||
void Application::setup()
|
||||
{
|
||||
poco_assert (_pInstance == 0);
|
||||
|
||||
|
||||
_pConfig->add(new SystemConfiguration, PRIO_SYSTEM, false);
|
||||
_pConfig->add(new MapConfiguration, PRIO_APPLICATION, true);
|
||||
|
||||
|
||||
addSubsystem(new LoggingSubsystem);
|
||||
|
||||
|
||||
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS)
|
||||
_workingDirAtLaunch = Path::current();
|
||||
|
||||
@@ -186,15 +188,15 @@ void Application::initialize(Application& self)
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Application::uninitialize()
|
||||
{
|
||||
if (_initialized)
|
||||
{
|
||||
for (auto& pSub: _subsystems)
|
||||
for (SubsystemVec::reverse_iterator it = _subsystems.rbegin(); it != _subsystems.rend(); ++it)
|
||||
{
|
||||
_pLogger->debug(std::string("Uninitializing subsystem: ") + pSub->name());
|
||||
pSub->uninitialize();
|
||||
_pLogger->debug(std::string("Uninitializing subsystem: ") + (*it)->name());
|
||||
(*it)->uninitialize();
|
||||
}
|
||||
_initialized = false;
|
||||
}
|
||||
@@ -321,13 +323,37 @@ void Application::stopOptionsProcessing()
|
||||
}
|
||||
|
||||
|
||||
Application::WindowSize Application::windowSize()
|
||||
{
|
||||
WindowSize size{0, 0};
|
||||
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
|
||||
{
|
||||
size.width = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
size.height = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
|
||||
}
|
||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||
struct winsize winsz;
|
||||
if (ioctl(0, TIOCGWINSZ , &winsz) != -1)
|
||||
{
|
||||
size.width = winsz.ws_col;
|
||||
size.height = winsz.ws_row;
|
||||
}
|
||||
#endif
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
int Application::run()
|
||||
{
|
||||
int rc = EXIT_CONFIG;
|
||||
initialize(*this);
|
||||
|
||||
try
|
||||
{
|
||||
initialize(*this);
|
||||
rc = EXIT_SOFTWARE;
|
||||
rc = main(_unprocessedArgs);
|
||||
}
|
||||
@@ -373,7 +399,7 @@ void Application::setArgs(int argc, char* argv[])
|
||||
void Application::setArgs(const ArgVec& args)
|
||||
{
|
||||
poco_assert (!args.empty());
|
||||
|
||||
|
||||
_command = args[0];
|
||||
_pConfig->setInt("application.argc", (int) args.size());
|
||||
_unprocessedArgs = args;
|
||||
@@ -453,7 +479,7 @@ void Application::getApplicationPath(Poco::Path& appPath) const
|
||||
bool Application::findFile(Poco::Path& path) const
|
||||
{
|
||||
if (path.isAbsolute()) return true;
|
||||
|
||||
|
||||
Path appPath;
|
||||
getApplicationPath(appPath);
|
||||
Path base = appPath.parent();
|
||||
@@ -499,7 +525,7 @@ bool Application::findAppConfigFile(const std::string& appName, const std::strin
|
||||
bool Application::findAppConfigFile(const Path& basePath, const std::string& appName, const std::string& extension, Path& path) const
|
||||
{
|
||||
poco_assert (!appName.empty());
|
||||
|
||||
|
||||
Path p(basePath,appName);
|
||||
p.setExtension(extension);
|
||||
bool found = findFile(p);
|
||||
|
3
vendor/POCO/Util/src/ServerApplication.cpp
vendored
3
vendor/POCO/Util/src/ServerApplication.cpp
vendored
@@ -42,6 +42,7 @@
|
||||
#include <cstring>
|
||||
#endif
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#include "Poco/Format.h"
|
||||
|
||||
|
||||
using Poco::NumberFormatter;
|
||||
@@ -334,7 +335,7 @@ bool ServerApplication::hasConsole()
|
||||
void ServerApplication::registerService()
|
||||
{
|
||||
std::string name = config().getString("application.baseName");
|
||||
std::string path = config().getString("application.path");
|
||||
std::string path = Poco::format("\"%s\"", config().getString("application.path"));
|
||||
|
||||
WinService service(name);
|
||||
if (_displayName.empty())
|
||||
|
5
vendor/POCO/Util/src/SystemConfiguration.cpp
vendored
5
vendor/POCO/Util/src/SystemConfiguration.cpp
vendored
@@ -12,6 +12,11 @@
|
||||
//
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
|
||||
#include "Poco/Util/SystemConfiguration.h"
|
||||
#include "Poco/Environment.h"
|
||||
#include "Poco/Path.h"
|
||||
|
2
vendor/POCO/Util/src/WinService.cpp
vendored
2
vendor/POCO/Util/src/WinService.cpp
vendored
@@ -284,7 +284,7 @@ void WinService::setFailureActions(FailureActionVector failureActions, const std
|
||||
}
|
||||
|
||||
ac.dwResetPeriod = 0;
|
||||
ac.cActions = failureActions.size();
|
||||
ac.cActions = static_cast<DWORD>(failureActions.size());
|
||||
ac.lpsaActions = actions;
|
||||
|
||||
if (!ChangeServiceConfig2W(_svcHandle, SERVICE_CONFIG_FAILURE_ACTIONS, &ac))
|
||||
|
@@ -51,7 +51,7 @@ void JSONConfigurationTest::testLoad()
|
||||
{
|
||||
config.load(iss);
|
||||
}
|
||||
catch(JSONException jsone)
|
||||
catch(JSONException& jsone)
|
||||
{
|
||||
std::cout << jsone.message() << std::endl;
|
||||
assertTrue (false);
|
||||
@@ -77,7 +77,7 @@ void JSONConfigurationTest::testLoad()
|
||||
config.getString("propertyUnknown");
|
||||
assertTrue (true);
|
||||
}
|
||||
catch(NotFoundException nfe)
|
||||
catch(NotFoundException& nfe)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ void WinServiceTest::testServiceReturnsFailureActionConfigured()
|
||||
WinService spoolerService{"Spooler"};
|
||||
|
||||
auto failureActions = spoolerService.getFailureActions();
|
||||
assertEqual(3, failureActions.size());
|
||||
assertEqual(3, static_cast<int>(failureActions.size()));
|
||||
|
||||
assertEqual(WinService::SVC_RESTART, failureActions[0]);
|
||||
assertEqual(WinService::SVC_RESTART, failureActions[1]);
|
||||
|
Reference in New Issue
Block a user