Merge pull request #4 from pocoproject/develop

Upstream refresh 3.1.2015
This commit is contained in:
Marian Krivoš 2015-01-03 10:17:50 +01:00
commit 27e7e5f833
15 changed files with 73 additions and 44 deletions

View File

@ -155,9 +155,7 @@ endif(CMAKE_SYSTEM MATCHES "SunOS")
if (CMAKE_COMPILER_IS_MINGW)
add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8)
add_definitions(-mno-cygwin -D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE -DFoundation_Config_INCLUDED )
link_directories(/usr/local/lib /usr/lib)
include_directories(/usr/local/include /usr/include)
add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE)
endif (CMAKE_COMPILER_IS_MINGW)
if (CYGWIN)

View File

@ -61,7 +61,7 @@ target_version = $(LIBVERSION)
target_libs =
ifeq ($(findstring MinGW, $(POCO_CONFIG)), MinGW)
$(shell cd src; windmc pocomsg.mc)
$(shell cd src; $(WINDMC) pocomsg.mc)
endif
include $(POCO_BASE)/build/rules/lib

View File

@ -148,7 +148,9 @@ protected:
//
GCC_DIAG_OFF(unused-local-typedefs) // supress numerous gcc warnings
#if defined(GNUC) && (GNUC > 4) && (GNUC_MINOR > 6)
GCC_DIAG_OFF(unused-local-typedefs) // supress numerous gcc warnings
#endif // (GNUC) && (GNUC > 4) && (GNUC_MINOR > 6)
template <bool x>

View File

@ -24,6 +24,25 @@
#include <float.h>
#include <math.h>
#ifndef _SW_INEXACT
# define _SW_INEXACT 0x00000001 // inexact (precision)
#endif
#ifndef _SW_UNDERFLOW
# define _SW_UNDERFLOW 0x00000002 // underflow
#endif
#ifndef _SW_OVERFLOW
# define _SW_OVERFLOW 0x00000004 // overflow
#endif
#ifndef _SW_ZERODIVIDE
# define _SW_ZERODIVIDE 0x00000008 // zero divide
#endif
#ifndef _SW_INVALID
# define _SW_INVALID 0x00000010 // invalid
#endif
#ifndef _SW_DENORMAL
# define _SW_DENORMAL 0x00080000 // denormal status bit
#endif
namespace Poco {
@ -33,24 +52,24 @@ class Foundation_API FPEnvironmentImpl
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = RC_DOWN,
FP_ROUND_UPWARD_IMPL = RC_UP,
FP_ROUND_TONEAREST_IMPL = RC_NEAR,
FP_ROUND_TOWARDZERO_IMPL = RC_CHOP
FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
FP_ROUND_UPWARD_IMPL = _RC_UP,
FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
};
enum FlagImpl
{
FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE,
FP_INEXACT_IMPL = SW_INEXACT,
FP_OVERFLOW_IMPL = SW_OVERFLOW,
FP_UNDERFLOW_IMPL = SW_UNDERFLOW,
FP_INVALID_IMPL = SW_INVALID
FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
FP_INEXACT_IMPL = _SW_INEXACT,
FP_OVERFLOW_IMPL = _SW_OVERFLOW,
FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
FP_INVALID_IMPL = _SW_INVALID
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl& env);
~FPEnvironmentImpl();
FPEnvironmentImpl& operator = (const FPEnvironmentImpl& env);
void keepCurrentImpl();
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);

View File

@ -19,6 +19,8 @@
#include <sstream>
#include <cstring>
#include "Poco/UnWindows.h"
#include <winsock2.h>
#include <wincrypt.h>
#include <iphlpapi.h>

View File

@ -21,6 +21,8 @@
#include <sstream>
#include <cstring>
#include "Poco/UnWindows.h"
#include <winsock2.h>
#include <wincrypt.h>
#include <iphlpapi.h>

View File

@ -34,7 +34,7 @@ FPEnvironmentImpl::FPEnvironmentImpl(const FPEnvironmentImpl& env)
FPEnvironmentImpl::~FPEnvironmentImpl()
{
_controlfp(_env, MCW_RC);
_controlfp(_env, _MCW_RC);
}
@ -65,13 +65,13 @@ bool FPEnvironmentImpl::isFlagImpl(FlagImpl flag)
void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode)
{
_controlfp(mode, MCW_RC);
_controlfp(mode, _MCW_RC);
}
FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
{
return RoundingModeImpl(_controlfp(0, 0) & MCW_RC);
return RoundingModeImpl(_controlfp(0, 0) & _MCW_RC);
}

View File

