VS 2003: Win XP/SP3 compile/tests (Foundation, Net, XML, JSON, UTIL)

This commit is contained in:
Aleksandar Fabijanic 2012-09-10 03:39:50 +00:00
parent 3f23af80c3
commit 0f8264ea55
10 changed files with 192 additions and 42 deletions

View File

@ -384,12 +384,6 @@
<File
RelativePath=".\src\Debugger.cpp">
</File>
<File
RelativePath=".\src\DynamicAny.cpp">
</File>
<File
RelativePath=".\src\DynamicAnyHolder.cpp">
</File>
<File
RelativePath=".\src\Environment.cpp">
</File>
@ -552,6 +546,9 @@
<File
RelativePath=".\src\Exception.cpp">
</File>
<File
RelativePath=".\src\FIFOBufferStream.cpp">
</File>
<File
RelativePath=".\src\Format.cpp">
</File>
@ -844,6 +841,9 @@
<File
RelativePath=".\include\Poco\FIFOBuffer.h">
</File>
<File
RelativePath=".\include\Poco\FIFOBufferStream.h">
</File>
<File
RelativePath=".\include\Poco\Format.h">
</File>
@ -4280,6 +4280,9 @@
<File
RelativePath=".\src\Latin1Encoding.cpp">
</File>
<File
RelativePath=".\src\Latin2Encoding.cpp">
</File>
<File
RelativePath=".\src\Latin9Encoding.cpp">
</File>
@ -4307,12 +4310,21 @@
<File
RelativePath=".\src\UTF16Encoding.cpp">
</File>
<File
RelativePath=".\src\UTF32Encoding.cpp">
</File>
<File
RelativePath=".\src\UTF8Encoding.cpp">
</File>
<File
RelativePath=".\src\UTF8String.cpp">
</File>
<File
RelativePath=".\src\Windows1250Encoding.cpp">
</File>
<File
RelativePath=".\src\Windows1251Encoding.cpp">
</File>
<File
RelativePath=".\src\Windows1252Encoding.cpp">
</File>
@ -4326,6 +4338,9 @@
<File
RelativePath=".\include\Poco\Latin1Encoding.h">
</File>
<File
RelativePath=".\include\Poco\Latin2Encoding.h">
</File>
<File
RelativePath=".\include\Poco\Latin9Encoding.h">
</File>
@ -4353,12 +4368,21 @@
<File
RelativePath=".\include\Poco\UTF16Encoding.h">
</File>
<File
RelativePath=".\include\Poco\UTF32Encoding.h">
</File>
<File
RelativePath=".\include\Poco\UTF8Encoding.h">
</File>
<File
RelativePath=".\include\Poco\UTF8String.h">
</File>
<File
RelativePath=".\include\Poco\Windows1250Encoding.h">
</File>
<File
RelativePath=".\include\Poco\Windows1251Encoding.h">
</File>
<File
RelativePath=".\include\Poco\Windows1252Encoding.h">
</File>
@ -4613,6 +4637,36 @@
</File>
</Filter>
</Filter>
<Filter
Name="Dynamic"
Filter="">
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\Var.cpp">
</File>
<File
RelativePath=".\src\VarHolder.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\poco\dynamic\Pair.h">
</File>
<File
RelativePath=".\include\poco\dynamic\Struct.h">
</File>
<File
RelativePath=".\include\poco\dynamic\Var.h">
</File>
<File
RelativePath=".\include\poco\dynamic\VarHolder.h">
</File>
</Filter>
</Filter>
<File
RelativePath="..\DLLVersion.rc">
<FileConfiguration

View File

@ -5597,6 +5597,10 @@
RelativePath=".\src\UTF16Encoding.cpp"
>
</File>
<File
RelativePath=".\src\UTF32Encoding.cpp"
>
</File>
<File
RelativePath=".\src\UTF8Encoding.cpp"
>
@ -5669,6 +5673,10 @@
RelativePath=".\include\Poco\UTF16Encoding.h"
>
</File>
<File
RelativePath=".\include\poco\UTF32Encoding.h"
>
</File>
<File
RelativePath=".\include\Poco\UTF8Encoding.h"
>

View File

@ -43,9 +43,11 @@
// Define to enable Windows Unicode (UTF-8) support
#define POCO_WIN32_UTF8
// Define to enable C++11 support
//#define POCO_ENABLE_CPP11
// Define to disable implicit linking
// #define POCO_NO_AUTOMATIC_LIBS
@ -110,6 +112,10 @@
// #define POCO_NO_SYSLOGCHANNEL
// Define to enable MSVC secure warnings
// #define POCO_MSVC_SECURE_WARNINGS
// No support for INI file configurations in
// Poco::Util::Application.
// #define POCO_UTIL_NO_INIFILECONFIGURATION

View File

