fix FTPS win build, license, header guards; fix few warnings

This commit is contained in:
Alex Fabijanic 2017-08-31 12:20:49 -05:00
parent dd573b98d8
commit c81de1d34b
6 changed files with 63 additions and 10 deletions

View File

@ -20,7 +20,9 @@
#include "Poco/ErrorHandler.h"
#include "Poco/Thread.h"
#include "Poco/Exception.h"
#ifdef max
#undef max
#endif
using Poco::FastMutex;
using Poco::Exception;
@ -104,7 +106,9 @@ void SocketReactor::run()
if (nSockets == 0)
{
onIdle();
Thread::trySleep(_timeout.totalMilliseconds());
Timespan::TimeDiff ms = _timeout.totalMilliseconds();
poco_assert_dbg(ms <= std::numeric_limits<long>::max());
Thread::trySleep(static_cast<long>(ms));
}
else if (Socket::select(readable, writable, except, _timeout))
{

View File

@ -207,7 +207,7 @@ int WebSocketImpl::receiveBytes(Poco::Buffer<char>& buffer, int)
int payloadLength = receiveHeader(mask, useMask);
if (payloadLength <= 0)
return payloadLength;
int oldSize = buffer.size();
int oldSize = static_cast<int>(buffer.size());
buffer.resize(oldSize + payloadLength);
return receivePayload(buffer.begin() + oldSize, payloadLength, mask, useMask);
}
@ -233,7 +233,7 @@ int WebSocketImpl::receiveNBytes(void* buffer, int bytes)
int WebSocketImpl::receiveSomeBytes(char* buffer, int bytes)
{
int n = _buffer.size() - _bufferOffset;
int n = static_cast<int>(_buffer.size()) - _bufferOffset;
if (n > 0)
{
if (bytes < n) n = bytes;

View File

@ -1,10 +1,34 @@
#pragma once
//
// FTPSClientSession.h
//
// $Id: //poco/1.4/Net/include/Poco/Net/FTPSClientSession.h#1 $
//
// Library: Net
// Package: FTP
// Module: FTPSClientSession
//
// Definition of the FTPSClientSession class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef NetSSL_FTPSClientSession_INCLUDED
#define NetSSL_FTPSClientSession_INCLUDED
#include "Poco/Net/NetSSL.h"
#include "Poco/Net/FTPClientSession.h"
namespace Poco {
namespace Net {
class FTPSClientSession :
class NetSSL_API FTPSClientSession :
public Poco::Net::FTPClientSession
{
public:
@ -56,6 +80,11 @@ private:
bool _bSecureDataConnection = false;
};
//
// inlines
//
inline bool FTPSClientSession::isSecure() const
{
if (_pControlSocket != nullptr)
@ -63,4 +92,8 @@ inline bool FTPSClientSession::isSecure() const
return false;
}
}} // namespace Poco::Net
#endif // #define NetSSL_FTPSClientSession_INCLUDED

View File

@ -20,7 +20,7 @@
#define Net_FTPSStreamFactory_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/NetSSL.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/URIStreamFactory.h"
@ -29,7 +29,7 @@ namespace Poco {
namespace Net {
class Net_API FTPPasswordProvider
class NetSSL_API FTPPasswordProvider
/// The base class for all password providers.
/// An instance of a subclass of this class can be
/// registered with the FTPSStreamFactory to
@ -45,7 +45,7 @@ protected:
};
class Net_API FTPSStreamFactory: public Poco::URIStreamFactory
class NetSSL_API FTPSStreamFactory: public Poco::URIStreamFactory
/// An implementation of the URIStreamFactory interface
/// that handles File Transfer Protocol (ftp) URIs.
///

View File

@ -1,3 +1,19 @@
//
// FTPSClientSession.cpp
//
// $Id: //poco/1.4/Net/src/FTPSClientSession.cpp#1 $
//
// Library: Net
// Package: FTP
// Module: FTPSClientSession
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Net/FTPSClientSession.h"
#include "Poco/Net/SecureStreamSocket.h"
#include "Poco/Net/SecureStreamSocketImpl.h"

View File

@ -248,7 +248,7 @@ void ParserEngine::parse(const char* pBuffer, std::size_t size)
std::size_t processed = 0;
while (processed < size)
{
const int bufferSize = processed + PARSE_BUFFER_SIZE < size ? PARSE_BUFFER_SIZE : size - processed;
const int bufferSize = processed + PARSE_BUFFER_SIZE < size ? PARSE_BUFFER_SIZE : static_cast<int>(size - processed);
if (!XML_Parse(_parser, pBuffer + processed, bufferSize, 0))
handleError(XML_GetErrorCode(_parser));
processed += bufferSize;