Skip to content

Commit 8fe3a39

Browse files
committed
Net Windows automatic (un)initialize
automatic network (un)initialization on windows NumericString 64-bit compile/warning fixes
1 parent b38e5bf commit 8fe3a39

23 files changed

Lines changed: 207 additions & 107 deletions

Foundation/include/Poco/NumericString.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ namespace Impl {
221221
/// Class ensures increment/decrement remain within boundaries.
222222
{
223223
public:
224-
Ptr(char* ptr, unsigned offset): _beg(ptr), _cur(ptr), _end(ptr + offset)
224+
Ptr(char* ptr, std::size_t offset): _beg(ptr), _cur(ptr), _end(ptr + offset)
225225
{
226226
}
227227

@@ -268,7 +268,7 @@ namespace Impl {
268268
return _cur;
269269
}
270270

271-
unsigned span() const
271+
std::size_t span() const
272272
{
273273
return _end - _beg;
274274
}
@@ -291,7 +291,7 @@ template <typename T>
291291
bool intToStr(T value,
292292
unsigned short base,
293293
char* result,
294-
unsigned& size,
294+
std::size_t& size,
295295
bool prefix = false,
296296
int width = -1,
297297
char fill = ' ',
@@ -369,7 +369,7 @@ template <typename T>
369369
bool uIntToStr(T value,
370370
unsigned short base,
371371
char* result,
372-
unsigned& size,
372+
std::size_t& size,
373373
bool prefix = false,
374374
int width = -1,
375375
char fill = ' ',
@@ -446,7 +446,7 @@ bool intToStr (T number, unsigned short base, std::string& result, bool prefix =
446446
/// bool intToStr(T, unsigned short, char*, int, int, char, char) implementation.
447447
{
448448
char res[POCO_MAX_INT_STRING_LEN] = {0};
449-
unsigned size = POCO_MAX_INT_STRING_LEN;
449+
std::size_t size = POCO_MAX_INT_STRING_LEN;
450450
bool ret = intToStr(number, base, res, size, prefix, width, fill, thSep);
451451
result.assign(res, size);
452452
return ret;
@@ -459,7 +459,7 @@ bool uIntToStr (T number, unsigned short base, std::string& result, bool prefix
459459
/// bool uIntToStr(T, unsigned short, char*, int, int, char, char) implementation.
460460
{
461461
char res[POCO_MAX_INT_STRING_LEN] = {0};
462-
unsigned size = POCO_MAX_INT_STRING_LEN;
462+
std::size_t size = POCO_MAX_INT_STRING_LEN;
463463
bool ret = uIntToStr(number, base, res, size, prefix, width, fill, thSep);
464464
result.assign(res, size);
465465
return ret;

Foundation/src/NumberFormatter.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ std::string NumberFormatter::format(bool value, BoolFormat format)
7979
void NumberFormatter::append(std::string& str, int value)
8080
{
8181
char result[NF_MAX_INT_STRING_LEN];
82-
unsigned sz = NF_MAX_INT_STRING_LEN;
82+
std::size_t sz = NF_MAX_INT_STRING_LEN;
8383
intToStr(value, 10, result, sz);
8484
str.append(result, sz);
8585
}
@@ -88,7 +88,7 @@ void NumberFormatter::append(std::string& str, int value)
8888
void NumberFormatter::append(std::string& str, int value, int width)
8989
{
9090
char result[NF_MAX_INT_STRING_LEN];
91-
unsigned sz = NF_MAX_INT_STRING_LEN;
91+
std::size_t sz = NF_MAX_INT_STRING_LEN;
9292
intToStr(value, 10, result, sz, false, width);
9393
str.append(result, sz);
9494
}
@@ -97,7 +97,7 @@ void NumberFormatter::append(std::string& str, int value, int width)
9797
void NumberFormatter::append0(std::string& str, int value, int width)
9898
{
9999
char result[NF_MAX_INT_STRING_LEN];
100-
unsigned sz = NF_MAX_INT_STRING_LEN;
100+
std::size_t sz = NF_MAX_INT_STRING_LEN;
101101
intToStr(value, 10, result, sz, false, width, '0');
102102
str.append(result, sz);
103103
}
@@ -106,7 +106,7 @@ void NumberFormatter::append0(std::string& str, int value, int width)
106106
void NumberFormatter::appendHex(std::string& str, int value)
107107
{
108108
char result[NF_MAX_INT_STRING_LEN];
109-
unsigned sz = NF_MAX_INT_STRING_LEN;
109+
std::size_t sz = NF_MAX_INT_STRING_LEN;
110110
uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz);
111111
str.append(result, sz);
112112
}
@@ -115,7 +115,7 @@ void NumberFormatter::appendHex(std::string& str, int value)
115115
void NumberFormatter::appendHex(std::string& str, int value, int width)
116116
{
117117
char result[NF_MAX_INT_STRING_LEN];
118-
unsigned sz = NF_MAX_INT_STRING_LEN;
118+
std::size_t sz = NF_MAX_INT_STRING_LEN;
119119
uIntToStr(static_cast<unsigned int>(value), 0x10, result, sz, false, width, '0');
120120
str.append(result, sz);
121121
}
@@ -124,7 +124,7 @@ void NumberFormatter::appendHex(std::string& str, int value, int width)
124124
void NumberFormatter::append(std::string& str, unsigned value)
125125
{
126126
char result[NF_MAX_INT_STRING_LEN];
127-
unsigned sz = NF_MAX_INT_STRING_LEN;
127+
std::size_t sz = NF_MAX_INT_STRING_LEN;
128128
uIntToStr(value, 10, result, sz);
129129
str.append(result, sz);
130130
}
@@ -133,7 +133,7 @@ void NumberFormatter::append(std::string& str, unsigned value)
133133
void NumberFormatter::append(std::string& str, unsigned value, int width)
134134
{
135135
char result[NF_MAX_INT_STRING_LEN];
136-
unsigned sz = NF_MAX_INT_STRING_LEN;
136+
std::size_t sz = NF_MAX_INT_STRING_LEN;
137137
uIntToStr(value, 10, result, sz, false, width);
138138
str.append(result, sz);
139139
}
@@ -142,7 +142,7 @@ void NumberFormatter::append(std::string& str, unsigned value, int width)
142142
void NumberFormatter::append0(std::string& str, unsigned int value, int width)
143143
{
144144
char result[NF_MAX_INT_STRING_LEN];
145-
unsigned sz = NF_MAX_INT_STRING_LEN;
145+
std::size_t sz = NF_MAX_INT_STRING_LEN;
146146
uIntToStr(value, 10, result, sz, false, width, '0');
147147
str.append(result, sz);
148148
}
@@ -151,7 +151,7 @@ void NumberFormatter::append0(std::string& str, unsigned int value, int width)
151151
void NumberFormatter::appendHex(std::string& str, unsigned value)
152152
{
153153
char result[NF_MAX_INT_STRING_LEN];
154-
unsigned sz = NF_MAX_INT_STRING_LEN;
154+
std::size_t sz = NF_MAX_INT_STRING_LEN;
155155
uIntToStr(value, 0x10, result, sz);
156156
str.append(result, sz);
157157
}
@@ -160,7 +160,7 @@ void NumberFormatter::appendHex(std::string& str, unsigned value)
160160
void NumberFormatter::appendHex(std::string& str, unsigned value, int width)
161161
{
162162
char result[NF_MAX_INT_STRING_LEN];
163-
unsigned sz = NF_MAX_INT_STRING_LEN;
163+
std::size_t sz = NF_MAX_INT_STRING_LEN;
164164
uIntToStr(value, 0x10, result, sz, false, width, '0');
165165
str.append(result, sz);
166166
}
@@ -169,7 +169,7 @@ void NumberFormatter::appendHex(std::string& str, unsigned value, int width)
169169
void NumberFormatter::append(std::string& str, long value)
170170
{
171171
char result[NF_MAX_INT_STRING_LEN];
172-
unsigned sz = NF_MAX_INT_STRING_LEN;
172+
std::size_t sz = NF_MAX_INT_STRING_LEN;
173173
intToStr(value, 10, result, sz);
174174
str.append(result, sz);
175175
}
@@ -178,7 +178,7 @@ void NumberFormatter::append(std::string& str, long value)
178178
void NumberFormatter::append(std::string& str, long value, int width)
179179
{
180180
char result[NF_MAX_INT_STRING_LEN];
181-
unsigned sz = NF_MAX_INT_STRING_LEN;
181+
std::size_t sz = NF_MAX_INT_STRING_LEN;
182182
intToStr(value, 10, result, sz, false, width);
183183
str.append(result, sz);
184184
}
@@ -187,7 +187,7 @@ void NumberFormatter::append(std::string& str, long value, int width)
187187
void NumberFormatter::append0(std::string& str, long value, int width)
188188
{
189189
char result[NF_MAX_INT_STRING_LEN];
190-
unsigned sz = NF_MAX_INT_STRING_LEN;
190+
std::size_t sz = NF_MAX_INT_STRING_LEN;
191191
intToStr(value, 10, result, sz, false, width, '0');
192192
str.append(result, sz);
193193
}
@@ -196,7 +196,7 @@ void NumberFormatter::append0(std::string& str, long value, int width)
196196
void NumberFormatter::appendHex(std::string& str, long value)
197197
{
198198
char result[NF_MAX_INT_STRING_LEN];
199-
unsigned sz = NF_MAX_INT_STRING_LEN;
199+
std::size_t sz = NF_MAX_INT_STRING_LEN;
200200
uIntToStr(static_cast<unsigned long>(value), 0x10, result, sz);
201201
str.append(result, sz);
202202
}
@@ -205,7 +205,7 @@ void NumberFormatter::appendHex(std::string& str, long value)
205205
void NumberFormatter::appendHex(std::string& str, long value, int width)
206206
{
207207
char result[NF_MAX_INT_STRING_LEN];
208-
unsigned sz = NF_MAX_INT_STRING_LEN;
208+
std::size_t sz = NF_MAX_INT_STRING_LEN;
209209
uIntToStr(static_cast<unsigned long>(value), 0x10, result, sz, false, width, '0');
210210
str.append(result, sz);
211211
}
@@ -214,7 +214,7 @@ void NumberFormatter::appendHex(std::string& str, long value, int width)
214214
void NumberFormatter::append(std::string& str, unsigned long value)
215215
{
216216
char result[NF_MAX_INT_STRING_LEN];
217-
unsigned sz = NF_MAX_INT_STRING_LEN;
217+
std::size_t sz = NF_MAX_INT_STRING_LEN;
218218
uIntToStr(value, 10, result, sz);
219219
str.append(result, sz);
220220
}
@@ -223,7 +223,7 @@ void NumberFormatter::append(std::string& str, unsigned long value)
223223
void NumberFormatter::append(std::string& str, unsigned long value, int width)
224224
{
225225
char result[NF_MAX_INT_STRING_LEN];
226-
unsigned sz = NF_MAX_INT_STRING_LEN;
226+
std::size_t sz = NF_MAX_INT_STRING_LEN;
227227
uIntToStr(value, 10, result, sz, false, width, '0');
228228
str.append(result, sz);
229229
}
@@ -232,7 +232,7 @@ void NumberFormatter::append(std::string& str, unsigned long value, int width)
232232
void NumberFormatter::append0(std::string& str, unsigned long value, int width)
233233
{
234234
char result[NF_MAX_INT_STRING_LEN];
235-
unsigned sz = NF_MAX_INT_STRING_LEN;
235+
std::size_t sz = NF_MAX_INT_STRING_LEN;
236236
uIntToStr(value, 10, result, sz, false, width, '0');
237237
str.append(result, sz);
238238
}
@@ -241,7 +241,7 @@ void NumberFormatter::append0(std::string& str, unsigned long value, int width)
241241
void NumberFormatter::appendHex(std::string& str, unsigned long value)
242242
{
243243
char result[NF_MAX_INT_STRING_LEN];
244-
unsigned sz = NF_MAX_INT_STRING_LEN;
244+
std::size_t sz = NF_MAX_INT_STRING_LEN;
245245
uIntToStr(value, 0x10, result, sz);
246246
str.append(result, sz);
247247
}
@@ -250,7 +250,7 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value)
250250
void NumberFormatter::appendHex(std::string& str, unsigned long value, int width)
251251
{
252252
char result[NF_MAX_INT_STRING_LEN];
253-
unsigned sz = NF_MAX_INT_STRING_LEN;
253+
std::size_t sz = NF_MAX_INT_STRING_LEN;
254254
uIntToStr(value, 0x10, result, sz, false, width, '0');
255255
str.append(result, sz);
256256
}
@@ -262,7 +262,7 @@ void NumberFormatter::appendHex(std::string& str, unsigned long value, int width
262262
void NumberFormatter::append(std::string& str, Int64 value)
263263
{
264264
char result[NF_MAX_INT_STRING_LEN];
265-
unsigned sz = NF_MAX_INT_STRING_LEN;
265+
std::size_t sz = NF_MAX_INT_STRING_LEN;
266266
intToStr(value, 10, result, sz);
267267
str.append(result, sz);
268268
}
@@ -271,7 +271,7 @@ void NumberFormatter::append(std::string& str, Int64 value)
271271
void NumberFormatter::append(std::string& str, Int64 value, int width)
272272
{
273273
char result[NF_MAX_INT_STRING_LEN];
274-
unsigned sz = NF_MAX_INT_STRING_LEN;
274+
std::size_t sz = NF_MAX_INT_STRING_LEN;
275275
intToStr(value, 10, result, sz, false, width, '0');
276276
str.append(result, sz);
277277
}
@@ -280,7 +280,7 @@ void NumberFormatter::append(std::string& str, Int64 value, int width)
280280
void NumberFormatter::append0(std::string& str, Int64 value, int width)
281281
{
282282
char result[NF_MAX_INT_STRING_LEN];
283-
unsigned sz = NF_MAX_INT_STRING_LEN;
283+
std::size_t sz = NF_MAX_INT_STRING_LEN;
284284
intToStr(value, 10, result, sz, false, width, '0');
285285
str.append(result, sz);
286286
}
@@ -289,7 +289,7 @@ void NumberFormatter::append0(std::string& str, Int64 value, int width)
289289
void NumberFormatter::appendHex(std::string& str, Int64 value)
290290
{
291291
char result[NF_MAX_INT_STRING_LEN];
292-
unsigned sz = NF_MAX_INT_STRING_LEN;
292+
std::size_t sz = NF_MAX_INT_STRING_LEN;
293293
uIntToStr(static_cast<UInt64>(value), 0x10, result, sz);
294294
str.append(result, sz);
295295
}
@@ -298,7 +298,7 @@ void NumberFormatter::appendHex(std::string& str, Int64 value)
298298
void NumberFormatter::appendHex(std::string& str, Int64 value, int width)
299299
{
300300
char result[NF_MAX_INT_STRING_LEN];
301-
unsigned sz = NF_MAX_INT_STRING_LEN;
301+
std::size_t sz = NF_MAX_INT_STRING_LEN;
302302
uIntToStr(static_cast<UInt64>(value), 0x10, result, sz, false, width, '0');
303303
str.append(result, sz);
304304
}
@@ -307,7 +307,7 @@ void NumberFormatter::appendHex(std::string& str, Int64 value, int width)
307307
void NumberFormatter::append(std::string& str, UInt64 value)
308308
{
309309
char result[NF_MAX_INT_STRING_LEN];
310-
unsigned sz = NF_MAX_INT_STRING_LEN;
310+
std::size_t sz = NF_MAX_INT_STRING_LEN;
311311
uIntToStr(value, 10, result, sz);
312312
str.append(result, sz);
313313
}
@@ -316,7 +316,7 @@ void NumberFormatter::append(std::string& str, UInt64 value)
316316
void NumberFormatter::append(std::string& str, UInt64 value, int width)
317317
{
318318
char result[NF_MAX_INT_STRING_LEN];
319-
unsigned sz = NF_MAX_INT_STRING_LEN;
319+
std::size_t sz = NF_MAX_INT_STRING_LEN;
320320
uIntToStr(value, 10, result, sz, false, width, '0');
321321
str.append(result, sz);
322322
}
@@ -325,7 +325,7 @@ void NumberFormatter::append(std::string& str, UInt64 value, int width)
325325
void NumberFormatter::append0(std::string& str, UInt64 value, int width)
326326
{
327327
char result[NF_MAX_INT_STRING_LEN];
328-
unsigned sz = NF_MAX_INT_STRING_LEN;
328+
std::size_t sz = NF_MAX_INT_STRING_LEN;
329329
uIntToStr(value, 10, result, sz, false, width, '0');
330330
str.append(result, sz);
331331
}
@@ -334,7 +334,7 @@ void NumberFormatter::append0(std::string& str, UInt64 value, int width)
334334
void NumberFormatter::appendHex(std::string& str, UInt64 value)
335335
{
336336
char result[NF_MAX_INT_STRING_LEN];
337-
unsigned sz = NF_MAX_INT_STRING_LEN;
337+
std::size_t sz = NF_MAX_INT_STRING_LEN;
338338
uIntToStr(value, 0x10, result, sz);
339339
str.append(result, sz);
340340
}
@@ -343,7 +343,7 @@ void NumberFormatter::appendHex(std::string& str, UInt64 value)
343343
void NumberFormatter::appendHex(std::string& str, UInt64 value, int width)
344344
{
345345
char result[NF_MAX_INT_STRING_LEN];
346-
unsigned sz = NF_MAX_INT_STRING_LEN;
346+
std::size_t sz = NF_MAX_INT_STRING_LEN;
347347
uIntToStr(value, 0x10, result, sz, false, width, '0');
348348
str.append(result, sz);
349349
}

Foundation/src/NumericString.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ float strToFloat(const char* str)
175175
int flags = StringToDoubleConverter::ALLOW_LEADING_SPACES |
176176
StringToDoubleConverter::ALLOW_TRAILING_SPACES;
177177
StringToDoubleConverter converter(flags, 0.0, Single::NaN(), POCO_FLT_INF, POCO_FLT_NAN);
178-
float result = converter.StringToFloat(str, strlen(str), &processed);
178+
float result = converter.StringToFloat(str, static_cast<int>(strlen(str)), &processed);
179179
return result;
180180
}
181181

@@ -187,7 +187,7 @@ double strToDouble(const char* str)
187187
int flags = StringToDoubleConverter::ALLOW_LEADING_SPACES |
188188
StringToDoubleConverter::ALLOW_TRAILING_SPACES;
189189
StringToDoubleConverter converter(flags, 0.0, Double::NaN(), POCO_FLT_INF, POCO_FLT_NAN);
190-
double result = converter.StringToDouble(str, strlen(str), &processed);
190+
double result = converter.StringToDouble(str, static_cast<int>(strlen(str)), &processed);
191191
return result;
192192
}
193193

Foundation/src/StringTokenizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ StringTokenizer::~StringTokenizer()
8383

8484
void StringTokenizer::trim (std::string& token)
8585
{
86-
int front = 0, back = 0, length = token.length();
86+
std::size_t front = 0, back = 0, length = token.length();
8787
std::string::const_iterator tIt = token.begin();
8888
std::string::const_iterator tEnd = token.end();
8989
for (; tIt != tEnd; ++tIt, ++front)

Net/Net_CE_vs90.vcproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@
457457
RelativePath=".\src\HostEntry.cpp"/>
458458
<File
459459
RelativePath=".\src\IPAddress.cpp"/>
460+
<File
461+
RelativePath=".\src\Net.cpp"/>
460462
<File
461463
RelativePath=".\src\NetException.cpp"/>
462464
<File

Net/Net_vs100.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@
367367
<ClCompile Include="src\DNS.cpp" />
368368
<ClCompile Include="src\HostEntry.cpp" />
369369
<ClCompile Include="src\IPAddress.cpp" />
370+
<ClCompile Include="src\Net.cpp" />
370371
<ClCompile Include="src\NetException.cpp" />
371372
<ClCompile Include="src\NetworkInterface.cpp" />
372373
<ClCompile Include="src\SocketAddress.cpp" />

Net/Net_vs100.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,9 @@
686686
<ClCompile Include="src\WebSocketImpl.cpp">
687687
<Filter>WebSocket\Source Files</Filter>
688688
</ClCompile>
689+
<ClCompile Include="src\Net.cpp">
690+
<Filter>NetCore\Source Files</Filter>
691+
</ClCompile>
689692
</ItemGroup>
690693
<ItemGroup>
691694
<ResourceCompile Include="..\DLLVersion.rc" />

Net/Net_vs110.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@
373373
<ClCompile Include="src\DNS.cpp"/>
374374
<ClCompile Include="src\HostEntry.cpp"/>
375375
<ClCompile Include="src\IPAddress.cpp"/>
376+
<ClCompile Include="src\Net.cpp"/>
376377
<ClCompile Include="src\NetException.cpp"/>
377378
<ClCompile Include="src\NetworkInterface.cpp"/>
378379
<ClCompile Include="src\SocketAddress.cpp"/>

Net/Net_vs110.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@
425425
<ClCompile Include="src\IPAddress.cpp">
426426
<Filter>NetCore\Source Files</Filter>
427427
</ClCompile>
428+
<ClCompile Include="src\Net.cpp">
429+
<Filter>NetCore\Source Files</Filter>
430+
</ClCompile>
428431
<ClCompile Include="src\NetException.cpp">
429432
<Filter>NetCore\Source Files</Filter>
430433
</ClCompile>

0 commit comments

Comments
 (0)