Skip to content

Commit 9d47f3c

Browse files
committed
- added GH pocoproject#445: Add flag to force POCO to preserve manually #defined target Windows versions
- fixed SQLite and MySQL broken builds
1 parent b7884c6 commit 9d47f3c

8 files changed

Lines changed: 155 additions & 128 deletions

File tree

‎Data/include/Poco/Data/AbstractBinder.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,17 @@ class Data_API AbstractBinder
247247
virtual void bind(std::size_t pos, const std::list<std::string>& val, Direction dir = PD_IN);
248248
/// Binds a string list.
249249

250-
virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN) = 0;
251-
/// Binds a string.
250+
virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN);
251+
/// Binds a UTF-16 Unicode string.
252252

253253
virtual void bind(std::size_t pos, const std::vector<UTF16String>& val, Direction dir = PD_IN);
254-
/// Binds a string vector.
254+
/// Binds a UTF-16 Unicode string vector.
255255

256256
virtual void bind(std::size_t pos, const std::deque<UTF16String>& val, Direction dir = PD_IN);
257-
/// Binds a string deque.
257+
/// Binds a UTF-16 Unicode string deque.
258258

259259
virtual void bind(std::size_t pos, const std::list<UTF16String>& val, Direction dir = PD_IN);
260-
/// Binds a string list.
260+
/// Binds a UTF-16 Unicode string list.
261261

262262
virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN) = 0;
263263
/// Binds a BLOB.

‎Data/include/Poco/Data/AbstractExtractor.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,17 @@ class Data_API AbstractExtractor
234234
virtual bool extract(std::size_t pos, std::list<std::string>& val);
235235
/// Extracts a string list.
236236

237-
virtual bool extract(std::size_t pos, UTF16String& val) = 0;
238-
/// Extracts a string. Returns false if null was received.
237+
virtual bool extract(std::size_t pos, UTF16String& val);
238+
/// Extracts a UTF16String. Returns false if null was received.
239239

240240
virtual bool extract(std::size_t pos, std::vector<UTF16String>& val);
241-
/// Extracts a string vector.
241+
/// Extracts a UTF16String vector.
242242

243243
virtual bool extract(std::size_t pos, std::deque<UTF16String>& val);
244-
/// Extracts a string deque.
244+
/// Extracts a UTF16String deque.
245245

246246
virtual bool extract(std::size_t pos, std::list<UTF16String>& val);
247-
/// Extracts a string list.
247+
/// Extracts a UTF16String list.
248248

249249
virtual bool extract(std::size_t pos, BLOB& val) = 0;
250250
/// Extracts a BLOB. Returns false if null was received.

‎Data/include/Poco/Data/AbstractPreparator.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,19 +238,19 @@ class Data_API AbstractPreparator
238238
/// Prepares a string deque.
239239

240240
virtual void prepare(std::size_t pos, const std::list<std::string>& val);
241-
/// Prepares a character list.
241+
/// Prepares a character list.
242242

243-
virtual void prepare(std::size_t pos, const UTF16String&) = 0;
244-
/// Prepares a string.
243+
virtual void prepare(std::size_t pos, const UTF16String&);
244+
/// Prepares a UTF16String.
245245

246246
virtual void prepare(std::size_t pos, const std::vector<UTF16String>& val);
247-
/// Prepares a string vector.
247+
/// Prepares a UTF16String vector.
248248

249249
virtual void prepare(std::size_t pos, const std::deque<UTF16String>& val);
250-
/// Prepares a string deque.
250+
/// Prepares a UTF16String deque.
251251

252252
virtual void prepare(std::size_t pos, const std::list<UTF16String>& val);
253-
/// Prepares a string list.
253+
/// Prepares a UTF16String list.
254254

255255
virtual void prepare(std::size_t pos, const BLOB&) = 0;
256256
/// Prepares a BLOB.

‎Data/src/AbstractBinder.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ void AbstractBinder::bind(std::size_t pos, const std::list<std::string>& val, Di
292292
}
293293

294294

295+
void AbstractBinder::bind(std::size_t pos, const UTF16String& val, Direction dir)
296+
{
297+
throw NotImplementedException("UTF16String binder must be implemented.");
298+
}
299+
300+
295301
void AbstractBinder::bind(std::size_t pos, const std::vector<UTF16String>& val, Direction dir)
296302
{
297303
throw NotImplementedException("std::vector binder must be implemented.");

‎Data/src/AbstractExtractor.cpp‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,21 +286,27 @@ bool AbstractExtractor::extract(std::size_t pos, std::list<std::string>& val)
286286
}
287287

