latest changes from main rep

This commit is contained in:
Guenter Obiltschnig 2007-05-04 11:06:33 +00:00
parent 18dfc99ef4
commit ed4789b844
19 changed files with 113 additions and 113 deletions

View File

@ -1,7 +1,7 @@
// //
// DialogSocket.cpp // DialogSocket.cpp
// //
// $Id: //poco/Main/Net/src/DialogSocket.cpp#9 $ // $Id: //poco/Main/Net/src/DialogSocket.cpp#10 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -35,8 +35,8 @@
#include "Poco/Net/DialogSocket.h" #include "Poco/Net/DialogSocket.h"
#include <string.h> #include <cstring>
#include <ctype.h> #include <cctype>
namespace Poco { namespace Poco {
@ -93,7 +93,7 @@ void DialogSocket::sendByte(unsigned char ch)
void DialogSocket::sendString(const char* str) void DialogSocket::sendString(const char* str)
{ {
sendBytes(str, (int) strlen(str)); sendBytes(str, (int) std::strlen(str));
} }
@ -256,7 +256,7 @@ int DialogSocket::receiveStatusLine(std::string& line)
int ch = get(); int ch = get();
if (ch != EOF_CHAR) line += (char) ch; if (ch != EOF_CHAR) line += (char) ch;
int n = 0; int n = 0;
while (isdigit(ch) && n < 3) while (std::isdigit(ch) && n < 3)
{ {
status *= 10; status *= 10;
status += ch - '0'; status += ch - '0';

View File

@ -1,7 +1,7 @@
// //
// FTPClientSession.cpp // FTPClientSession.cpp
// //
// $Id: //poco/Main/Net/src/FTPClientSession.cpp#7 $ // $Id: //poco/Main/Net/src/FTPClientSession.cpp#8 $
// //
// Library: Net // Library: Net
// Package: FTP // Package: FTP
@ -40,7 +40,7 @@
#include "Poco/Net/ServerSocket.h" #include "Poco/Net/ServerSocket.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include <ctype.h> #include <cctype>
using Poco::NumberFormatter; using Poco::NumberFormatter;
@ -459,19 +459,19 @@ void FTPClientSession::parseAddress(const std::string& str, SocketAddress& addr)
while (it != end && *it != '(') ++it; while (it != end && *it != '(') ++it;
if (it != end) ++it; if (it != end) ++it;
std::string host; std::string host;
while (it != end && isdigit(*it)) host += *it++; while (it != end && std::isdigit(*it)) host += *it++;
if (it != end && *it == ',') { host += '.'; ++it; } if (it != end && *it == ',') { host += '.'; ++it; }
while (it != end && isdigit(*it)) host += *it++; while (it != end && std::isdigit(*it)) host += *it++;
if (it != end && *it == ',') { host += '.'; ++it; } if (it != end && *it == ',') { host += '.'; ++it; }
while (it != end && isdigit(*it)) host += *it++; while (it != end && std::isdigit(*it)) host += *it++;
if (it != end && *it == ',') { host += '.'; ++it; } if (it != end && *it == ',') { host += '.'; ++it; }
while (it != end && isdigit(*it)) host += *it++; while (it != end && std::isdigit(*it)) host += *it++;
if (it != end && *it == ',') ++it; if (it != end && *it == ',') ++it;
Poco::UInt16 portHi = 0; Poco::UInt16 portHi = 0;
while (it != end && isdigit(*it)) { portHi *= 10; portHi += *it++ - '0'; } while (it != end && std::isdigit(*it)) { portHi *= 10; portHi += *it++ - '0'; }
if (it != end && *it == ',') ++it; if (it != end && *it == ',') ++it;
Poco::UInt16 portLo = 0; Poco::UInt16 portLo = 0;
while (it != end && isdigit(*it)) { portLo *= 10; portLo += *it++ - '0'; } while (it != end && std::isdigit(*it)) { portLo *= 10; portLo += *it++ - '0'; }
addr = SocketAddress(host, portHi*256 + portLo); addr = SocketAddress(host, portHi*256 + portLo);
} }
@ -487,7 +487,7 @@ void FTPClientSession::parseExtAddress(const std::string& str, SocketAddress& ad
if (it != end && *it == delim) ++it; if (it != end && *it == delim) ++it;
if (it != end && *it == delim) ++it; if (it != end && *it == delim) ++it;
Poco::UInt16 port = 0; Poco::UInt16 port = 0;
while (it != end && isdigit(*it)) { port *= 10; port += *it++ - '0'; } while (it != end && std::isdigit(*it)) { port *= 10; port += *it++ - '0'; }
addr = SocketAddress(_controlSocket.peerAddress().host(), port); addr = SocketAddress(_controlSocket.peerAddress().host(), port);
} }

View File

@ -1,7 +1,7 @@
// //
// HTMLForm.cpp // HTMLForm.cpp
// //
// $Id: //poco/Main/Net/src/HTMLForm.cpp#16 $ // $Id: //poco/Main/Net/src/HTMLForm.cpp#17 $
// //
// Library: Net // Library: Net
// Package: HTML // Package: HTML
@ -48,7 +48,7 @@
#include "Poco/URI.h" #include "Poco/URI.h"
#include "Poco/String.h" #include "Poco/String.h"
#include <sstream> #include <sstream>
#include <ctype.h> #include <cctype>
using Poco::NullInputStream; using Poco::NullInputStream;

View File

@ -1,7 +1,7 @@
// //
// HTTPChunkedStream.cpp // HTTPChunkedStream.cpp
// //
// $Id: //poco/Main/Net/src/HTTPChunkedStream.cpp#14 $ // $Id: //poco/Main/Net/src/HTTPChunkedStream.cpp#16 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@ -38,7 +38,7 @@
#include "Poco/Net/HTTPSession.h" #include "Poco/Net/HTTPSession.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/NumberParser.h" #include "Poco/NumberParser.h"
#include <ctype.h> #include <cctype>
using Poco::NumberFormatter; using Poco::NumberFormatter;
@ -85,9 +85,9 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
if (_chunk == 0) if (_chunk == 0)
{ {
int ch = _session.get(); int ch = _session.get();
while (isspace(ch)) ch = _session.get(); while (std::isspace(ch)) ch = _session.get();
std::string chunkLen; std::string chunkLen;
while (isxdigit(ch)) { chunkLen += (char) ch; ch = _session.get(); } while (std::isxdigit(ch)) { chunkLen += (char) ch; ch = _session.get(); }
while (ch != eof && ch != '\n') ch = _session.get(); while (ch != eof && ch != '\n') ch = _session.get();
unsigned chunk; unsigned chunk;
if (NumberParser::tryParseHex(chunkLen, chunk)) if (NumberParser::tryParseHex(chunkLen, chunk))

View File

@ -1,7 +1,7 @@
// //
// HTTPRequest.cpp // HTTPRequest.cpp
// //
// $Id: //poco/Main/Net/src/HTTPRequest.cpp#11 $ // $Id: //poco/Main/Net/src/HTTPRequest.cpp#12 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@ -39,7 +39,7 @@
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/Net/NameValueCollection.h" #include "Poco/Net/NameValueCollection.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include <ctype.h> #include <cctype>
using Poco::NumberFormatter; using Poco::NumberFormatter;
@ -174,9 +174,9 @@ void HTTPRequest::getCredentials(std::string& scheme, std::string& authInfo) con
const std::string& auth = get(AUTHORIZATION); const std::string& auth = get(AUTHORIZATION);
std::string::const_iterator it = auth.begin(); std::string::const_iterator it = auth.begin();
std::string::const_iterator end = auth.end(); std::string::const_iterator end = auth.end();
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && !isspace(*it)) scheme += *it++; while (it != end && !std::isspace(*it)) scheme += *it++;
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end) authInfo += *it++; while (it != end) authInfo += *it++;
} }
else throw NotAuthenticatedException(); else throw NotAuthenticatedException();
@ -209,16 +209,16 @@ void HTTPRequest::read(std::istream& istr)
std::string version; std::string version;
int ch = istr.get(); int ch = istr.get();
if (ch == eof) throw NoMessageException(); if (ch == eof) throw NoMessageException();
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
if (ch == eof) throw MessageException("No HTTP request header"); if (ch == eof) throw MessageException("No HTTP request header");
while (!isspace(ch) && ch != eof && method.length() < MAX_METHOD_LENGTH) { method += (char) ch; ch = istr.get(); } while (!std::isspace(ch) && ch != eof && method.length() < MAX_METHOD_LENGTH) { method += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("HTTP request method invalid or too long"); if (!std::isspace(ch)) throw MessageException("HTTP request method invalid or too long");
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
while (!isspace(ch) && ch != eof && uri.length() < MAX_URI_LENGTH) { uri += (char) ch; ch = istr.get(); } while (!std::isspace(ch) && ch != eof && uri.length() < MAX_URI_LENGTH) { uri += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("HTTP request URI invalid or too long"); if (!std::isspace(ch)) throw MessageException("HTTP request URI invalid or too long");
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); } while (!std::isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("Invalid HTTP version string"); if (!std::isspace(ch)) throw MessageException("Invalid HTTP version string");
while (ch != '\n' && ch != eof) { ch = istr.get(); } while (ch != '\n' && ch != eof) { ch = istr.get(); }
HTTPMessage::read(istr); HTTPMessage::read(istr);
ch = istr.get(); ch = istr.get();

View File

@ -1,7 +1,7 @@
// //
// HTTPResponse.cpp // HTTPResponse.cpp
// //
// $Id: //poco/Main/Net/src/HTTPResponse.cpp#11 $ // $Id: //poco/Main/Net/src/HTTPResponse.cpp#12 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@ -42,7 +42,7 @@
#include "Poco/DateTimeFormatter.h" #include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeFormat.h" #include "Poco/DateTimeFormat.h"
#include "Poco/DateTimeParser.h" #include "Poco/DateTimeParser.h"
#include <ctype.h> #include <cctype>
using Poco::DateTime; using Poco::DateTime;
@ -228,16 +228,16 @@ void HTTPResponse::read(std::istream& istr)
int ch = istr.get(); int ch = istr.get();
if (ch == eof) throw NoMessageException(); if (ch == eof) throw NoMessageException();
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
if (ch == eof) throw MessageException("No HTTP response header"); if (ch == eof) throw MessageException("No HTTP response header");
while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); } while (!std::isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("Invalid HTTP version string"); if (!std::isspace(ch)) throw MessageException("Invalid HTTP version string");
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
while (!isspace(ch) && ch != eof && status.length() < MAX_STATUS_LENGTH) { status += (char) ch; ch = istr.get(); } while (!std::isspace(ch) && ch != eof && status.length() < MAX_STATUS_LENGTH) { status += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("Invalid HTTP status code"); if (!std::isspace(ch)) throw MessageException("Invalid HTTP status code");
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
while (ch != '\r' && ch != '\n' && ch != eof && reason.length() < MAX_REASON_LENGTH) { reason += (char) ch; ch = istr.get(); } while (ch != '\r' && ch != '\n' && ch != eof && reason.length() < MAX_REASON_LENGTH) { reason += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("HTTP reason string too long"); if (!std::isspace(ch)) throw MessageException("HTTP reason string too long");
if (ch == '\r') ch = istr.get(); if (ch == '\r') ch = istr.get();
HTTPMessage::read(istr); HTTPMessage::read(istr);

View File

@ -1,7 +1,7 @@
// //
// HTTPSession.cpp // HTTPSession.cpp
// //
// $Id: //poco/Main/Net/src/HTTPSession.cpp#12 $ // $Id: //poco/Main/Net/src/HTTPSession.cpp#13 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@ -37,7 +37,7 @@
#include "Poco/Net/HTTPSession.h" #include "Poco/Net/HTTPSession.h"
#include "Poco/Net/HTTPBufferAllocator.h" #include "Poco/Net/HTTPBufferAllocator.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include <string.h> #include <cstring>
using Poco::TimeoutException; using Poco::TimeoutException;
@ -132,7 +132,7 @@ int HTTPSession::read(char* buffer, std::streamsize length)
{ {
int n = (int) (_pEnd - _pCurrent); int n = (int) (_pEnd - _pCurrent);
if (n > length) n = (int) length; if (n > length) n = (int) length;
memcpy(buffer, _pCurrent, n); std::memcpy(buffer, _pCurrent, n);
_pCurrent += n; _pCurrent += n;
return n; return n;
} }

View File

@ -1,7 +1,7 @@
// //
// IPAddress.cpp // IPAddress.cpp
// //
// $Id: //poco/Main/Net/src/IPAddress.cpp#15 $ // $Id: //poco/Main/Net/src/IPAddress.cpp#16 $
// //
// Library: Net // Library: Net
// Package: NetCore // Package: NetCore
@ -40,7 +40,7 @@
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/Types.h" #include "Poco/Types.h"
#include <algorithm> #include <algorithm>
#include <string.h> #include <cstring>
using Poco::RefCountedObject; using Poco::RefCountedObject;
@ -103,12 +103,12 @@ class IPv4AddressImpl: public IPAddressImpl
public: public:
IPv4AddressImpl() IPv4AddressImpl()
{ {
memset(&_addr, 0, sizeof(_addr)); std::memset(&_addr, 0, sizeof(_addr));
} }
IPv4AddressImpl(const void* addr) IPv4AddressImpl(const void* addr)
{ {
memcpy(&_addr, addr, sizeof(_addr)); std::memcpy(&_addr, addr, sizeof(_addr));
} }
std::string toString() const std::string toString() const
@ -260,12 +260,12 @@ class IPv6AddressImpl: public IPAddressImpl
public: public:
IPv6AddressImpl() IPv6AddressImpl()
{ {
memset(&_addr, 0, sizeof(_addr)); std::memset(&_addr, 0, sizeof(_addr));
} }
IPv6AddressImpl(const void* addr) IPv6AddressImpl(const void* addr)
{ {
memcpy(&_addr, addr, sizeof(_addr)); std::memcpy(&_addr, addr, sizeof(_addr));
} }
std::string toString() const std::string toString() const
@ -426,7 +426,7 @@ public:
#if defined(_WIN32) #if defined(_WIN32)
struct addrinfo* pAI; struct addrinfo* pAI;
struct addrinfo hints; struct addrinfo hints;
memset(&hints, 0, sizeof(hints)); std::memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST; hints.ai_flags = AI_NUMERICHOST;
int rc = getaddrinfo(addr.c_str(), NULL, &hints, &pAI); int rc = getaddrinfo(addr.c_str(), NULL, &hints, &pAI);
if (rc == 0) if (rc == 0)
@ -651,7 +651,7 @@ bool IPAddress::operator == (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) == 0; return std::memcmp(addr(), a.addr(), l1) == 0;
else else
return false; return false;
} }
@ -662,7 +662,7 @@ bool IPAddress::operator != (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) != 0; return std::memcmp(addr(), a.addr(), l1) != 0;
else else
return true; return true;
} }
@ -673,7 +673,7 @@ bool IPAddress::operator < (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) < 0; return std::memcmp(addr(), a.addr(), l1) < 0;
else else
return l1 < l2; return l1 < l2;
} }
@ -684,7 +684,7 @@ bool IPAddress::operator <= (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) <= 0; return std::memcmp(addr(), a.addr(), l1) <= 0;
else else
return l1 < l2; return l1 < l2;
} }
@ -695,7 +695,7 @@ bool IPAddress::operator > (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) > 0; return std::memcmp(addr(), a.addr(), l1) > 0;
else else
return l1 > l2; return l1 > l2;
} }
@ -706,7 +706,7 @@ bool IPAddress::operator >= (const IPAddress& a) const
poco_socklen_t l1 = length(); poco_socklen_t l1 = length();
poco_socklen_t l2 = a.length(); poco_socklen_t l2 = a.length();
if (l1 == l2) if (l1 == l2)
return memcmp(addr(), a.addr(), l1) >= 0; return std::memcmp(addr(), a.addr(), l1) >= 0;
else else
return l1 > l2; return l1 > l2;
} }