@ -92,7 +92,7 @@ bool FileImpl::existsImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -114,7 +114,7 @@ bool FileImpl::canReadImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -133,7 +133,7 @@ bool FileImpl::canWriteImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_READONLY) == 0;
}
@ -157,7 +157,7 @@ bool FileImpl::isDirectoryImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
@ -190,7 +190,7 @@ bool FileImpl::isHiddenImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributes(_path.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_HIDDEN) != 0;
}
@ -255,7 +255,7 @@ void FileImpl::setSizeImpl(FileSizeImpl size)
FileHandle fh(_path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
LARGE_INTEGER li;
li.QuadPart = size;
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == -1)
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
handleLastErrorImpl(_path);
if (SetEndOfFile(fh.get()) == 0)
handleLastErrorImpl(_path);

View File

@ -96,7 +96,7 @@ bool FileImpl::existsImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -118,7 +118,7 @@ bool FileImpl::canReadImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -137,7 +137,7 @@ bool FileImpl::canWriteImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_READONLY) == 0;
}
@ -161,7 +161,7 @@ bool FileImpl::isDirectoryImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
@ -194,7 +194,7 @@ bool FileImpl::isHiddenImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_HIDDEN) != 0;
}
@ -259,7 +259,7 @@ void FileImpl::setSizeImpl(FileSizeImpl size)
FileHandle fh(_path, _upath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
LARGE_INTEGER li;
li.QuadPart = size;
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == -1)
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
handleLastErrorImpl(_path);
if (SetEndOfFile(fh.get()) == 0)
handleLastErrorImpl(_path);

View File

@ -97,7 +97,7 @@ bool FileImpl::existsImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -119,7 +119,7 @@ bool FileImpl::canReadImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
{
switch (GetLastError())
{
@ -138,7 +138,7 @@ bool FileImpl::canWriteImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_READONLY) == 0;
}
@ -162,7 +162,7 @@ bool FileImpl::isDirectoryImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
@ -185,7 +185,7 @@ bool FileImpl::isHiddenImpl() const
poco_assert (!_path.empty());
DWORD attr = GetFileAttributesW(_upath.c_str());
if (attr == 0xFFFFFFFF)
if (attr == INVALID_FILE_ATTRIBUTES)
handleLastErrorImpl(_path);
return (attr & FILE_ATTRIBUTE_HIDDEN) != 0;
}
@ -250,7 +250,7 @@ void FileImpl::setSizeImpl(FileSizeImpl size)
FileHandle fh(_path, _upath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING);
LARGE_INTEGER li;
li.QuadPart = size;
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == -1)
if (SetFilePointer(fh.get(), li.LowPart, &li.HighPart, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
handleLastErrorImpl(_path);
if (SetEndOfFile(fh.get()) == 0)
handleLastErrorImpl(_path);

View File

@ -585,7 +585,9 @@
<ClCompile Include="src\Driver.cpp">
<Filter>_Driver\Source Files</Filter>
</ClCompile>
<ClCompile Include="src\PBKDF2EngineTest.cpp" />
<ClCompile Include="src\PBKDF2EngineTest.cpp">
<Filter>Crypt\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\AnyTest.h">
@ -990,6 +992,8 @@
<ClInclude Include="src\FIFOBufferStreamTest.h">
<Filter>Streams\Header Files</Filter>
</ClInclude>
<ClInclude Include="src\PBKDF2EngineTest.h" />
<ClInclude Include="src\PBKDF2EngineTest.h">
<Filter>Crypt\Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -69,17 +69,17 @@ int main(int argc, char** argv)
std::string path(uri.getPathAndQuery());
if (path.empty()) path = "/";
std::string username;
std::string password;
Poco::Net::HTTPCredentials::extractCredentials(uri, username, password);
Poco::Net::HTTPCredentials credentials(username, password);
std::string username;
std::string password;
Poco::Net::HTTPCredentials::extractCredentials(uri, username, password);
Poco::Net::HTTPCredentials credentials(username, password);
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest request(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
HTTPResponse response;
if (!doRequest(session, request, response))
{
credentials.authenticate(request, response);
credentials.authenticate(request, response);
if (!doRequest(session, request, response))
{
std::cerr << "Invalid username or password" << std::endl;

View File

@ -30,6 +30,7 @@
#include "Poco/UnicodeConverter.h"
#endif
#include "Poco/Error.h"
#include <wincrypt.h>
#include <iphlpapi.h>
#include <ipifcons.h>
#endif
@ -37,7 +38,6 @@
#include <iostream>
#include <iomanip>
using Poco::NumberFormatter;
using Poco::FastMutex;
using Poco::format;

View File

@ -29,6 +29,7 @@ SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
WINDMC = windmc
#
# Extension for Shared Libraries

View File

@ -31,6 +31,7 @@ SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
WINDMC = $(CROSSENV)-windmc
#
# Extension for Shared Libraries