288288

289+
bool AbstractExtractor::extract(std::size_t pos, UTF16String& val)
290+
{
291+
throw NotImplementedException("UTF16String extractor must be implemented.");
292+
}
293+
294+
289295
bool AbstractExtractor::extract(std::size_t pos, std::vector<UTF16String>& val)
290296
{
291-
throw NotImplementedException("std::vector extractor must be implemented.");
297+
throw NotImplementedException("std::vector<UTF16String> extractor must be implemented.");
292298
}
293299

294300

295301
bool AbstractExtractor::extract(std::size_t pos, std::deque<UTF16String>& val)
296302
{
297-
throw NotImplementedException("std::deque extractor must be implemented.");
303+
throw NotImplementedException("std::deque<UTF16String> extractor must be implemented.");
298304
}
299305

300306

301307
bool AbstractExtractor::extract(std::size_t pos, std::list<UTF16String>& val)
302308
{
303-
throw NotImplementedException("std::list extractor must be implemented.");
309+
throw NotImplementedException("std::list<UTF16String> extractor must be implemented.");
304310
}
305311

306312

‎Data/src/AbstractPreparator.cpp‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,21 +287,27 @@ void AbstractPreparator::prepare(std::size_t pos, const std::list<std::string>&
287287
}
288288

289289

290+
void AbstractPreparator::prepare(std::size_t pos, const UTF16String& val)
291+
{
292+
throw NotImplementedException("UTF16String preparator must be implemented.");
293+
}
294+
295+
290296
void AbstractPreparator::prepare(std::size_t pos, const std::vector<UTF16String>& val)
291297
{
292-
throw NotImplementedException("std::vector preparator must be implemented.");
298+
throw NotImplementedException("std::vector<UTF16String> preparator must be implemented.");
293299
}
294300

295301

296302
void AbstractPreparator::prepare(std::size_t pos, const std::deque<UTF16String>& val)
297303
{
298-
throw NotImplementedException("std::deque preparator must be implemented.");
304+
throw NotImplementedException("std::deque<UTF16String> preparator must be implemented.");
299305
}
300306

301307

302308
void AbstractPreparator::prepare(std::size_t pos, const std::list<UTF16String>& val)
303309
{
304-
throw NotImplementedException("std::list preparator must be implemented.");
310+
throw NotImplementedException("std::list<UTF16String> preparator must be implemented.");
305311
}
306312

307313

‎Foundation/include/Poco/Platform_WIN32.h‎

Lines changed: 105 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -24,110 +24,111 @@
2424
#include "Poco/UnWindows.h"
2525

2626