@ -41,6 +41,11 @@
#define Foundation_Platform_WIN32_INCLUDED
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS)
#define _CRT_SECURE_NO_DEPRECATE
#endif
// Verify that we're built with the multithreaded
// versions of the runtime libraries
#if defined(_MSC_VER) && !defined(_MT)
@ -54,20 +59,6 @@
#endif
// Reduce bloat imported by "Poco/UnWindows.h"
#if defined(_WIN32)
// #if !defined(_WIN32_WINNT)
// #define _WIN32_WINNT 0x0501
// #endif
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32)
#define WIN32_LEAN_AND_MEAN
#endif
#endif
#include "Poco/UnWindows.h"
#if !defined(_WIN32_WINNT)
#if defined(_WIN32_WINNT_WIN7)
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
@ -88,11 +79,31 @@
#elif defined (_WIN32_WINNT_WIN2K)
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
#elif defined (WINVER)
#define _WIN32_WINNT WINVER
#else
#define _WIN32_WINNT 0x0500
#endif
#endif
#if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
#define POCO_MSVS_VERSION 2003
#define POCO_MSVC_VERSION 71
#elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ 8.0
#define POCO_MSVS_VERSION 2005
#define POCO_MSVC_VERSION 80
#elif (_MSC_VER >= 1500) && (_MSC_VER < 1600) // Visual Studio 2008, MSVC++ 9.0
#define POCO_MSVS_VERSION 2008
#define POCO_MSVC_VERSION 90
#elif (_MSC_VER >= 1600) && (_MSC_VER < 1700) // Visual Studio 2010, MSVC++ 10.0
#define POCO_MSVS_VERSION 2010
#define POCO_MSVC_VERSION 100
#elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2011, MSVC++ 11.0
#define POCO_MSVS_VERSION 2011
#define POCO_MSVC_VERSION 110
#endif
// Unicode Support
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
@ -103,14 +114,15 @@
// Turn off some annoying warnings
#if defined(_MSC_VER)
#pragma warning(disable:4018) // signed/unsigned comparison
#pragma warning(disable:4251) // ... needs to have dll-interface warning
#pragma warning(disable:4355) // 'this' : used in base member initializer list
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
#pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
#pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
#pragma warning(disable:4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
#pragma warning(disable:4250) // VC++ 11.0: inheriting from std stream classes produces C4250 warning;
// see <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250-warning>
#pragma warning(disable:4251) // ... needs to have dll-interface warning
#pragma warning(disable:4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
#pragma warning(disable:4344) // behavior change: use of explicit template arguments results in call to '...' but '...' is a better match
#pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
#pragma warning(disable:4355) // 'this' : used in base member initializer list
#pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
#endif

View File

@ -54,6 +54,13 @@
// DEALINGS IN THE SOFTWARE.
//
// Reduce bloat
#if defined(_WIN32)
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32)
#define WIN32_LEAN_AND_MEAN
#endif
#endif
#include <windows.h>

View File

@ -400,6 +400,9 @@
<File
RelativePath=".\src\AnyTest.cpp">
</File>
<File
RelativePath=".\src\ArrayTest.cpp">
</File>
<File
RelativePath=".\src\AutoPtrTest.cpp">
</File>
@ -416,10 +419,10 @@
RelativePath=".\src\CoreTestSuite.cpp">
</File>
<File
RelativePath=".\src\DynamicAnyTest.cpp">
RelativePath=".\src\DynamicFactoryTest.cpp">
</File>
<File
RelativePath=".\src\DynamicFactoryTest.cpp">
RelativePath=".\src\FIFOBufferStreamTest.cpp">
</File>
<File
RelativePath=".\src\FormatTest.cpp">
@ -470,6 +473,9 @@
<File
RelativePath=".\src\AnyTest.h">
</File>
<File
RelativePath=".\src\ArrayTest.h">
</File>
<File
RelativePath=".\src\AutoPtrTest.h">
</File>
@ -486,10 +492,10 @@
RelativePath=".\src\CoreTestSuite.h">
</File>
<File
RelativePath=".\src\DynamicAnyTest.h">
RelativePath=".\src\DynamicFactoryTest.h">
</File>
<File
RelativePath=".\src\DynamicFactoryTest.h">
RelativePath=".\src\FIFOBufferStreamTest.h">
</File>
<File
RelativePath=".\src\FormatTest.h">
@ -1386,6 +1392,24 @@
</File>
</Filter>
</Filter>
<Filter
Name="Dynamic"
Filter="">
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\VarTest.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\src\VarTest.h">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>

View File

@ -31,7 +31,7 @@
#if defined(_WIN32)
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#endif

View File

@ -89,6 +89,9 @@
#define POCO_TRY_AGAIN WSATRY_AGAIN
#define POCO_NO_RECOVERY WSANO_RECOVERY
#define POCO_NO_DATA WSANO_DATA
#ifndef ADDRESS_FAMILY
#define ADDRESS_FAMILY USHORT
#endif
#elif defined(POCO_VXWORKS)
#include <hostLib.h>
#include <ifLib.h>

View File