View File

@ -1,7 +1,7 @@
// //
// MailMessage.cpp // MailMessage.cpp
// //
// $Id: //poco/Main/Net/src/MailMessage.cpp#9 $ // $Id: //poco/Main/Net/src/MailMessage.cpp#10 $
// //
// Library: Net // Library: Net
// Package: Mail // Package: Mail
@ -50,7 +50,7 @@
#include "Poco/DateTimeParser.h" #include "Poco/DateTimeParser.h"
#include "Poco/String.h" #include "Poco/String.h"
#include <sstream> #include <sstream>
#include <ctype.h> #include <cctype>
using Poco::Base64Encoder; using Poco::Base64Encoder;

View File

@ -1,7 +1,7 @@
// //
// MediaType.cpp // MediaType.cpp
// //
// $Id: //poco/Main/Net/src/MediaType.cpp#7 $ // $Id: //poco/Main/Net/src/MediaType.cpp#8 $
// //
// Library: Net // Library: Net
// Package: Messages // Package: Messages
@ -38,7 +38,7 @@
#include "Poco/Net/MessageHeader.h" #include "Poco/Net/MessageHeader.h"
#include "Poco/String.h" #include "Poco/String.h"
#include <algorithm> #include <algorithm>
#include <ctype.h> #include <cctype>
using Poco::icompare; using Poco::icompare;
@ -179,10 +179,10 @@ void MediaType::parse(const std::string& mediaType)
_parameters.clear(); _parameters.clear();
std::string::const_iterator it = mediaType.begin(); std::string::const_iterator it = mediaType.begin();
std::string::const_iterator end = mediaType.end(); std::string::const_iterator end = mediaType.end();
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && *it != '/') _type += *it++; while (it != end && *it != '/') _type += *it++;
if (it != end) ++it; if (it != end) ++it;
while (it != end && *it != ';' && !isspace(*it)) _subType += *it++; while (it != end && *it != ';' && !std::isspace(*it)) _subType += *it++;
while (it != end && *it != ';') ++it; while (it != end && *it != ';') ++it;
MessageHeader::splitParameters(it, end, _parameters); MessageHeader::splitParameters(it, end, _parameters);
} }

