forked from open-eid/libdigidocpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxerces-c-3.1.2_winrt.patch
382 lines (339 loc) · 13.4 KB
/
xerces-c-3.1.2_winrt.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
--- projects/Win32/VC12/xerces-all/XercesLib/XercesLib.vcxproj Tue Mar 10 01:45:53 2015
+++ projects/Win32/VC12/xerces-all/XercesLib/XercesLib.vcxproj Thu Jun 25 13:25:45 2015
@@ -112,6 +112,7 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v120</PlatformToolset>
+ <WindowsAppContainer>true</WindowsAppContainer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -172,7 +173,6 @@
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\..\..\..\..\..\Build\Win64\VC12\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)obj\$(ProjectName)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'">.\..\..\..\..\..\Build\Win32\VC12\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'">$(OutDir)obj\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Static Release|x64'">.\..\..\..\..\..\Build\Win64\VC12\$(Configuration)\</OutDir>
@@ -363,7 +363,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\..\..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN64;_WINDOWS;XERCES_BUILDING_LIBRARY;XERCES_USE_TRANSCODER_WINDOWS;XERCES_USE_WIN32_MSGLOADER;XERCES_USE_NETACCESSOR_WINSOCK;XERCES_USE_FILEMGR_WINDOWS;XERCES_USE_MUTEXMGR_WINDOWS;XERCES_PATH_DELIMITER_BACKSLASH;HAVE_STRICMP;HAVE_STRNICMP;HAVE_LIMITS_H;HAVE_SYS_TIMEB_H;HAVE_FTIME;HAVE_WCSUPR;HAVE_WCSLWR;HAVE_WCSICMP;HAVE_WCSNICMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_CRT_NONSTDC_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_DEBUG;WIN64;_WINDOWS;XERCES_BUILDING_LIBRARY;XERCES_USE_TRANSCODER_WINDOWS;XERCES_USE_WIN32_MSGLOADER;XERCES_USE_NETACCESSOR_WINSOCK;XERCES_USE_FILEMGR_WINDOWS;XERCES_USE_MUTEXMGR_WINDOWS;XERCES_PATH_DELIMITER_BACKSLASH;HAVE_STRICMP;HAVE_STRNICMP;HAVE_LIMITS_H;HAVE_SYS_TIMEB_H;HAVE_FTIME;HAVE_WCSUPR;HAVE_WCSLWR;HAVE_WCSICMP;HAVE_WCSNICMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<PrecompiledHeaderOutputFile>$(IntDir)XercesLib.pch</PrecompiledHeaderOutputFile>
@@ -373,6 +373,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName)_vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -387,7 +388,6 @@
<SubSystem>Windows</SubSystem>
<SetChecksum>false</SetChecksum>
<BaseAddress>0x12000000</BaseAddress>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<ImportLibrary>$(OutDir)xerces-c_3D.lib</ImportLibrary>
@@ -1596,4 +1596,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
--- src/xercesc/util/FileManagers/WindowsFileMgr.cpp Fri Feb 13 22:17:55 2015
+++ src/xercesc/util/FileManagers/WindowsFileMgr.cpp Thu Jun 25 13:30:59 2015
@@ -26,6 +26,8 @@
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
+#include <fstream>
+
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif
@@ -41,10 +43,14 @@
WindowsFileMgr::WindowsFileMgr()
{
// Figure out if we are on NT and save that flag for later use
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
OSVERSIONINFO OSVer;
OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
::GetVersionEx(&OSVer);
_onNT = (OSVer.dwPlatformId == VER_PLATFORM_WIN32_NT);
+#else
+ _onNT = true;
+#endif
}
@@ -138,6 +144,7 @@
nameToOpen = tmpUName;
}
FileHandle retVal = 0;
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
if (_onNT)
{
retVal = ::CreateFileW
@@ -170,6 +177,9 @@
);
manager->deallocate(tmpName);//delete [] tmpName;
}
+#else
+ retVal = new std::fstream(nameToOpen, toWrite ? std::fstream::out : std::fstream::in);
+#endif
if (tmpUName)
manager->deallocate(tmpUName);//delete [] tmpUName;
@@ -193,6 +203,7 @@
FileHandle
WindowsFileMgr::openStdIn(MemoryManager* const manager)
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//
// Get the standard input handle. Duplicate it and return that copy
// since the outside world cannot tell the difference and will shut
@@ -219,6 +230,11 @@
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotDupHandle, manager);
}
return retHandle;
+#else
+ XMLCh stdinStr[] = { chLatin_s, chLatin_t, chLatin_d, chLatin_i, chLatin_n, chNull };
+ ThrowXMLwithMemMgr1(XMLPlatformUtilsException, XMLExcepts::File_CouldNotOpenFile, stdinStr, manager);
+ return 0;
+#endif
}
@@ -228,8 +244,12 @@
if (!f)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
if (!::CloseHandle(f))
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotCloseFile, manager);
+#else
+ delete static_cast<std::fstream*>(f);
+#endif
}
@@ -239,9 +259,13 @@
if (!f)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Seek to the start of the file
if (::SetFilePointer(f, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotResetFile, manager);
+#else
+ static_cast<std::fstream*>(f)->seekg(0);
+#endif
}
@@ -251,6 +275,7 @@
if (!f)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
// Get the current position
LONG high=0;
DWORD low = ::SetFilePointer(f, 0, &high, FILE_CURRENT);
@@ -258,6 +283,9 @@
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
return (((XMLFilePos)high) << 32) | low;
+#else
+ return static_cast<std::fstream*>(f)->tellg();
+#endif
}
@@ -267,6 +295,7 @@
if (!f)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
DWORD high=0;
DWORD low=::GetFileSize(f, &high);
if(low==INVALID_FILE_SIZE && GetLastError()!=NO_ERROR)
@@ -274,6 +303,14 @@
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetCurPos, manager);
return (((XMLFilePos)high) << 32) | low;
+#else
+ std::fstream *s = static_cast<std::fstream*>(f);
+ std::istream::pos_type pos = s->tellg();
+ s->seekg(0, std::istream::end);
+ std::istream::pos_type size = s->tellg();
+ s->seekg(pos);
+ return size;
+#endif
}
@@ -283,6 +320,7 @@
if (!f || !buffer)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
DWORD bytesRead = 0;
if (!::ReadFile(f, buffer, (DWORD)byteCount, &bytesRead, 0))
{
@@ -294,6 +332,11 @@
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotReadFromFile, manager);
}
return (unsigned int)bytesRead;
+#else
+ std::fstream *s = static_cast<std::fstream*>(f);
+ s->read((char*)buffer, byteCount);
+ return s->gcount();
+#endif
}
@@ -303,6 +346,7 @@
if (!f || !buffer)
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::CPtr_PointerIsZero, manager);
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
const XMLByte* tmpFlush = buffer;
while (byteCount > 0)
@@ -314,12 +358,16 @@
tmpFlush+=bytesWritten;
byteCount-=bytesWritten;
}
+#else
+ static_cast<std::fstream*>(f)->write((char*)buffer, byteCount);
+#endif
}
XMLCh*
WindowsFileMgr::getFullPath(const XMLCh* const srcPath, MemoryManager* const manager)
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//
// If we are on NT, then use wide character APIs, else use ASCII APIs.
// We have to do it manually since we are only built in ASCII mode from
@@ -355,12 +403,16 @@
// Return a transcoded copy of the path
return XMLString::transcode(tmpPath, manager);
}
+#else
+ return XMLString::transcode("./", manager);
+#endif
}
XMLCh*
WindowsFileMgr::getCurrentDirectory(MemoryManager* const manager)
{
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//
// If we are on NT, then use wide character APIs, else use ASCII APIs.
// We have to do it manually since we are only built in ASCII mode from
@@ -390,6 +442,9 @@
// Return a transcoded copy of the path
return XMLString::transcode(tmpPath, manager);
}
+#else
+ return XMLString::transcode("./", manager);
+#endif
}
--- src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp Fri Feb 13 22:17:55 2015
+++ src/xercesc/util/MsgLoaders/Win32/Win32MsgLoader.cpp Thu Jun 25 13:31:26 2015
@@ -81,9 +81,10 @@
// build which is built as separate DLLs, so lets look for the DLL
// that we are part of.
//
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
static const char* const privDLLName = "IXUTIL";
fModHandle = ::GetModuleHandleA(privDLLName);
-
+#endif
// If neither exists, then we give up
if (!fModHandle)
{
@@ -130,6 +131,9 @@
// In case we error return, and they don't check it...
toFill[0] = 0;
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ return false;
+#else
// Adjust the message id by the domain offset
const unsigned int theMsgId = msgToLoad + fDomainOfs;
@@ -177,6 +181,7 @@
toFill[actualChars] = 0;
return true;
+#endif
}
--- src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp Fri Feb 13 22:17:56 2015
+++ src/xercesc/util/MutexManagers/WindowsMutexMgr.cpp Thu Jun 25 13:01:41 2015
@@ -40,7 +40,7 @@
WindowsMutexMgr::create(MemoryManager* const manager)
{
CRITICAL_SECTION* newCS=(CRITICAL_SECTION*)manager->allocate(sizeof(CRITICAL_SECTION));
- InitializeCriticalSection(newCS);
+ InitializeCriticalSectionEx(newCS, 0, 0);
return newCS;
}
--- src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp Fri Feb 13 22:17:55 2015
+++ src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp Thu Jun 25 12:55:25 2015
@@ -191,7 +191,8 @@
WSADATA wsaData;
LPFN_WSASTARTUP startup = NULL;
- if(gWinsockLib == NULL)
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ if (gWinsockLib == NULL)
{
#ifdef WITH_IPV6
gWinsockLib = LoadLibraryA("WS2_32");
@@ -247,7 +248,20 @@
}
}
}
-
+#else
+ startup = WSAStartup;
+ gWSACleanup = WSACleanup;
+ gWShtons = htons;
+ gWSsocket = socket;
+ gWSconnect = connect;
+ gWSsend = ::send;
+ gWSrecv = recv;
+ gWSshutdown = shutdown;
+ gWSclosesocket = closesocket;
+ gWSgethostbyname = gethostbyname;
+ gWSgethostbyaddr = gethostbyaddr;
+ gWSinet_addr = inet_addr;
+#endif
wVersionRequested = MAKEWORD( 2, 2 );
int err = (*startup)(wVersionRequested, &wsaData);
--- src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Fri Feb 13 22:17:55 2015
+++ src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Thu Jun 25 13:32:09 2015
@@ -138,6 +138,9 @@
, char* const aliasBuf = 0
, const unsigned int nameBufSz = 0)
{
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ return false;
+#else
unsigned long theType;
unsigned long theSize = nameBufSz;
return (::RegQueryValueExA
@@ -149,6 +152,7 @@
, (unsigned char*)aliasBuf
, &theSize
) == ERROR_SUCCESS);
+#endif
}
// ---------------------------------------------------------------------------
@@ -293,6 +297,9 @@
fCPMap(NULL)
, fManager(manager)
{
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+ onXPOrLater = true;
+#else
// Figure out if we are on XP or later and save that flag for later use.
// We need this because of certain code page conversion calls.
OSVERSIONINFO OSVer;
@@ -519,6 +526,7 @@
// And close the main key handle
::RegCloseKey(charsetKey);
+#endif
}
Win32TransService::~Win32TransService()
@@ -730,8 +738,12 @@
// If we are looking at a leading byte of a multibyte sequence,
// then we are going to eat 2 bytes, else 1.
//
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
unsigned char toEat = ::IsDBCSLeadByteEx(fIECP, *inPtr) ?
2 : 1;
+#else
+ unsigned char toEat = 1;
+#endif
// Make sure a whole char is in the source
if (inPtr + toEat > inEnd)