diff --git a/Foundation/src/File_UNIX.cpp b/Foundation/src/File_UNIX.cpp index 1379fd9bb..3dda9e317 100644 --- a/Foundation/src/File_UNIX.cpp +++ b/Foundation/src/File_UNIX.cpp @@ -404,12 +404,12 @@ void FileImpl::removeImpl() bool FileImpl::createFileImpl() { - poco_assert (!_path.empty()); - - int n = open(_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - if (n != -1) - { - close(n); + poco_assert (!_path.empty()); + + int n = open(_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + if (n != -1) + { + close(n); return true; } if (n == -1 && errno == EEXIST) @@ -424,11 +424,11 @@ bool FileImpl::createDirectoryImpl() { poco_assert (!_path.empty()); - if (existsImpl() && isDirectoryImpl()) - return false; - if (mkdir(_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) - handleLastErrorImpl(_path); - return true; + if (existsImpl() && isDirectoryImpl()) + return false; + if (mkdir(_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) + handleLastErrorImpl(_path); + return true; } diff --git a/Foundation/src/NumberFormatter.cpp b/Foundation/src/NumberFormatter.cpp index 5feb473e8..37bc7c57d 100644 --- a/Foundation/src/NumberFormatter.cpp +++ b/Foundation/src/NumberFormatter.cpp @@ -41,7 +41,6 @@ #include #endif #include -#include #if defined(_MSC_VER) @@ -361,25 +360,25 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value, int width) void NumberFormatter::append(std::string& str, float value) { - char buffer[64]; - Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); + char buffer[64]; + Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); #if !defined(POCO_NO_LOCALE) - ostr.imbue(std::locale::classic()); + ostr.imbue(std::locale::classic()); #endif - ostr << std::setprecision(8) << value; - str.append(buffer, static_cast(ostr.charsWritten())); + ostr << std::setprecision(8) << value; + str.append(buffer, static_cast(ostr.charsWritten())); } void NumberFormatter::append(std::string& str, double value) { - char buffer[64]; - Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); + char buffer[64]; + Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); #if !defined(POCO_NO_LOCALE) - ostr.imbue(std::locale::classic()); + ostr.imbue(std::locale::classic()); #endif - ostr << std::setprecision(16) << value; - str.append(buffer, static_cast(ostr.charsWritten())); + ostr << std::setprecision(16) << value; + str.append(buffer, static_cast(ostr.charsWritten())); } @@ -387,13 +386,13 @@ void NumberFormatter::append(std::string& str, double value, int precision) { poco_assert (precision >= 0 && precision < 32); - char buffer[64]; - Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); + char buffer[64]; + Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); #if !defined(POCO_NO_LOCALE) - ostr.imbue(std::locale::classic()); + ostr.imbue(std::locale::classic()); #endif - ostr << std::fixed << std::showpoint << std::setprecision(precision) << value; - str.append(buffer, static_cast(ostr.charsWritten())); + ostr << std::fixed << std::showpoint << std::setprecision(precision) << value; + str.append(buffer, static_cast(ostr.charsWritten())); } @@ -401,13 +400,13 @@ void NumberFormatter::append(std::string& str, double value, int width, int prec { poco_assert (width > 0 && width < 64 && precision >= 0 && precision < width); - char buffer[64]; - Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); + char buffer[64]; + Poco::MemoryOutputStream ostr(buffer, sizeof(buffer)); #if !defined(POCO_NO_LOCALE) - ostr.imbue(std::locale::classic()); + ostr.imbue(std::locale::classic()); #endif - ostr << std::fixed << std::showpoint << std::setw(width) << std::setprecision(precision) << value; - str.append(buffer, static_cast(ostr.charsWritten())); + ostr << std::fixed << std::showpoint << std::setw(width) << std::setprecision(precision) << value; + str.append(buffer, static_cast(ostr.charsWritten())); } diff --git a/Foundation/src/NumberParser.cpp b/Foundation/src/NumberParser.cpp index 0405c4756..089f71ad7 100644 --- a/Foundation/src/NumberParser.cpp +++ b/Foundation/src/NumberParser.cpp @@ -38,7 +38,7 @@ #include "Poco/Exception.h" #include "Poco/MemoryStream.h" #include "Poco/String.h" -#ifdef POCO_LOCALE +#if !defined(POCO_NO_LOCALE) #include #endif #include diff --git a/Foundation/src/Process_WINCE.cpp b/Foundation/src/Process_WINCE.cpp index cfb4e5504..1c1ab5f66 100644 --- a/Foundation/src/Process_WINCE.cpp +++ b/Foundation/src/Process_WINCE.cpp @@ -67,9 +67,15 @@ UInt32 ProcessHandleImpl::id() const } +HANDLE ProcessHandleImpl::process() const +{ + return _hProcess; +} + + int ProcessHandleImpl::wait() const { - DWORD rc = WaitForSingleObject(_hProcess, INFINITE); + DWORD rc = WaitForSingleObject(_hProcess, INFINITE); if (rc != WAIT_OBJECT_0) throw SystemException("Wait failed for process", NumberFormatter::format(_pid)); @@ -152,9 +158,20 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg } +void ProcessImpl::killImpl(const ProcessHandleImpl& handle) +{ + if (TerminateProcess(handle.process(), 0) == 0) + { + CloseHandle(handle.process()); + throw SystemException("cannot kill process"); + } + CloseHandle(handle.process()); +} + + void ProcessImpl::killImpl(PIDImpl pid) { - HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid); + HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid); if (hProc) { if (TerminateProcess(hProc, 0) == 0)