27-
// Determine the real version.
28-
// This setting can be forced from UnWindows.h
29-
#if defined (_WIN32_WINNT_WINBLUE)
30-
//Windows 8.1 _WIN32_WINNT_WINBLUE (0x0602)
31-
#ifdef _WIN32_WINNT
32-
#undef _WIN32_WINNT
33-
#endif
34-
#define _WIN32_WINNT _WIN32_WINNT_WINBLUE
35-
#ifdef NTDDI_VERSION
36-
#undef NTDDI_VERSION
37-
#endif
38-
#define NTDDI_VERSION NTDDI_WINBLUE
39-
#elif defined (_WIN32_WINNT_WIN8)
40-
//Windows 8 _WIN32_WINNT_WIN8 (0x0602)
41-
#ifdef _WIN32_WINNT
42-
#undef _WIN32_WINNT
43-
#endif
44-
#define _WIN32_WINNT _WIN32_WINNT_WIN8
45-
#ifdef NTDDI_VERSION
46-
#undef NTDDI_VERSION
47-
#endif
48-
#define NTDDI_VERSION NTDDI_WIN8
49-
#elif defined (_WIN32_WINNT_WIN7)
50-
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
51-
#ifdef _WIN32_WINNT
52-
#undef _WIN32_WINNT
53-
#endif
54-
#define _WIN32_WINNT _WIN32_WINNT_WIN7
55-
#ifdef NTDDI_VERSION
56-
#undef NTDDI_VERSION
57-
#endif
58-
#define NTDDI_VERSION NTDDI_WIN7
59-
#elif defined (_WIN32_WINNT_WS08)
60-
//Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
61-
#ifdef _WIN32_WINNT
62-
#undef _WIN32_WINNT
63-
#endif
64-
#define _WIN32_WINNT _WIN32_WINNT_WS08
65-
#ifdef NTDDI_VERSION
66-
#undef NTDDI_VERSION
67-
#endif
68-
#define NTDDI_VERSION NTDDI_WS08
69-
#elif defined (_WIN32_WINNT_VISTA)
70-
//Windows Vista _WIN32_WINNT_VISTA (0x0600)
71-
#ifdef _WIN32_WINNT
72-
#undef _WIN32_WINNT
73-
#endif
74-
#define _WIN32_WINNT _WIN32_WINNT_VISTA
75-
#ifdef NTDDI_VERSION
76-
#undef NTDDI_VERSION
77-
#endif
78-
#define NTDDI_VERSION NTDDI_VISTA
79-
#elif defined (_WIN32_WINNT_LONGHORN)
80-
//Windows Vista and server 2008 Development _WIN32_WINNT_LONGHORN (0x0600)
81-
#ifdef _WIN32_WINNT
82-
#undef _WIN32_WINNT
83-
#endif
84-
#define _WIN32_WINNT _WIN32_WINNT_LONGHORN
85-
#ifdef NTDDI_VERSION
86-
#undef NTDDI_VERSION
87-
#endif
88-
#define NTDDI_VERSION 0x06000000 // hardcoded, VS90 can't find NTDDI_* macros
89-
#elif defined (_WIN32_WINNT_WS03)
90-
//Windows Server 2003 with SP1,
91-
//Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
92-
#ifdef _WIN32_WINNT
93-
#undef _WIN32_WINNT
94-
#endif
95-
#define _WIN32_WINNT _WIN32_WINNT_WS03
96-
#ifdef NTDDI_VERSION
97-
#undef NTDDI_VERSION
98-
#endif
99-
#define NTDDI_VERSION NTDDI_WS03
100-
#elif defined (_WIN32_WINNT_WINXP)
101-
//Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)
102-
#ifdef _WIN32_WINNT
103-
#undef _WIN32_WINNT
104-
#endif
105-
#define _WIN32_WINNT _WIN32_WINNT_WINXP
106-
#ifdef NTDDI_VERSION
107-
#undef NTDDI_VERSION
108-
#endif
109-
#define NTDDI_VERSION NTDDI_WINXP
110-
#elif defined (_WIN32_WINNT_WIN2K)
111-
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
112-
#ifdef _WIN32_WINNT
113-
#undef _WIN32_WINNT
114-
#endif
115-
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
116-
#elif defined (WINVER)
117-
// fail back on WINVER
118-
#ifdef _WIN32_WINNT
119-
#undef _WIN32_WINNT
120-
#endif
121-
#define _WIN32_WINNT WINVER
122-
#elif !defined(_WIN32_WINNT)
123-
// last resort = Win XP, SP1 is minimum supported
124-
#define _WIN32_WINNT 0x0501
125-
#ifdef NTDDI_VERSION
126-
#undef NTDDI_VERSION
127-
#endif
128-
#define NTDDI_VERSION 0x05010100
129-
#endif
130-
27+
#ifndef POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
28+
// Determine the real version.
29+
// This setting can be forced from UnWindows.h
30+
#if defined (_WIN32_WINNT_WINBLUE)
31+
//Windows 8.1 _WIN32_WINNT_WINBLUE (0x0602)
32+
#ifdef _WIN32_WINNT
33+
#undef _WIN32_WINNT
34+
#endif
35+
#define _WIN32_WINNT _WIN32_WINNT_WINBLUE
36+
#ifdef NTDDI_VERSION
37+
#undef NTDDI_VERSION
38+
#endif
39+
#define NTDDI_VERSION NTDDI_WINBLUE
40+
#elif defined (_WIN32_WINNT_WIN8)
41+
//Windows 8 _WIN32_WINNT_WIN8 (0x0602)
42+
#ifdef _WIN32_WINNT
43+
#undef _WIN32_WINNT
44+
#endif
45+
#define _WIN32_WINNT _WIN32_WINNT_WIN8
46+
#ifdef NTDDI_VERSION
47+
#undef NTDDI_VERSION
48+
#endif
49+
#define NTDDI_VERSION NTDDI_WIN8
50+
#elif defined (_WIN32_WINNT_WIN7)
51+
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
52+
#ifdef _WIN32_WINNT
53+
#undef _WIN32_WINNT
54+
#endif
55+
#define _WIN32_WINNT _WIN32_WINNT_WIN7
56+
#ifdef NTDDI_VERSION
57+
#undef NTDDI_VERSION
58+
#endif
59+
#define NTDDI_VERSION NTDDI_WIN7
60+
#elif defined (_WIN32_WINNT_WS08)
61+
//Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
62+
#ifdef _WIN32_WINNT
63+
#undef _WIN32_WINNT
64+
#endif
65+
#define _WIN32_WINNT _WIN32_WINNT_WS08
66+
#ifdef NTDDI_VERSION
67+
#undef NTDDI_VERSION
68+
#endif
69+
#define NTDDI_VERSION NTDDI_WS08
70+
#elif defined (_WIN32_WINNT_VISTA)
71+
//Windows Vista _WIN32_WINNT_VISTA (0x0600)
72+
#ifdef _WIN32_WINNT
73+
#undef _WIN32_WINNT
74+
#endif
75+
#define _WIN32_WINNT _WIN32_WINNT_VISTA
76+
#ifdef NTDDI_VERSION
77+
#undef NTDDI_VERSION
78+
#endif
79+
#define NTDDI_VERSION NTDDI_VISTA
80+
#elif defined (_WIN32_WINNT_LONGHORN)
81+
//Windows Vista and server 2008 Development _WIN32_WINNT_LONGHORN (0x0600)
82+
#ifdef _WIN32_WINNT
83+
#undef _WIN32_WINNT
84+
#endif
85+
#define _WIN32_WINNT _WIN32_WINNT_LONGHORN
86+
#ifdef NTDDI_VERSION
87+
#undef NTDDI_VERSION
88+
#endif
89+
#define NTDDI_VERSION 0x06000000 // hardcoded, VS90 can't find NTDDI_* macros
90+
#elif defined (_WIN32_WINNT_WS03)
91+
//Windows Server 2003 with SP1,
92+
//Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
93+
#ifdef _WIN32_WINNT
94+
#undef _WIN32_WINNT
95+
#endif
96+
#define _WIN32_WINNT _WIN32_WINNT_WS03
97+
#ifdef NTDDI_VERSION
98+
#undef NTDDI_VERSION
99+
#endif
100+
#define NTDDI_VERSION NTDDI_WS03
101+
#elif defined (_WIN32_WINNT_WINXP)
102+
//Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)
103+
#ifdef _WIN32_WINNT
104+
#undef _WIN32_WINNT
105+
#endif
106+
#define _WIN32_WINNT _WIN32_WINNT_WINXP
107+
#ifdef NTDDI_VERSION
108+
#undef NTDDI_VERSION
109+
#endif
110+
#define NTDDI_VERSION NTDDI_WINXP
111+
#elif defined (_WIN32_WINNT_WIN2K)
112+
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
113+
#ifdef _WIN32_WINNT
114+
#undef _WIN32_WINNT
115+
#endif
116+
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
117+
#elif defined (WINVER)
118+
// fail back on WINVER
119+
#ifdef _WIN32_WINNT
120+
#undef _WIN32_WINNT
121+
#endif
122+
#define _WIN32_WINNT WINVER
123+
#elif !defined(_WIN32_WINNT)
124+
// last resort = Win XP, SP1 is minimum supported
125+
#define _WIN32_WINNT 0x0501
126+
#ifdef NTDDI_VERSION
127+
#undef NTDDI_VERSION
128+
#endif
129+
#define NTDDI_VERSION 0x05010100
130+
#endif
131+
#endif // POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
131132

