mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-03 15:47:13 +01:00
Merge branch 'develop' into feature/mail-msg-decode
This commit is contained in:
commit
a294e1fd88
@ -14,7 +14,7 @@ namespace CppUnit {
|
||||
|
||||
|
||||
TestRunner::TestRunner():
|
||||
_ostr(std::clog)
|
||||
_ostr(std::cout)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -176,23 +176,27 @@ int DeflatingStreamBuf::sync()
|
||||
if (BufferedStreamBuf::sync())
|
||||
return -1;
|
||||
|
||||
if (_pOstr && _zstr.next_out)
|
||||
if (_pOstr)
|
||||
{
|
||||
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||
if (rc != Z_OK) throw IOException(zError(rc));
|
||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
||||
while (_zstr.avail_out == 0)
|
||||
if (_zstr.next_out)
|
||||
{
|
||||
_zstr.next_out = (unsigned char*) _buffer;
|
||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||
rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||
if (rc != Z_OK) throw IOException(zError(rc));
|
||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
||||
};
|
||||
_zstr.next_out = (unsigned char*) _buffer;
|
||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||
while (_zstr.avail_out == 0)
|
||||
{
|
||||
_zstr.next_out = (unsigned char*) _buffer;
|
||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||
rc = deflate(&_zstr, Z_SYNC_FLUSH);
|
||||
if (rc != Z_OK) throw IOException(zError(rc));
|
||||
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
|
||||
if (!_pOstr->good()) throw IOException(zError(rc));
|
||||
};
|
||||
_zstr.next_out = (unsigned char*) _buffer;
|
||||
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
|
||||
}
|
||||
_pOstr->flush();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ WebSocketImpl::~WebSocketImpl()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int WebSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||
{
|
||||
Poco::Buffer<char> frame(length + MAX_HEADER_LENGTH);
|
||||
Poco::MemoryOutputStream ostr(frame.begin(), frame.size());
|
||||
Poco::BinaryWriter writer(ostr, Poco::BinaryWriter::NETWORK_BYTE_ORDER);
|
||||
|
||||
|
||||
if (flags == 0) flags = WebSocket::FRAME_BINARY;
|
||||
flags &= 0xff;
|
||||
writer << static_cast<Poco::UInt8>(flags);
|
||||
@ -105,7 +105,7 @@ int WebSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int WebSocketImpl::receiveHeader(char mask[4], bool& useMask)
|
||||
{
|
||||
char header[MAX_HEADER_LENGTH];
|
||||
@ -318,7 +318,7 @@ void WebSocketImpl::shutdownSend()
|
||||
_pStreamSocketImpl->shutdownSend();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WebSocketImpl::shutdown()
|
||||
{
|
||||
_pStreamSocketImpl->shutdown();
|
||||
@ -375,8 +375,12 @@ Poco::Timespan WebSocketImpl::getReceiveTimeout()
|
||||
|
||||
int WebSocketImpl::available()
|
||||
{
|
||||
return _pStreamSocketImpl->available();
|
||||
int n = _buffer.size() - _bufferOffset;
|
||||
if (n > 0)
|
||||
return n + _pStreamSocketImpl->available();
|
||||
else
|
||||
return _pStreamSocketImpl->available();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@ -31,7 +31,7 @@ class Zip_API ZipCommon
|
||||
public:
|
||||
enum
|
||||
{
|
||||
HEADER_SIZE = 4,
|
||||
HEADER_SIZE = 4
|
||||
};
|
||||
|
||||
static const Poco::UInt16 ZIP64_EXTRA_ID = 0x1; // Extra data id tag for Zip64 data (in extension for ZipLocalFileHeader and ZipFileInfo)
|
||||
|
@ -213,7 +213,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline Poco::UInt32 ZipFileInfo::getCRCFromHeader() const
|
||||
{
|
||||
return ZipUtil::get32BitValue(_rawInfo, CRC32_POS);
|
||||
|
@ -80,7 +80,7 @@ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeade
|
||||
{
|
||||
std::string dirName = hdr.getFileName();
|
||||
if (!ZipCommon::isValidPath(dirName))
|
||||
throw ZipException("Illegal entry name " + dirName);
|
||||
throw ZipException("Illegal entry name", dirName);
|
||||
Poco::Path dir(_outDir, dirName);
|
||||
dir.makeDirectory();
|
||||
Poco::File aFile(dir);
|
||||
@ -100,7 +100,7 @@ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeade
|
||||
}
|
||||
|
||||
if (!ZipCommon::isValidPath(fileName))
|
||||
throw ZipException("Illegal entry name " + fileName);
|
||||
throw ZipException("Illegal entry name", fileName);
|
||||
|
||||
Poco::Path file(fileName);
|
||||
file.makeFile();
|
||||
|
@ -22,9 +22,16 @@ namespace Zip {
|
||||
|
||||
bool ZipCommon::isValidPath(const std::string& path)
|
||||
{
|
||||
|
||||
if (!Path(path).isRelative() || !Path(path, Path::PATH_WINDOWS).isRelative())
|
||||
try
|
||||
{
|
||||
if (Path(path, Path::PATH_UNIX).isAbsolute() || Path(path, Path::PATH_WINDOWS).isAbsolute())
|
||||
return false;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path == "..")
|
||||
return false;
|
||||
if ((path.size() >= 3) && path.compare(0, 3, "../") == 0)
|
||||
@ -41,8 +48,7 @@ bool ZipCommon::isValidPath(const std::string& path)
|
||||
return false;
|
||||
if ((path.size() >= 2) && path.compare(0, 2, "~/") == 0)
|
||||
return false;
|
||||
if (path.size() > 0 && (path[0] == '/' || path[0] == '\\'))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,6 @@ objects = ZipTestSuite Driver \
|
||||
|
||||
target = testrunner
|
||||
target_version = 1
|
||||
target_libs = PocoZip PocoNet PocoFoundation PocoCppUnit
|
||||
target_libs = PocoZip PocoFoundation PocoCppUnit
|
||||
|
||||
include $(POCO_BASE)/build/rules/exec
|
||||
|
@ -17,17 +17,29 @@ if (WIN32)
|
||||
get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
|
||||
get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH)
|
||||
get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH)
|
||||
get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH)
|
||||
file(GLOB kit10_list ${kit10_dir}/bin/10.*)
|
||||
if (X64)
|
||||
set(sdk_bindir "${sdk_dir}/bin/x64")
|
||||
set(kit_bindir "${kit_dir}/bin/x64")
|
||||
set(kit81_bindir "${kit81_dir}/bin/x64")
|
||||
foreach (tmp_elem ${kit10_list})
|
||||
if (IS_DIRECTORY ${tmp_elem})
|
||||
list(APPEND kit10_bindir "${tmp_elem}/x64")
|
||||
endif()
|
||||
endforeach()
|
||||
else (X64)
|
||||
set(sdk_bindir "${sdk_dir}/bin")
|
||||
set(kit_bindir "${kit_dir}/bin/x86")
|
||||
set(kit81_bindir "${kit81_dir}/bin/x86")
|
||||
foreach (tmp_elem ${kit10_list})
|
||||
if (IS_DIRECTORY ${tmp_elem})
|
||||
list(APPEND kit10_bindir "${tmp_elem}/x86")
|
||||
endif()
|
||||
endforeach()
|
||||
endif (X64)
|
||||
endif ()
|
||||
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}"
|
||||
find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir}
|
||||
DOC "path to message compiler")
|
||||
if (NOT CMAKE_MC_COMPILER)
|
||||
message(FATAL_ERROR "message compiler not found: required to build")
|
||||
|
Loading…
x
Reference in New Issue
Block a user