@ -857,13 +857,16 @@ namespace Net {
namespace {
IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr)
IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr, ULONG* pprefix = 0)
/// This function relies on (1) subnet prefix being at the position
/// immediately preceding and (2) broadcast address being at the position
/// immediately succeeding the IPv4 unicast address.
///
/// Since there is no explicit guarantee on order, to ensure correctness,
/// the above constraints are checked prior to returning the result.
/// Additionally, on pre-Vista versions on Windows, the main structure does
/// not contain prefix length; for those platforms, this function
/// returns prefix through pprefix argument.
{
PIP_ADAPTER_PREFIX pPrev = 0;
for (int i = 0; pPrefix; pPrefix = pPrefix->Next, ++i)
@ -876,10 +879,13 @@ IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr)
if (pPrefix && pPrefix->Next && pPrev)
{
IPAddress prefix(pPrev->PrefixLength, IPAddress::IPv4);
IPAddress ipPrefix(pPrev->PrefixLength, IPAddress::IPv4);
IPAddress mask(pPrefix->Next->Address);
if ((prefix & mask) == (prefix & addr))
if ((ipPrefix & mask) == (ipPrefix & addr))
{
if (pprefix) *pprefix = pPrefix->Length;
return IPAddress(pPrefix->Next->Address);
}
}
return IPAddress(IPAddress::IPv4);
@ -931,7 +937,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
ULONG outBufLen = 16384;
Poco::Buffer<UCHAR> memory(outBufLen);
ULONG flags = (GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX);
#if (POCO_OS != POCO_OS_WINDOWS_CE)
#ifdef GAA_FLAG_INCLUDE_ALL_INTERFACES
flags |= GAA_FLAG_INCLUDE_ALL_INTERFACES;
#endif
#if defined(POCO_HAVE_IPv6)
@ -965,11 +971,19 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
unsigned ifIndex = 0;
#if defined(POCO_HAVE_IPv6)
#if defined (IP_ADAPTER_IPV6_ENABLED)
if (pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) ifIndex = pAddress->Ipv6IfIndex;
else
#else
ifIndex = pAddress->Ipv6IfIndex;
#endif
#endif
#if defined (IP_ADAPTER_IPV4_ENABLED)
if (pAddress->Flags & IP_ADAPTER_IPV4_ENABLED) ifIndex = pAddress->IfIndex;
#else
ifIndex = pAddress->IfIndex;
#endif
if (ifIndex == 0) continue;
std::string name;
std::string displayName;
#ifdef POCO_WIN32_UTF8
@ -999,7 +1013,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
ifIt->second.impl().setFlags(pAddress->Flags, pAddress->IfType);
ifIt->second.impl().setMtu(pAddress->Mtu);
ifIt->second.impl().setUp(pAddress->OperStatus == IfOperStatusUp);
#if (_WIN32_WINNT >= 0x0600) // Vista and newer only
ifIt->second.impl().setRunning(pAddress->ReceiveLinkSpeed > 0 || pAddress->TransmitLinkSpeed > 0);
#endif
ifIt->second.impl().setType(fromNative(pAddress->IfType));
if (pAddress->PhysicalAddressLength)
ifIt->second.impl().setMACAddress(pAddress->PhysicalAddress, pAddress->PhysicalAddressLength);
@ -1008,7 +1024,6 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
pUniAddr;
pUniAddr = pUniAddr->Next)
{
UINT8 prefixLength = pUniAddr->OnLinkPrefixLength;
address = IPAddress(pUniAddr->Address);
ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family;
switch (family)
@ -1017,12 +1032,31 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
{
// Windows lists broadcast address on localhost
bool hasBroadcast = (pAddress->IfType == IF_TYPE_ETHERNET_CSMACD) || (pAddress->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
// On Windows, a valid broadcast address will be all 1's (== address | ~subnetMask); we go an extra mile here in order to
// make sure we reflect the actual value held by system and protect against misconfiguration (e.g. bad DHCP config entry)
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
subnetMask = prefixLength ? IPAddress(prefixLength, IPAddress::IPv4) : IPAddress();
if (hasBroadcast)
{
// On Windows, a valid broadcast address will be all 1's (== address | ~subnetMask); additionaly, on pre-Vista versions of
// OS, master address structure does not contain member for prefix length; we go an extra mile here in order to make sure
// we reflect the actual values held by system and protect against misconfiguration (e.g. bad DHCP config entry)
#if (_WIN32_WINNT >= 0x0600) // Vista and newer
UINT8 prefixLength = pUniAddr->OnLinkPrefixLength;
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
#else
ULONG prefixLength = 0;
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
// if previous call did not do it, make last-ditch attempt for prefix and broadcast
if (prefixLength == 0 && pAddress->FirstPrefix)
prefixLength = pAddress->FirstPrefix->Length;
poco_assert (prefixLength <= 32);
if (broadcastAddress.isWildcard())
{
IPAddress mask ((unsigned) prefixLength, IPAddress::IPv4);
IPAddress host(mask & address);
broadcastAddress = host | ~mask;
}
#endif
subnetMask = prefixLength ? IPAddress(prefixLength, IPAddress::IPv4) : IPAddress();
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
}
else
ifIt->second.addAddress(address);
} break;

View File

@ -224,7 +224,9 @@ void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV
{
init(address.af());
}
#ifdef IPV6_V6ONLY)
setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0);
#endif
if (reuseAddress)
{
setReuseAddress(true);