View File

@ -1,7 +1,7 @@
// //
// MessageHeader.cpp // MessageHeader.cpp
// //
// $Id: //poco/Main/Net/src/MessageHeader.cpp#11 $ // $Id: //poco/Main/Net/src/MessageHeader.cpp#12 $
// //
// Library: Net // Library: Net
// Package: Messages // Package: Messages
@ -37,7 +37,7 @@
#include "Poco/Net/MessageHeader.h" #include "Poco/Net/MessageHeader.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/String.h" #include "Poco/String.h"
#include <ctype.h> #include <cctype>
namespace Poco { namespace Poco {
@ -90,7 +90,7 @@ void MessageHeader::read(std::istream& istr)
if (ch == '\n') { ch = istr.get(); continue; } // ignore invalid header lines if (ch == '\n') { ch = istr.get(); continue; } // ignore invalid header lines
if (ch != ':') throw MessageException("Field name too long/no colon found"); if (ch != ':') throw MessageException("Field name too long/no colon found");
if (ch != eof) ch = istr.get(); // ':' if (ch != eof) ch = istr.get(); // ':'
while (isspace(ch)) ch = istr.get(); while (std::isspace(ch)) ch = istr.get();
while (ch != eof && ch != '\r' && ch != '\n' && value.length() < MAX_VALUE_LENGTH) { value += ch; ch = istr.get(); } while (ch != eof && ch != '\r' && ch != '\n' && value.length() < MAX_VALUE_LENGTH) { value += ch; ch = istr.get(); }
if (ch == '\r') ch = istr.get(); if (ch == '\r') ch = istr.get();
if (ch == '\n') if (ch == '\n')
@ -164,7 +164,7 @@ void MessageHeader::splitParameters(const std::string& s, std::string& value, Na
parameters.clear(); parameters.clear();
std::string::const_iterator it = s.begin(); std::string::const_iterator it = s.begin();
std::string::const_iterator end = s.end(); std::string::const_iterator end = s.end();
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && *it != ';') value += *it++; while (it != end && *it != ';') value += *it++;
Poco::trimRightInPlace(value); Poco::trimRightInPlace(value);
if (it != end) ++it; if (it != end) ++it;
@ -179,11 +179,11 @@ void MessageHeader::splitParameters(const std::string::const_iterator& begin, co
{ {
std::string pname; std::string pname;
std::string pvalue; std::string pvalue;
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && *it != '=' && *it != ';') pname += *it++; while (it != end && *it != '=' && *it != ';') pname += *it++;
Poco::trimRightInPlace(pname); Poco::trimRightInPlace(pname);
if (it != end && *it != ';') ++it; if (it != end && *it != ';') ++it;
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && *it != ';') while (it != end && *it != ';')
{ {
if (*it == '"') if (*it == '"')
@ -219,7 +219,7 @@ void MessageHeader::quote(const std::string& value, std::string& result, bool al
bool mustQuote = false; bool mustQuote = false;
for (std::string::const_iterator it = value.begin(); !mustQuote && it != value.end(); ++it) for (std::string::const_iterator it = value.begin(); !mustQuote && it != value.end(); ++it)
{ {
if (!isalnum(*it) && *it != '.' && *it != '_' && *it != '-' && !(isspace(*it) && allowSpace)) if (!std::isalnum(*it) && *it != '.' && *it != '_' && *it != '-' && !(std::isspace(*it) && allowSpace))
mustQuote = true; mustQuote = true;
} }
if (mustQuote) result += '"'; if (mustQuote) result += '"';

View File

@ -1,7 +1,7 @@
// //
// MulticastSocket.cpp // MulticastSocket.cpp
// //
// $Id: //poco/Main/Net/src/MulticastSocket.cpp#10 $ // $Id: //poco/Main/Net/src/MulticastSocket.cpp#11 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -36,7 +36,7 @@
#include "Poco/Net/MulticastSocket.h" #include "Poco/Net/MulticastSocket.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include <string.h> #include <cstring>
#if defined(hpux) && defined(_XOPEN_SOURCE_EXTENDED) #if defined(hpux) && defined(_XOPEN_SOURCE_EXTENDED)
@ -214,15 +214,15 @@ void MulticastSocket::joinGroup(const IPAddress& groupAddress, const NetworkInte
if (groupAddress.af() == AF_INET) if (groupAddress.af() == AF_INET)
{ {
struct ip_mreq mr; struct ip_mreq mr;
memcpy(&mr.imr_multiaddr, groupAddress.addr(), groupAddress.length()); std::memcpy(&mr.imr_multiaddr, groupAddress.addr(), groupAddress.length());
memcpy(&mr.imr_interface, interface.address().addr(), interface.address().length()); std::memcpy(&mr.imr_interface, interface.address().addr(), interface.address().length());
impl()->setRawOption(IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr, sizeof(mr)); impl()->setRawOption(IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr, sizeof(mr));
} }
else else
{ {
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
struct ipv6_mreq mr; struct ipv6_mreq mr;
memcpy(&mr.ipv6mr_multiaddr, groupAddress.addr(), groupAddress.length()); std::memcpy(&mr.ipv6mr_multiaddr, groupAddress.addr(), groupAddress.length());
mr.ipv6mr_interface = interface.index(); mr.ipv6mr_interface = interface.index();
impl()->setRawOption(IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mr, sizeof(mr)); impl()->setRawOption(IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mr, sizeof(mr));
#endif #endif
@ -242,15 +242,15 @@ void MulticastSocket::leaveGroup(const IPAddress& groupAddress, const NetworkInt
if (groupAddress.af() == AF_INET) if (groupAddress.af() == AF_INET)
{ {
struct ip_mreq mr; struct ip_mreq mr;
memcpy(&mr.imr_multiaddr, groupAddress.addr(), groupAddress.length()); std::memcpy(&mr.imr_multiaddr, groupAddress.addr(), groupAddress.length());
memcpy(&mr.imr_interface, interface.address().addr(), interface.address().length()); std::memcpy(&mr.imr_interface, interface.address().addr(), interface.address().length());
impl()->setRawOption(IPPROTO_IP, IP_DROP_MEMBERSHIP, &mr, sizeof(mr)); impl()->setRawOption(IPPROTO_IP, IP_DROP_MEMBERSHIP, &mr, sizeof(mr));
} }
else else
{ {
#if defined(POCO_HAVE_IPv6) #if defined(POCO_HAVE_IPv6)
struct ipv6_mreq mr; struct ipv6_mreq mr;
memcpy(&mr.ipv6mr_multiaddr, groupAddress.addr(), groupAddress.length()); std::memcpy(&mr.ipv6mr_multiaddr, groupAddress.addr(), groupAddress.length());
mr.ipv6mr_interface = interface.index(); mr.ipv6mr_interface = interface.index();
impl()->setRawOption(IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mr, sizeof(mr)); impl()->setRawOption(IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mr, sizeof(mr));
#endif #endif

View File

@ -1,7 +1,7 @@
// //
// MultipartReader.cpp // MultipartReader.cpp
// //
// $Id: //poco/Main/Net/src/MultipartReader.cpp#10 $ // $Id: //poco/Main/Net/src/MultipartReader.cpp#11 $
// //
// Library: Net // Library: Net
// Package: Messages // Package: Messages
@ -37,7 +37,7 @@
#include "Poco/Net/MultipartReader.h" #include "Poco/Net/MultipartReader.h"
#include "Poco/Net/MessageHeader.h" #include "Poco/Net/MessageHeader.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include <ctype.h> #include <cctype>
using Poco::BufferedStreamBuf; using Poco::BufferedStreamBuf;
@ -267,7 +267,7 @@ void MultipartReader::guessBoundary()
{ {
static const int eof = std::char_traits<char>::eof(); static const int eof = std::char_traits<char>::eof();
int ch = _istr.get(); int ch = _istr.get();
while (isspace(ch)) while (std::isspace(ch))
ch = _istr.get(); ch = _istr.get();
if (ch == '-' && _istr.peek() == '-') if (ch == '-' && _istr.peek() == '-')
{ {

View File

@ -1,7 +1,7 @@
// //
// NetworkInterface.cpp // NetworkInterface.cpp
// //
// $Id: //poco/Main/Net/src/NetworkInterface.cpp#18 $ // $Id: //poco/Main/Net/src/NetworkInterface.cpp#20 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -39,7 +39,7 @@
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/RefCountedObject.h" #include "Poco/RefCountedObject.h"
#include <string.h> #include <cstring>
using Poco::NumberFormatter; using Poco::NumberFormatter;
@ -95,7 +95,7 @@ NetworkInterfaceImpl::NetworkInterfaceImpl(const std::string& name, const IPAddr
if (index == -1) // IPv4 if (index == -1) // IPv4
{ {
struct ifreq ifr; struct ifreq ifr;
strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ); std::strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ);
DatagramSocket ds(IPAddress::IPv4); DatagramSocket ds(IPAddress::IPv4);
ds.impl()->ioctl(SIOCGIFNETMASK, &ifr); ds.impl()->ioctl(SIOCGIFNETMASK, &ifr);
if (ifr.ifr_addr.sa_family == AF_INET) if (ifr.ifr_addr.sa_family == AF_INET)
@ -273,7 +273,7 @@ NetworkInterface NetworkInterface::forName(const std::string& name, bool require
FastMutex::ScopedLock lock(_mutex); FastMutex::ScopedLock lock(_mutex);
struct ifreq ifr; struct ifreq ifr;
strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ); std::strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ);
DatagramSocket ds(requireIPv6 ? IPAddress::IPv6 : IPAddress::IPv4); DatagramSocket ds(requireIPv6 ? IPAddress::IPv6 : IPAddress::IPv4);
ds.impl()->ioctl(SIOCGIFADDR, &ifr); ds.impl()->ioctl(SIOCGIFADDR, &ifr);
IPAddress addr; IPAddress addr;

View File

@ -1,7 +1,7 @@
// //
// POP3ClientSession.cpp // POP3ClientSession.cpp
// //
// $Id: //poco/Main/Net/src/POP3ClientSession.cpp#7 $ // $Id: //poco/Main/Net/src/POP3ClientSession.cpp#8 $
// //
// Library: Net // Library: Net
// Package: Mail // Package: Mail
@ -43,7 +43,7 @@
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/UnbufferedStreamBuf.h" #include "Poco/UnbufferedStreamBuf.h"
#include <istream> #include <istream>
#include <ctype.h> #include <cctype>
using Poco::NumberFormatter; using Poco::NumberFormatter;
@ -184,9 +184,9 @@ int POP3ClientSession::messageCount()
std::string::const_iterator it = response.begin(); std::string::const_iterator it = response.begin();
std::string::const_iterator end = response.end(); std::string::const_iterator end = response.end();
int count = 0; int count = 0;
while (it != end && !isspace(*it)) ++it; while (it != end && !std::isspace(*it)) ++it;
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && isdigit(*it)) count = count*10 + *it++ - '0'; while (it != end && std::isdigit(*it)) count = count*10 + *it++ - '0';
return count; return count;
} }
@ -203,9 +203,9 @@ void POP3ClientSession::listMessages(MessageInfoVec& messages)
MessageInfo info = {0, 0}; MessageInfo info = {0, 0};
std::string::const_iterator it = response.begin(); std::string::const_iterator it = response.begin();
std::string::const_iterator end = response.end(); std::string::const_iterator end = response.end();
while (it != end && isdigit(*it)) info.id = info.id*10 + *it++ - '0'; while (it != end && std::isdigit(*it)) info.id = info.id*10 + *it++ - '0';
while (it != end && isspace(*it)) ++it; while (it != end && std::isspace(*it)) ++it;
while (it != end && isdigit(*it)) info.size = info.size*10 + *it++ - '0'; while (it != end && std::isdigit(*it)) info.size = info.size*10 + *it++ - '0';
messages.push_back(info); messages.push_back(info);
_socket.receiveMessage(response); _socket.receiveMessage(response);
} }

View File

@ -1,7 +1,7 @@
// //
// QuotedPrintableDecoder.cpp // QuotedPrintableDecoder.cpp
// //
// $Id: //poco/Main/Net/src/QuotedPrintableDecoder.cpp#8 $ // $Id: //poco/Main/Net/src/QuotedPrintableDecoder.cpp#10 $
// //
// Library: Net // Library: Net
// Package: Messages // Package: Messages
@ -37,7 +37,7 @@
#include "Poco/Net/QuotedPrintableDecoder.h" #include "Poco/Net/QuotedPrintableDecoder.h"
#include "Poco/NumberParser.h" #include "Poco/NumberParser.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <ctype.h> #include <cctype>
using Poco::UnbufferedStreamBuf; using Poco::UnbufferedStreamBuf;
@ -70,12 +70,12 @@ int QuotedPrintableDecoderBuf::readFromDevice()
{ {
ch = _istr.get(); // read \n ch = _istr.get(); // read \n
} }
else if (isxdigit(ch)) else if (std::isxdigit(ch))
{ {
std::string hex; std::string hex;
hex += (char) ch; hex += (char) ch;
ch = _istr.get(); ch = _istr.get();
if (isxdigit(ch)) if (std::isxdigit(ch))
{ {
hex += (char) ch; hex += (char) ch;
return NumberParser::parseHex(hex); return NumberParser::parseHex(hex);

View File

@ -1,7 +1,7 @@
// //
// Socket.cpp // Socket.cpp
// //
// $Id: //poco/Main/Net/src/Socket.cpp#10 $ // $Id: //poco/Main/Net/src/Socket.cpp#13 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -38,7 +38,7 @@
#include "Poco/Net/StreamSocketImpl.h" #include "Poco/Net/StreamSocketImpl.h"
#include "Poco/Timestamp.h" #include "Poco/Timestamp.h"
#include <algorithm> #include <algorithm>
#include <string.h> #include <string.h> // FD_SET needs memset on some platforms, so we can't use <cstring>
namespace Poco { namespace Poco {

View File

@ -1,7 +1,7 @@
// //
// SocketAddress.cpp // SocketAddress.cpp
// //
// $Id: //poco/Main/Net/src/SocketAddress.cpp#12 $ // $Id: //poco/Main/Net/src/SocketAddress.cpp#13 $
// //
// Library: Net // Library: Net
// Package: NetCore // Package: NetCore
@ -42,7 +42,7 @@
#include "Poco/NumberParser.h" #include "Poco/NumberParser.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include <algorithm> #include <algorithm>
#include <string.h> #include <cstring>
using Poco::RefCountedObject; using Poco::RefCountedObject;
@ -90,21 +90,21 @@ class IPv4SocketAddressImpl: public SocketAddressImpl
public: public:
IPv4SocketAddressImpl() IPv4SocketAddressImpl()
{ {
memset(&_addr, 0, sizeof(_addr)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin_family = AF_INET; _addr.sin_family = AF_INET;
poco_set_sin_len(&_addr); poco_set_sin_len(&_addr);
} }
IPv4SocketAddressImpl(const struct sockaddr_in* addr) IPv4SocketAddressImpl(const struct sockaddr_in* addr)
{ {
memcpy(&_addr, addr, sizeof(_addr)); std::memcpy(&_addr, addr, sizeof(_addr));
} }
IPv4SocketAddressImpl(const void* addr, UInt16 port) IPv4SocketAddressImpl(const void* addr, UInt16 port)
{ {
memset(&_addr, 0, sizeof(_addr)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin_family = AF_INET; _addr.sin_family = AF_INET;
memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr)); std::memcpy(&_addr.sin_addr, addr, sizeof(_addr.sin_addr));
_addr.sin_port = port; _addr.sin_port = port;
} }
@ -146,15 +146,15 @@ class IPv6SocketAddressImpl: public SocketAddressImpl
public: public:
IPv6SocketAddressImpl(const struct sockaddr_in6* addr) IPv6SocketAddressImpl(const struct sockaddr_in6* addr)
{ {
memcpy(&_addr, addr, sizeof(_addr)); std::memcpy(&_addr, addr, sizeof(_addr));
} }
IPv6SocketAddressImpl(const void* addr, UInt16 port) IPv6SocketAddressImpl(const void* addr, UInt16 port)
{ {
memset(&_addr, 0, sizeof(_addr)); std::memset(&_addr, 0, sizeof(_addr));
_addr.sin6_family = AF_INET6; _addr.sin6_family = AF_INET6;
poco_set_sin6_len(&_addr); poco_set_sin6_len(&_addr);
memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr)); std::memcpy(&_addr.sin6_addr, addr, sizeof(_addr.sin6_addr));
_addr.sin6_port = port; _addr.sin6_port = port;
} }

View File

@ -1,7 +1,7 @@
// //
// SocketImpl.cpp // SocketImpl.cpp
// //
// $Id: //poco/Main/Net/src/SocketImpl.cpp#19 $ // $Id: //poco/Main/Net/src/SocketImpl.cpp#22 $
// //
// Library: Net // Library: Net
// Package: Sockets // Package: Sockets
@ -39,7 +39,7 @@
#include "Poco/Net/StreamSocketImpl.h" #include "Poco/Net/StreamSocketImpl.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/Timestamp.h" #include "Poco/Timestamp.h"
#include <string.h> #include <string.h> // FD_SET needs memset on some platforms, so we can't use <cstring>
using Poco::IOException; using Poco::IOException;