132133
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && !defined(_CRT_SECURE_NO_DEPRECATE)
133134
#define _CRT_SECURE_NO_DEPRECATE

‎Foundation/include/Poco/UnWindows.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
// the header file that contains the definition for conditional
5858
// definitions.) For more information, see SdkDdkVer.h.
5959

60+
6061
#if defined(_WIN32_WINNT)
6162
#if (_WIN32_WINNT < 0x0501)
6263
#error Unsupported Windows version.
@@ -68,15 +69,22 @@
6869
#elif !defined(_WIN32_WINNT)
6970
// Define minimum supported version.
7071
// This can be changed, if needed.
71-
// Otherwise, the Platform_WIN32.h will do
72-
// its best to determine the appropriate values
72+
// If allowed (see POCO_MIN_WINDOWS_OS_SUPPORT
73+
// below), Platform_WIN32.h will do its
74+
// best to determine the appropriate values
7375
// and may redefine these. See Platform_WIN32.h
7476
// for details.
7577
#define _WIN32_WINNT 0x0501
7678
#define NTDDI_VERSION 0x05010100
7779
#endif
7880

7981

82+
// To prevent Platform_WIN32.h to modify version defines,
83+
// uncomment this, otherwise versions will be automatically
84+
// discovered in Platform_WIN32.h.
85+
// #define POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
86+
87+
8088
#include <windows.h>
8189

8290

0 commit comments

Comments
 (0)