Merge pull request #37 from pocoproject/develop

Sync 3.2.2017
This commit is contained in:
Marian Krivoš 2017-02-05 18:35:31 +01:00 committed by GitHub
commit 2a9ce7d874
62 changed files with 819 additions and 392 deletions

View File

@ -533,6 +533,26 @@ void MySQLTest::testTupleVector()
_pExecutor->tupleVector();
}
#if __cplusplus >= 201103L
void MySQLTest::testStdTuple()
{
if (!_pSession) fail ("Test not available.");
recreateTuplesTable();
_pExecutor->stdTuples();
}
void MySQLTest::testStdTupleVector()
{
if (!_pSession) fail ("Test not available.");
recreateTuplesTable();
_pExecutor->stdTupleVector();
}
#endif // __cplusplus >= 201103L
void MySQLTest::testInternalExtraction()
{
@ -934,6 +954,10 @@ CppUnit::Test* MySQLTest::suite()
CppUnit_addTest(pSuite, MySQLTest, testDouble);
CppUnit_addTest(pSuite, MySQLTest, testTuple);
CppUnit_addTest(pSuite, MySQLTest, testTupleVector);
#if __cplusplus >= 201103L
CppUnit_addTest(pSuite, MySQLTest, testStdTuple);
CppUnit_addTest(pSuite, MySQLTest, testStdTupleVector);
#endif
CppUnit_addTest(pSuite, MySQLTest, testInternalExtraction);
CppUnit_addTest(pSuite, MySQLTest, testNull);
CppUnit_addTest(pSuite, MySQLTest, testNullableInt);

View File

@ -89,6 +89,13 @@ public:
void testTuple();
void testTupleVector();
#if __cplusplus >= 201103L
void testStdTuple();
void testStdTupleVector();
#endif
void testInternalExtraction();
void testNull();

View File

@ -31,6 +31,10 @@
#include "Poco/Data/MySQL/Connector.h"
#include "Poco/Data/MySQL/MySQLException.h"
#if __cplusplus >= 201103L
#include <tuple>
#endif
#if POCO_MSVS_VERSION == 2015
#define HAVE_STRUCT_TIMESPEC
#endif
@ -1476,6 +1480,58 @@ void SQLExecutor::tupleVector()
assert (ret == v);
}
#if __cplusplus >= 201103L
void SQLExecutor::stdTuples()
{
typedef std::tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> TupleType;
std::string funct = "stdTuples()";
TupleType t = std::make_tuple(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
try { *_pSession << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", use(t), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
TupleType ret = std::make_tuple(-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29);
assert (ret != t);
try { *_pSession << "SELECT * FROM Tuples", into(ret), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (ret == t);
}
void SQLExecutor::stdTupleVector()
{
typedef std::tuple<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> TupleType;
std::string funct = "stdTupleVector()";
TupleType t = std::make_tuple(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
auto t10 = std::make_tuple(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29);
TupleType t100 = std::make_tuple(100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119);
std::vector<TupleType> v;
v.push_back(t);
v.push_back(t10);
v.push_back(t100);
try { *_pSession << "INSERT INTO Tuples VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", use(v), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
int count = 0;
try { *_pSession << "SELECT COUNT(*) FROM Tuples", into(count), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (v.size() == (std::size_t) count);
std::vector<TupleType> ret;
try { *_pSession << "SELECT * FROM Tuples", into(ret), now; }
catch(ConnectionException& ce){ std::cout << ce.displayText() << std::endl; fail (funct); }
catch(StatementException& se){ std::cout << se.displayText() << std::endl; fail (funct); }
assert (ret == v);
}
#endif //__cplusplus >= 201103L
void SQLExecutor::internalExtraction()
{

View File

@ -91,6 +91,11 @@ public:
void tuples();
void tupleVector();
#if __cplusplus >= 201103L
void stdTuples();
void stdTupleVector();
#endif
void internalExtraction();
void doNull();

View File

@ -30,6 +30,9 @@
#include "Poco/SharedPtr.h"
#include <cstddef>
#if __cplusplus >= 201103L
#include <tuple>
#endif
namespace Poco {
namespace Data {
@ -2104,6 +2107,131 @@ private:
};
#if __cplusplus >= 201103L
template<std::size_t N>
struct TupleBind
/// Helper for specialization of type handler for std::tuple
{
template<typename... T>
static typename std::enable_if<N < sizeof...(T)>::type
bind(std::size_t& pos, const std::tuple<T...>& t, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
using Type = typename std::tuple_element<N, std::tuple<T...>>::type;
TypeHandler<Type>::bind(pos, std::get<N>(t), pBinder, dir);
pos += TypeHandler<Type>::size();
TupleBind<N+1>::bind(pos, t, pBinder, dir);
}
template<typename... T>
static typename std::enable_if<!(N < sizeof...(T))>::type
bind(std::size_t& pos, const std::tuple<T...>& t, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{}
};
template<std::size_t N>
struct TupleSize
/// Helper for specialization of type handler for std::tuple
{
template<typename... T>
static typename std::enable_if<N < sizeof...(T)>::type
size(std::size_t& sz)
{
using Type = typename std::tuple_element<N, std::tuple<T...>>::type;
sz += TypeHandler<Type>::size();
TupleSize<N+1>::size(sz);
}
template<typename... T>
static typename std::enable_if<!(N < sizeof...(T))>::type
size(std::size_t& sz)
{}
};
template<std::size_t N>
struct TupleExtract
/// Helper for specialization of type handler for std::tuple
{
template<typename... T>
static typename std::enable_if<N < sizeof...(T)>::type
extract(std::size_t& pos, std::tuple<T...>& t, const std::tuple<T...>& defVal, AbstractExtractor::Ptr pExt)
{
using Type = typename std::tuple_element<N, std::tuple<T...>>::type;
TypeHandler<Type>::extract(pos, std::get<N>(t), std::get<N>(defVal), pExt);
pos += TypeHandler<Type>::size();
TupleExtract<N+1>::extract(pos, t, defVal, pExt);
}
template<typename... T>
static typename std::enable_if<!(N < sizeof...(T))>::type
extract(std::size_t& pos, std::tuple<T...>& t, const std::tuple<T...>& defVal, AbstractExtractor::Ptr pExt)
{}
};
template<std::size_t N>
struct TuplePrepare
/// Helper for specialization of type handler for std::tuple
{
template<typename... T>
static typename std::enable_if<N < sizeof...(T)>::type
prepare(std::size_t& pos, const std::tuple<T...>& t, AbstractPreparator::Ptr pPreparator)
{
using Type = typename std::tuple_element<N, std::tuple<T...>>::type;
TypeHandler<Type>::prepare(pos, std::get<N>(t), pPreparator);
pos += TypeHandler<Type>::size();
TuplePrepare<N+1>::prepare(pos, t, pPreparator);
}
template<typename... T>
static typename std::enable_if<!(N < sizeof...(T))>::type
prepare(std::size_t& pos, const std::tuple<T...>& t, AbstractPreparator::Ptr pPreparator)
{}
};
template <typename...T>
class TypeHandler<std::tuple<T...>>
/// Specialization of type handler for std::tuple
{
public:
static void bind(std::size_t pos, const std::tuple<T...> & t, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir)
{
poco_assert_dbg (!pBinder.isNull());
TupleBind<0>::bind(pos, t, pBinder, dir);
}
static std::size_t size()
{
std::size_t sz = 0;
TupleSize<0>::size(sz);
return sz;
}
static void extract(std::size_t pos, std::tuple<T...>& t, const std::tuple<T...>& defVal, AbstractExtractor::Ptr pExt)
{
poco_assert_dbg (!pExt.isNull());
TupleExtract<0>::extract(pos, t, defVal, pExt);
}
static void prepare(std::size_t pos, const std::tuple<T...> & t, AbstractPreparator::Ptr pPrepare)
{
poco_assert_dbg (!pPrepare.isNull());
TuplePrepare<0>::prepare(pos, t, pPrepare);
}
private:
TypeHandler();
~TypeHandler();
TypeHandler(const TypeHandler&);
TypeHandler& operator=(const TypeHandler&);
};
#endif // __cplusplus >= 201103L
} } // namespace Poco::Data

View File

@ -38,6 +38,10 @@
#include <iomanip>
#include <set>
#if __cplusplus >= 201103L
#include <tuple>
#endif
using namespace Poco::Data::Keywords;
@ -1400,6 +1404,22 @@ void DataTest::testExternalBindingAndExtraction()
}
#if __cplusplus >= 201103L
void DataTest::testStdTuple()
{
using Row = std::tuple<std::string, std::string, int>;
Session sess(SessionFactory::instance().create("test", "cs"));
Row person = std::make_tuple(std::string("Scott"), std::string("Washington, DC"), 42);
sess << "INSERT INTO Person(name, address, age) VALUES (?, ?, ?)", use(person), now;
std::vector<Row> rows;
sess << "SELECT name, address, age FROM Person", into(rows) , now;
}
#endif // __cplusplus >= 201103L
void DataTest::setUp()
{
}
@ -1431,6 +1451,10 @@ CppUnit::Test* DataTest::suite()
CppUnit_addTest(pSuite, DataTest, testJSONRowFormatter);
CppUnit_addTest(pSuite, DataTest, testDateAndTime);
CppUnit_addTest(pSuite, DataTest, testExternalBindingAndExtraction);
#if __cplusplus >= 201103L
CppUnit_addTest(pSuite, DataTest, testStdTuple);
#endif
return pSuite;
}

View File

@ -47,6 +47,10 @@ public:
void testDateAndTime();
void testExternalBindingAndExtraction();
#if __cplusplus >= 201103L
void testStdTuple();
#endif
void setUp();
void tearDown();

View File

@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 2015
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "Foundation_vs140.vcxproj", "{B01196CC-B693-4548-8464-2FF60499E73F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs140.vcxproj", "{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}"
@ -7,52 +9,86 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\Test
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestApp", "testsuite\TestApp_vs140.vcxproj", "{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}"
ProjectSection(ProjectDependencies) = postProject
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLibrary", "testsuite\TestLibrary_vs140.vcxproj", "{0955EB03-544B-4BD4-9C10-89CF38078F5F}"
ProjectSection(ProjectDependencies) = postProject
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32
debug_static_mt|Win32 = debug_static_mt|Win32
release_static_mt|Win32 = release_static_mt|Win32
debug_static_md|Win32 = debug_static_md|Win32
debug_static_mt|Win32 = debug_static_mt|Win32
release_shared|Win32 = release_shared|Win32
release_static_md|Win32 = release_static_md|Win32
release_static_mt|Win32 = release_static_mt|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.Build.0 = debug_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|Win32.Deploy.0 = debug_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.ActiveCfg = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Build.0 = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Deploy.0 = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.Build.0 = debug_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.ActiveCfg = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Build.0 = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|Win32.Deploy.0 = release_shared|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.ActiveCfg = release_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.Build.0 = release_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|Win32.Deploy.0 = release_static_md|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Build.0 = release_static_mt|Win32
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.Build.0 = debug_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|Win32.Deploy.0 = debug_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.ActiveCfg = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Build.0 = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Deploy.0 = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Build.0 = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.Build.0 = debug_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|Win32.Deploy.0 = debug_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|Win32.Deploy.0 = debug_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.ActiveCfg = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Build.0 = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|Win32.Deploy.0 = release_shared|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.ActiveCfg = release_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.Build.0 = release_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|Win32.Deploy.0 = release_static_md|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Build.0 = release_static_mt|Win32
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|Win32.Deploy.0 = release_static_mt|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_shared|Win32.Build.0 = debug_shared|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_md|Win32.ActiveCfg = debug_static_md|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_md|Win32.Build.0 = debug_static_md|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_mt|Win32.ActiveCfg = debug_static_mt|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_mt|Win32.Build.0 = debug_static_mt|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_shared|Win32.ActiveCfg = release_shared|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_shared|Win32.Build.0 = release_shared|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_md|Win32.ActiveCfg = release_static_md|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_md|Win32.Build.0 = release_static_md|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_mt|Win32.ActiveCfg = release_static_mt|Win32
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_mt|Win32.Build.0 = release_static_mt|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_shared|Win32.Build.0 = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_md|Win32.ActiveCfg = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_md|Win32.Build.0 = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_mt|Win32.ActiveCfg = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_mt|Win32.Build.0 = debug_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_shared|Win32.ActiveCfg = release_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_shared|Win32.Build.0 = release_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_md|Win32.ActiveCfg = release_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_md|Win32.Build.0 = release_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_mt|Win32.ActiveCfg = release_shared|Win32
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_mt|Win32.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 2015
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "Foundation_x64_vs140.vcxproj", "{B01196CC-B693-4548-8464-2FF60499E73F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_x64_vs140.vcxproj", "{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}"
@ -7,52 +9,86 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\Test
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestApp", "testsuite\TestApp_x64_vs140.vcxproj", "{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}"
ProjectSection(ProjectDependencies) = postProject
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLibrary", "testsuite\TestLibrary_x64_vs140.vcxproj", "{0955EB03-544B-4BD4-9C10-89CF38078F5F}"
ProjectSection(ProjectDependencies) = postProject
{B01196CC-B693-4548-8464-2FF60499E73F} = {B01196CC-B693-4548-8464-2FF60499E73F}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|x64 = debug_shared|x64
release_shared|x64 = release_shared|x64
debug_static_mt|x64 = debug_static_mt|x64
release_static_mt|x64 = release_static_mt|x64
debug_static_md|x64 = debug_static_md|x64
debug_static_mt|x64 = debug_static_mt|x64
release_shared|x64 = release_shared|x64
release_static_md|x64 = release_static_md|x64
release_static_mt|x64 = release_static_mt|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|x64.ActiveCfg = debug_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|x64.Build.0 = debug_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_shared|x64.Deploy.0 = debug_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.ActiveCfg = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.Build.0 = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.Deploy.0 = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.Build.0 = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.ActiveCfg = release_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.Build.0 = release_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.Deploy.0 = release_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|x64.ActiveCfg = debug_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|x64.Build.0 = debug_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_md|x64.Deploy.0 = debug_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.Build.0 = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.ActiveCfg = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.Build.0 = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_shared|x64.Deploy.0 = release_shared|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|x64.ActiveCfg = release_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|x64.Build.0 = release_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_md|x64.Deploy.0 = release_static_md|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.ActiveCfg = release_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.Build.0 = release_static_mt|x64
{B01196CC-B693-4548-8464-2FF60499E73F}.release_static_mt|x64.Deploy.0 = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|x64.ActiveCfg = debug_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|x64.Build.0 = debug_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_shared|x64.Deploy.0 = debug_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.ActiveCfg = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.Build.0 = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.Deploy.0 = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.Build.0 = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.ActiveCfg = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.Build.0 = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.Deploy.0 = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|x64.ActiveCfg = debug_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|x64.Build.0 = debug_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_md|x64.Deploy.0 = debug_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.Build.0 = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.debug_static_mt|x64.Deploy.0 = debug_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.ActiveCfg = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.Build.0 = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_shared|x64.Deploy.0 = release_shared|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|x64.ActiveCfg = release_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|x64.Build.0 = release_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_md|x64.Deploy.0 = release_static_md|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.ActiveCfg = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.Build.0 = release_static_mt|x64
{C812E0B9-69A9-4FA1-A1D4-161CF677BD10}.release_static_mt|x64.Deploy.0 = release_static_mt|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_shared|x64.ActiveCfg = debug_shared|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_shared|x64.Build.0 = debug_shared|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_md|x64.ActiveCfg = debug_static_md|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_md|x64.Build.0 = debug_static_md|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_mt|x64.ActiveCfg = debug_static_mt|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.debug_static_mt|x64.Build.0 = debug_static_mt|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_shared|x64.ActiveCfg = release_shared|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_shared|x64.Build.0 = release_shared|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_md|x64.ActiveCfg = release_static_md|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_md|x64.Build.0 = release_static_md|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_mt|x64.ActiveCfg = release_static_mt|x64
{6C41E55D-C0FC-4E01-AA8D-B7DA40E31D3A}.release_static_mt|x64.Build.0 = release_static_mt|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_shared|x64.ActiveCfg = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_shared|x64.Build.0 = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_md|x64.ActiveCfg = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_md|x64.Build.0 = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_mt|x64.ActiveCfg = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.debug_static_mt|x64.Build.0 = debug_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_shared|x64.ActiveCfg = release_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_shared|x64.Build.0 = release_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_md|x64.ActiveCfg = release_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_md|x64.Build.0 = release_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_mt|x64.ActiveCfg = release_shared|x64
{0955EB03-544B-4BD4-9C10-89CF38078F5F}.release_static_mt|x64.Build.0 = release_shared|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -24,9 +24,11 @@
#if POCO_OS == POCO_OS_WINDOWS_NT
#include "Poco/UnWindows.h"
#elif POCO_OS == POCO_OS_MAC_OS_X
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 || __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 || __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_10_0 || __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCHOS_3_0
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 || __TV_OS_VERSION_MAX_ALLOWED >= 100000 || __WATCH_OS_VERSION_MAX_ALLOWED >= 30000
#ifndef POCO_HAVE_STD_ATOMICS
#define POCO_HAVE_STD_ATOMICS
#if __cplusplus >= 201103L
#define POCO_HAVE_STD_ATOMICS
#endif
#endif
#else
#include <libkern/OSAtomic.h>

View File

@ -50,6 +50,19 @@ class Path;
class Foundation_API File: private FileImpl
/// The File class provides methods for working with a file.
///
/// Regarding paths passed to the various methods, note that
/// platform-specific limitations regarding maximum length
/// of the entire path and its components apply.
///
/// On Windows, if compiled with UTF-8 support (POCO_WIN32_UTF8)
/// the implementation tries to work around the rather low
/// 260 characters MAX_PATH limit by adding the "\\?\" prefix if
/// a path is absolute and exceeds MAX_PATH characters in length.
/// Note that various limitations regarding usage of the "\\?\"
/// prefix apply in that case, e.g. the path must
/// not contain relative components ("." and "..") and must not
/// use the forward slash ("/") as directory separator.
{
public:
typedef FileSizeImpl FileSize;

View File

@ -63,6 +63,7 @@ protected:
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string& path);
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
private:
std::string _path;
@ -71,6 +72,8 @@ private:
friend class FileHandle;
friend class DirectoryIteratorImpl;
friend class WindowsDirectoryWatcherStrategy;
friend class FileStreamBuf;
friend class LogFileImpl;
};

View File

@ -63,6 +63,7 @@ protected:
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string& path);
static void convertPath(const std::string& utf8Path, std::wstring& utf16Path);
private:
std::string _path;
@ -70,6 +71,8 @@ private:
friend class FileHandle;
friend class DirectoryIteratorImpl;
friend class FileStreamBuf;
friend class LogFileImpl;
};

View File

@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -251,11 +251,6 @@
# endif
# undef z_longlong
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
@ -444,11 +439,13 @@ typedef uLong FAR uLongf;
# define Z_HAVE_STDARG_H
#endif
#ifndef _WIN32_WCE
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO

View File

@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.10, January 2nd, 2017
version 1.2.11, January 15th, 2017
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
@ -37,11 +37,11 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.10"
#define ZLIB_VERNUM 0x12a0
#define ZLIB_VERSION "1.2.11"
#define ZLIB_VERNUM 0x12b0
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 10
#define ZLIB_VER_REVISION 11
#define ZLIB_VER_SUBREVISION 0
/*
@ -712,10 +712,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different strategy.
If the compression approach (which is a function of the level) or the
strategy is changed, then the input available so far is compressed with the
old level and strategy using deflate(strm, Z_BLOCK). There are three
approaches for the compression levels 0, 1..3, and 4..9 respectively. The
new level and strategy will take effect at the next call of deflate().
strategy is changed, and if any input has been consumed in a previous
deflate() call, then the input available so far is compressed with the old
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
for the compression levels 0, 1..3, and 4..9 respectively. The new level
and strategy will take effect at the next call of deflate().
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
not have enough output space to complete, then the parameter change will not
@ -1883,11 +1884,6 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
#endif /* !Z_SOLO */
/* hack for buggy compilers */
#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;};
#endif
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError OF((int));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));

View File

@ -35,7 +35,7 @@ DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVAL
std::string findPath = p.toString();
findPath.append("*");
std::wstring uFindPath;
UnicodeConverter::toUTF16(findPath, uFindPath);
FileImpl::convertPath(findPath, uFindPath);
_fh = FindFirstFileW(uFindPath.c_str(), &_fd);
if (_fh == INVALID_HANDLE_VALUE)

View File

@ -29,9 +29,6 @@
#include "Poco/Event.h"
#include "Poco/Exception.h"
#include "Poco/Buffer.h"
#if defined(POCO_WIN32_UTF8)
#include "Poco/UnicodeConverter.h"
#endif
#if POCO_OS == POCO_OS_LINUX
#include <sys/inotify.h>
#include <sys/select.h>
@ -200,7 +197,7 @@ public:
std::string path(owner().directory().path());
#if defined(POCO_WIN32_UTF8)
std::wstring upath;
Poco::UnicodeConverter::toUTF16(path.c_str(), upath);
FileImpl::convertPath(path.c_str(), upath);
HANDLE hChange = FindFirstChangeNotificationW(upath.c_str(), FALSE, filter);
#else
HANDLE hChange = FindFirstChangeNotificationA(path.c_str(), FALSE, filter);

View File

@ -328,7 +328,13 @@ void File::createDirectories()
File f(p);
f.createDirectories();
}
createDirectoryImpl();
try
{
createDirectoryImpl();
}
catch (FileExistsException&)
{
}
}
}

View File

@ -68,7 +68,7 @@ void FileStreamBuf::open(const std::string& path, std::ios::openmode mode)
#if defined (POCO_WIN32_UTF8)
std::wstring utf16Path;
UnicodeConverter::toUTF16(path, utf16Path);
FileImpl::convertPath(path, utf16Path);
_handle = CreateFileW(utf16Path.c_str(), access, shareMode, NULL, creationDisp, flags, NULL);
#else
_handle = CreateFileA(path.c_str(), access, shareMode, NULL, creationDisp, flags, NULL);

View File

@ -63,7 +63,7 @@ FileImpl::FileImpl(const std::string& path): _path(path)
{
_path.resize(n - 1);
}
UnicodeConverter::toUTF16(_path, _upath);
convertPath(_path, _upath);
}
@ -87,7 +87,7 @@ void FileImpl::setPathImpl(const std::string& path)
{
_path.resize(n - 1);
}
UnicodeConverter::toUTF16(_path, _upath);
convertPath(_path, _upath);
}
@ -293,7 +293,7 @@ void FileImpl::copyToImpl(const std::string& path) const
poco_assert (!_path.empty());
std::wstring upath;
UnicodeConverter::toUTF16(path, upath);
convertPath(path, upath);
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) == 0)
handleLastErrorImpl(_path);
}
@ -304,7 +304,7 @@ void FileImpl::renameToImpl(const std::string& path)
poco_assert (!_path.empty());
std::wstring upath;
UnicodeConverter::toUTF16(path, upath);
convertPath(path, upath);
if (MoveFileExW(_upath.c_str(), upath.c_str(), MOVEFILE_REPLACE_EXISTING) == 0)
handleLastErrorImpl(_path);
}
@ -439,4 +439,22 @@ void FileImpl::handleLastErrorImpl(const std::string& path)
}
void FileImpl::convertPath(const std::string& utf8Path, std::wstring& utf16Path)
{
UnicodeConverter::toUTF16(utf8Path, utf16Path);
if (utf16Path.size() > MAX_PATH - 12) // Note: CreateDirectory has a limit of MAX_PATH - 12 (room for 8.3 file name)
{
if (utf16Path[0] == '\\' || utf16Path[1] == ':')
{
if (utf16Path.compare(0, 4, L"\\\\?\\", 4) != 0)
{
if (utf16Path[1] == '\\')
utf16Path.insert(0, L"\\\\?\\UNC\\", 8);
else
utf16Path.insert(0, L"\\\\?\\", 4);
}
}
}
}
} // namespace Poco

View File

@ -64,7 +64,7 @@ FileImpl::FileImpl(const std::string& path): _path(path)
{
_path.resize(n - 1);
}
UnicodeConverter::toUTF16(_path, _upath);
convertPath(_path, _upath);
}
@ -88,7 +88,7 @@ void FileImpl::setPathImpl(const std::string& path)
{
_path.resize(n - 1);
}
UnicodeConverter::toUTF16(_path, _upath);
convertPath(_path, _upath);
}
@ -284,7 +284,7 @@ void FileImpl::copyToImpl(const std::string& path) const
poco_assert (!_path.empty());
std::wstring upath;
UnicodeConverter::toUTF16(path, upath);
convertPath(path, upath);
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) == 0)
handleLastErrorImpl(_path);
}
@ -295,7 +295,7 @@ void FileImpl::renameToImpl(const std::string& path)
poco_assert (!_path.empty());
std::wstring upath;
UnicodeConverter::toUTF16(path, upath);
convertPath(path, upath);
if (MoveFileW(_upath.c_str(), upath.c_str()) == 0)
handleLastErrorImpl(_path);
}
@ -429,4 +429,9 @@ void FileImpl::handleLastErrorImpl(const std::string& path)
}
void FileImpl::convertPath(const std::string& utf8Path, std::wstring& utf16Path)
{
UnicodeConverter::toUTF16(utf8Path, utf16Path);
}
} // namespace Poco

View File

@ -90,7 +90,7 @@ const std::string& LogFileImpl::pathImpl() const
void LogFileImpl::createFile()
{
std::wstring upath;
UnicodeConverter::toUTF16(_path, upath);
FileImpl::convertPath(_path, upath);
_hFile = CreateFileW(upath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (_hFile == INVALID_HANDLE_VALUE) throw OpenFileException(_path);

View File

@ -20,6 +20,9 @@
#include "Poco/NamedEvent.h"
#include "Poco/UnicodeConverter.h"
#include "Poco/Pipe.h"
#include "Poco/File.h"
#include "Poco/Path.h"
#include "Poco/String.h"
namespace Poco {
@ -164,7 +167,7 @@ static std::string escapeArg(const std::string& arg)
ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const ArgsImpl& args, const std::string& initialDirectory, Pipe* inPipe, Pipe* outPipe, Pipe* errPipe, const EnvImpl& env)
{
std::string commandLine = command;
std::string commandLine = escapeArg(command);
for (ArgsImpl::const_iterator it = args.begin(); it != args.end(); ++it)
{
commandLine.append(" ");
@ -174,6 +177,19 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
std::wstring ucommandLine;
UnicodeConverter::toUTF16(commandLine, ucommandLine);
const wchar_t* applicationName = 0;
std::wstring uapplicationName;
if (command.size() > MAX_PATH)
{
Poco::Path p(command);
if (p.isAbsolute())
{
UnicodeConverter::toUTF16(command, uapplicationName);
if (p.getExtension().empty()) uapplicationName += L".EXE";
applicationName = uapplicationName.c_str();
}
}
STARTUPINFOW startupInfo;
GetStartupInfoW(&startupInfo); // take defaults from current process
startupInfo.cb = sizeof(STARTUPINFOW);
@ -253,7 +269,7 @@ ProcessHandleImpl* ProcessImpl::launchImpl(const std::string& command, const Arg
PROCESS_INFORMATION processInfo;
DWORD creationFlags = GetConsoleWindow() ? 0 : CREATE_NO_WINDOW;
BOOL rc = CreateProcessW(
NULL, // applicationName
applicationName,
const_cast<wchar_t*>(ucommandLine.c_str()),
NULL, // processAttributes
NULL, // threadAttributes

View File

@ -7,6 +7,8 @@
#include "zutil.h"
#define local static
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521U /* largest prime smaller than 65536 */

View File

@ -1,5 +1,5 @@
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler
* Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
@ -30,6 +30,8 @@
#include "zutil.h" /* for STDC and FAR definitions */
#define local static
/* Definitions for doing the crc four data bytes at a time. */
#if !defined(NOBYFOUR) && defined(Z_U4)
# define BYFOUR

View File

@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.2.10 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
" deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@ -586,7 +586,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
}
func = configuration_table[s->level].func;
if ((strategy != s->strategy || func != configuration_table[level].func)) {
if ((strategy != s->strategy || func != configuration_table[level].func) &&
s->high_water) {
/* Flush the last buffer: */
int err = deflate(strm, Z_BLOCK);
if (err == Z_STREAM_ERROR)
@ -1671,8 +1672,6 @@ local block_state deflate_stored(s, flush)
len = left + s->strm->avail_in; /* limit len to the input */
if (len > have)
len = have; /* limit len to the output */
if (left > len)
left = len; /* limit window pull to len */
/* If the stored block would be less than min_block in length, or if
* unable to copy all of the available input when flushing, then try
@ -1681,13 +1680,13 @@ local block_state deflate_stored(s, flush)
*/
if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
flush == Z_NO_FLUSH ||
len - left != s->strm->avail_in))
len != left + s->strm->avail_in))
break;
/* Make a dummy stored block in pending to get the header bytes,
* including any pending bits. This also updates the debugging counts.
*/
last = flush == Z_FINISH && len - left == s->strm->avail_in ? 1 : 0;
last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
_tr_stored_block(s, (char *)0, 0L, last);
/* Replace the lengths in the dummy stored block with len. */
@ -1699,14 +1698,16 @@ local block_state deflate_stored(s, flush)
/* Write the stored block header bytes. */
flush_pending(s->strm);
/* Update debugging counts for the data about to be copied. */
#ifdef ZLIB_DEBUG
/* Update debugging counts for the data about to be copied. */
s->compressed_len += len << 3;
s->bits_sent += len << 3;
#endif
/* Copy uncompressed bytes from the window to next_out. */
if (left) {
if (left > len)
left = len;
zmemcpy(s->strm->next_out, s->window + s->block_start, left);
s->strm->next_out += left;
s->strm->avail_out -= left;
@ -1756,6 +1757,8 @@ local block_state deflate_stored(s, flush)
s->block_start = s->strstart;
s->insert += MIN(used, s->w_size - s->insert);
}
if (s->high_water < s->strstart)
s->high_water = s->strstart;
/* If the last block was written to next_out, then done. */
if (last)
@ -1783,6 +1786,8 @@ local block_state deflate_stored(s, flush)
read_buf(s->strm, s->window + s->strstart, have);
s->strstart += have;
}
if (s->high_water < s->strstart)
s->high_water = s->strstart;
/* There was not enough avail_out to write a complete worthy or flushed
* stored block to next_out. Write a stored block to pending instead, if we

View File

@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -35,10 +35,11 @@
# include <stddef.h>
#endif
#ifndef _WIN32_WCE
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
# define WIDECHAR
#endif

View File

@ -1,5 +1,5 @@
/* inffast.c -- fast decoding
* Copyright (C) 1995-2008, 2010, 2013, 2016 Mark Adler
* Copyright (C) 1995-2017 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

View File

@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
" inflate 1.2.10 Copyright 1995-2017 Mark Adler ";
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@ -62,7 +62,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 202};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

View File

@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-2016 Jean-loup Gailly
* Copyright (C) 1995-2017 Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -906,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s)
/* ===========================================================================
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and output the encoded block to the zip file.
* trees or store, and write out the encoded block.
*/
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
deflate_state *s;

View File

@ -1,9 +1,9 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
/* @(#) $Id: //poco/1.4/Foundation/include/Poco/zconf.h#5 $ */
#ifndef ZCONF_H
#define ZCONF_H
@ -439,11 +439,13 @@ typedef uLong FAR uLongf;
# define Z_HAVE_STDARG_H
#endif
#ifndef _WIN32_WCE
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO

View File

@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.10, January 2nd, 2017
version 1.2.11, January 15th, 2017
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
@ -37,11 +37,11 @@
extern "C" {
#endif
#define ZLIB_VERSION "1.2.10"
#define ZLIB_VERNUM 0x12a0
#define ZLIB_VERSION "1.2.11"
#define ZLIB_VERNUM 0x12b0
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 10
#define ZLIB_VER_REVISION 11
#define ZLIB_VER_SUBREVISION 0
/*
@ -712,10 +712,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different strategy.
If the compression approach (which is a function of the level) or the
strategy is changed, then the input available so far is compressed with the
old level and strategy using deflate(strm, Z_BLOCK). There are three
approaches for the compression levels 0, 1..3, and 4..9 respectively. The
new level and strategy will take effect at the next call of deflate().
strategy is changed, and if any input has been consumed in a previous
deflate() call, then the input available so far is compressed with the old
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
for the compression levels 0, 1..3, and 4..9 respectively. The new level
and strategy will take effect at the next call of deflate().
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
not have enough output space to complete, then the parameter change will not

View File

@ -136,8 +136,8 @@ const char * ZEXPORT zError(err)
return ERR_MSG(err);
}
#if defined(_WIN32_WCE)
/* The Microsoft C Run-Time Library for Windows CE doesn't have
#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800
/* The older Microsoft C Run-Time Library for Windows CE doesn't have
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used.
*/

View File

@ -258,7 +258,7 @@ void FileTest::testFileAttributes3()
#if POCO_OS==POCO_OS_CYGWIN
File f("/dev/tty");
#else
File f("/dev/console");
File f("/dev/null");
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS) && !defined(_WIN32_WCE)
File f("CON");
@ -524,6 +524,30 @@ void FileTest::testRename()
}
void FileTest::testLongPath()
{
#if defined(_WIN32) && defined(POCO_WIN32_UTF8) && !defined(_WIN32_WCE)
Poco::Path p("longpathtest");
p.makeAbsolute();
std::string longpath(p.toString());
while (longpath.size() < MAX_PATH*4)
{
longpath.append("\\");
longpath.append(64, 'x');
}
Poco::File d(longpath);
d.createDirectories();
assert (d.exists());
assert (d.isDirectory());
Poco::File f(p.toString());
f.remove(true);
#endif
}
void FileTest::setUp()
{
File f("testfile.dat");
@ -568,6 +592,7 @@ CppUnit::Test* FileTest::suite()
CppUnit_addTest(pSuite, FileTest, testCopyDirectory);
CppUnit_addTest(pSuite, FileTest, testRename);
CppUnit_addTest(pSuite, FileTest, testRootDir);
CppUnit_addTest(pSuite, FileTest, testLongPath);
return pSuite;
}

View File

@ -40,6 +40,7 @@ public:
void testCopyDirectory();
void testRename();
void testRootDir();
void testLongPath();
void setUp();
void tearDown();

View File

@ -22,6 +22,7 @@
#include "Poco/Net/Net.h"
#include "Poco/Net/StreamSocket.h"
#include <cstdlib>
namespace Poco {
@ -80,7 +81,7 @@ public:
DialogSocket& operator = (const DialogSocket& socket);
/// Assignment operator.
void sendByte(unsigned char ch);
/// Sends a single byte over the socket connection.
@ -189,13 +190,14 @@ public:
protected:
void allocBuffer();
void refill();
bool receiveLine(std::string& line);
int receiveStatusLine(std::string& line);
bool receiveLine(std::string& line, std::size_t lineLengthLimit = 0);
int receiveStatusLine(std::string& line, std::size_t lineLengthLimit = 0);
private:
enum
{
RECEIVE_BUFFER_SIZE = 1024,
MAX_LINE_LENGTH = 4096,
EOF_CHAR = -1
};

View File

@ -184,11 +184,19 @@ public:
/// Specify 0 for unlimited (not recommended).
///
/// The default limit is 100.
void setValueLengthLimit(int limit);
/// Sets the maximum size for form field values
/// stored as strings.
int getValueLengthLimit() const;
/// Returns the maximum size for form field values
/// stored as strings.
static const std::string ENCODING_URL; /// "application/x-www-form-urlencoded"
static const std::string ENCODING_MULTIPART; /// "multipart/form-data"
static const int UNKNOWN_CONTENT_LENGTH;
protected:
void readUrl(std::istream& istr);
void readMultipart(std::istream& istr, PartHandler& handler);
@ -201,7 +209,9 @@ private:
enum Limits
{
DFL_FIELD_LIMIT = 100
DFL_FIELD_LIMIT = 100,
MAX_NAME_LENGTH = 1024,
DFL_MAX_VALUE_LENGTH = 256*1024
};
struct Part
@ -213,6 +223,7 @@ private:
typedef std::vector<Part> PartVec;
int _fieldLimit;
int _valueLengthLimit;
std::string _encoding;
std::string _boundary;
PartVec _parts;
@ -240,6 +251,12 @@ inline int HTMLForm::getFieldLimit() const
}
inline int HTMLForm::getValueLengthLimit() const
{
return _valueLengthLimit;
}
} } // namespace Poco::Net

View File

@ -83,6 +83,9 @@ public:
StreamSocket detachSocket();
/// Returns the underlying socket after detaching
/// it from the server session.
HTTPServerSession& session();
/// Returns the underlying HTTPServerSession.
private:
HTTPServerResponseImpl& _response;
@ -129,6 +132,12 @@ inline HTTPServerResponse& HTTPServerRequestImpl::response() const
}
inline HTTPServerSession& HTTPServerRequestImpl::session()
{
return _session;
}
} } // namespace Poco::Net

View File

@ -25,6 +25,7 @@
#include "Poco/Timespan.h"
#include "Poco/Exception.h"
#include "Poco/Any.h"
#include "Poco/Buffer.h"
#include <ios>
@ -55,7 +56,10 @@ public:
void setTimeout(const Poco::Timespan& timeout);
/// Sets the timeout for the HTTP session.
void setTimeout(const Poco::Timespan& connectionTimeout, const Poco::Timespan& sendTimeout, const Poco::Timespan& receiveTimeout);
/// Sets different timeouts for the HTTP session.
Poco::Timespan getTimeout() const;
/// Returns the timeout for the HTTP session.
@ -100,6 +104,14 @@ public:
StreamSocket& socket();
/// Returns a reference to the underlying socket.
void drainBuffer(Poco::Buffer<char>& buffer);
/// Copies all bytes remaining in the internal buffer to the
/// given Poco::Buffer, resizing it as necessary.
///
/// This is usually used together with detachSocket() to
/// obtain any data already read from the socket, but not
/// yet processed.
protected:
HTTPSession();
@ -171,7 +183,8 @@ protected:
private:
enum
{
HTTP_DEFAULT_TIMEOUT = 60000000
HTTP_DEFAULT_TIMEOUT = 60000000,
HTTP_DEFAULT_CONNECTION_TIMEOUT = 30000000
};
HTTPSession(const HTTPSession&);
@ -182,7 +195,9 @@ private:
char* _pCurrent;
char* _pEnd;
bool _keepAlive;
Poco::Timespan _timeout;
Poco::Timespan _connectionTimeout;
Poco::Timespan _receiveTimeout;
Poco::Timespan _sendTimeout;
Poco::Exception* _pException;
Poco::Any _data;
@ -204,7 +219,7 @@ inline bool HTTPSession::getKeepAlive() const
inline Poco::Timespan HTTPSession::getTimeout() const
{
return _timeout;
return _receiveTimeout;
}

View File

@ -23,19 +23,23 @@
#include "Poco/Net/StreamSocketImpl.h"
#include "Poco/Buffer.h"
#include "Poco/Random.h"
#include "Poco/Buffer.h"
namespace Poco {
namespace Net {
class HTTPSession;
class Net_API WebSocketImpl: public StreamSocketImpl
/// This class implements a WebSocket, according
/// to the WebSocket protocol described in RFC 6455.
{
public:
WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload);
/// Creates a StreamSocketImpl using the given native socket.
WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, HTTPSession& session, bool mustMaskPayload);
/// Creates a WebSocketImpl.
// StreamSocketImpl
virtual int sendBytes(const void* buffer, int length, int flags);
@ -88,12 +92,15 @@ protected:
int receivePayload(char *buffer, int payloadLength, char mask[4], bool useMask);
int receiveNBytes(void* buffer, int bytes);
int receiveSomeBytes(char* buffer, int bytes);
virtual ~WebSocketImpl();
private:
WebSocketImpl();
StreamSocketImpl* _pStreamSocketImpl;
Poco::Buffer<char> _buffer;
int _bufferOffset;
int _frameFlags;
bool _mustMaskPayload;
Poco::Random _rnd;

View File

@ -15,6 +15,7 @@
#include "Poco/Net/DialogSocket.h"
#include "Poco/Exception.h"
#include "Poco/Ascii.h"
#include <cstring>
@ -149,20 +150,20 @@ void DialogSocket::sendMessage(const std::string& message, const std::string& ar
bool DialogSocket::receiveMessage(std::string& message)
{
message.clear();
return receiveLine(message);
return receiveLine(message, MAX_LINE_LENGTH);
}
int DialogSocket::receiveStatusMessage(std::string& message)
{
message.clear();
int status = receiveStatusLine(message);
int status = receiveStatusLine(message, MAX_LINE_LENGTH);
if (status < 0)
{
while (status <= 0)
{
message += '\n';
status = receiveStatusLine(message);
status = receiveStatusLine(message, MAX_LINE_LENGTH);
}
}
return status;
@ -236,14 +237,17 @@ void DialogSocket::allocBuffer()
}
bool DialogSocket::receiveLine(std::string& line)
bool DialogSocket::receiveLine(std::string& line, std::size_t lineLengthLimit)
{
// An old wisdom goes: be strict in what you emit
// and generous in what you accept.
int ch = get();
while (ch != EOF_CHAR && ch != '\r' && ch != '\n')
{
line += (char) ch;
if (lineLengthLimit == 0 || line.size() < lineLengthLimit)
line += (char) ch;
else
throw Poco::IOException("Line too long");
ch = get();
}
if (ch == '\r' && peek() == '\n')
@ -254,7 +258,7 @@ bool DialogSocket::receiveLine(std::string& line)
}
int DialogSocket::receiveStatusLine(std::string& line)
int DialogSocket::receiveStatusLine(std::string& line, std::size_t lineLengthLimit)
{
int status = 0;
int ch = get();
@ -274,7 +278,7 @@ int DialogSocket::receiveStatusLine(std::string& line)
status = -status;
}
else status = 0;
if (ch != EOF_CHAR) receiveLine(line);
if (ch != EOF_CHAR) receiveLine(line, lineLengthLimit);
return status;
}

View File

@ -73,6 +73,7 @@ private:
HTMLForm::HTMLForm():
_fieldLimit(DFL_FIELD_LIMIT),
_valueLengthLimit(DFL_MAX_VALUE_LENGTH),
_encoding(ENCODING_URL)
{
}
@ -80,27 +81,31 @@ HTMLForm::HTMLForm():
HTMLForm::HTMLForm(const std::string& encoding):
_fieldLimit(DFL_FIELD_LIMIT),
_valueLengthLimit(DFL_MAX_VALUE_LENGTH),
_encoding(encoding)
{
}
HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler):
_fieldLimit(DFL_FIELD_LIMIT)
_fieldLimit(DFL_FIELD_LIMIT),
_valueLengthLimit(DFL_MAX_VALUE_LENGTH)
{
load(request, requestBody, handler);
}
HTMLForm::HTMLForm(const HTTPRequest& request, std::istream& requestBody):
_fieldLimit(DFL_FIELD_LIMIT)
_fieldLimit(DFL_FIELD_LIMIT),
_valueLengthLimit(DFL_MAX_VALUE_LENGTH)
{
load(request, requestBody);
}
HTMLForm::HTMLForm(const HTTPRequest& request):
_fieldLimit(DFL_FIELD_LIMIT)
_fieldLimit(DFL_FIELD_LIMIT),
_valueLengthLimit(DFL_MAX_VALUE_LENGTH)
{
load(request);
}
@ -300,7 +305,10 @@ void HTMLForm::readUrl(std::istream& istr)
while (ch != eof && ch != '=' && ch != '&')
{
if (ch == '+') ch = ' ';
name += (char) ch;
if (name.size() < MAX_NAME_LENGTH)
name += (char) ch;
else
throw HTMLFormException("Field name too long");
ch = istr.get();
}
if (ch == '=')
@ -309,7 +317,10 @@ void HTMLForm::readUrl(std::istream& istr)
while (ch != eof && ch != '&')
{
if (ch == '+') ch = ' ';
value += (char) ch;
if (value.size() < _valueLengthLimit)
value += (char) ch;
else
throw HTMLFormException("Field value too long");
ch = istr.get();
}
}
@ -363,7 +374,10 @@ void HTMLForm::readMultipart(std::istream& istr, PartHandler& handler)
int ch = istr.get();
while (ch != eof)
{
value += (char) ch;
if (value.size() < _valueLengthLimit)
value += (char) ch;
else
throw HTMLFormException("Field value too long");
ch = istr.get();
}
add(name, value);
@ -445,4 +459,12 @@ void HTMLForm::setFieldLimit(int limit)
}
void HTMLForm::setValueLengthLimit(int limit)
{
poco_assert (limit >= 0);
_valueLengthLimit = limit;
}
} } // namespace Poco::Net

View File

@ -67,7 +67,8 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
int ch = _session.get();
while (Poco::Ascii::isSpace(ch)) ch = _session.get();
std::string chunkLen;
while (Poco::Ascii::isHexDigit(ch)) { chunkLen += (char) ch; ch = _session.get(); }
while (Poco::Ascii::isHexDigit(ch) && chunkLen.size() < 8) { chunkLen += (char) ch; ch = _session.get(); }
if (ch != eof && !(Poco::Ascii::isSpace(ch) || ch == ';')) return eof;
while (ch != eof && ch != '\n') ch = _session.get();
unsigned chunk;
if (NumberParser::tryParseHex(chunkLen, chunk))

View File

@ -32,7 +32,9 @@ HTTPSession::HTTPSession():
_pCurrent(0),
_pEnd(0),
_keepAlive(false),
_timeout(HTTP_DEFAULT_TIMEOUT),
_connectionTimeout(HTTP_DEFAULT_CONNECTION_TIMEOUT),
_receiveTimeout(HTTP_DEFAULT_TIMEOUT),
_sendTimeout(HTTP_DEFAULT_TIMEOUT),
_pException(0)
{
}
@ -44,7 +46,9 @@ HTTPSession::HTTPSession(const StreamSocket& socket):
_pCurrent(0),
_pEnd(0),
_keepAlive(false),
_timeout(HTTP_DEFAULT_TIMEOUT),
_connectionTimeout(HTTP_DEFAULT_CONNECTION_TIMEOUT),
_receiveTimeout(HTTP_DEFAULT_TIMEOUT),
_sendTimeout(HTTP_DEFAULT_TIMEOUT),
_pException(0)
{
}
@ -56,7 +60,9 @@ HTTPSession::HTTPSession(const StreamSocket& socket, bool keepAlive):
_pCurrent(0),
_pEnd(0),
_keepAlive(keepAlive),
_timeout(HTTP_DEFAULT_TIMEOUT),
_connectionTimeout(HTTP_DEFAULT_CONNECTION_TIMEOUT),
_receiveTimeout(HTTP_DEFAULT_TIMEOUT),
_sendTimeout(HTTP_DEFAULT_TIMEOUT),
_pException(0)
{
}
@ -91,7 +97,14 @@ void HTTPSession::setKeepAlive(bool keepAlive)
void HTTPSession::setTimeout(const Poco::Timespan& timeout)
{
_timeout = timeout;
setTimeout(timeout, timeout, timeout);
}
void HTTPSession::setTimeout(const Poco::Timespan& connectionTimeout, const Poco::Timespan& sendTimeout, const Poco::Timespan& receiveTimeout)
{
_connectionTimeout = connectionTimeout;
_sendTimeout = sendTimeout;
_receiveTimeout = receiveTimeout;
}
@ -181,8 +194,9 @@ bool HTTPSession::connected() const
void HTTPSession::connect(const SocketAddress& address)
{
_socket.connect(address, _timeout);
_socket.setReceiveTimeout(_timeout);
_socket.connect(address, _connectionTimeout);
_socket.setReceiveTimeout(_receiveTimeout);
_socket.setSendTimeout(_sendTimeout);
_socket.setNoDelay(true);
// There may be leftover data from a previous (failed) request in the buffer,
// so we clear it.
@ -238,4 +252,11 @@ void HTTPSession::attachSessionData(const Poco::Any& data)
}
void HTTPSession::drainBuffer(Poco::Buffer<char>& buffer)
{
buffer.assign(_pCurrent, static_cast<std::size_t>(_pEnd - _pCurrent));
_pCurrent = _pEnd;
}
} } // namespace Poco::Net

View File

@ -19,6 +19,7 @@
#include "Poco/Net/HTTPServerRequestImpl.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/Net/HTTPServerSession.h"
#include "Poco/Net/NetException.h"
#include "Poco/MemoryStream.h"
#include "Poco/NullStream.h"
@ -144,7 +145,9 @@ WebSocketImpl* WebSocket::accept(HTTPServerRequest& request, HTTPServerResponse&
response.set("Sec-WebSocket-Accept", computeAccept(key));
response.setContentLength(0);
response.send().flush();
return new WebSocketImpl(static_cast<StreamSocketImpl*>(static_cast<HTTPServerRequestImpl&>(request).detachSocket().impl()), false);
HTTPServerRequestImpl& requestImpl = static_cast<HTTPServerRequestImpl&>(request);
return new WebSocketImpl(static_cast<StreamSocketImpl*>(requestImpl.detachSocket().impl()), requestImpl.session(), false);
}
else throw WebSocketException("No WebSocket handshake", WS_ERR_NO_HANDSHAKE);
}
@ -212,7 +215,7 @@ WebSocketImpl* WebSocket::completeHandshake(HTTPClientSession& cs, HTTPResponse&
std::string accept = response.get("Sec-WebSocket-Accept", "");
if (accept != computeAccept(key))
throw WebSocketException("Invalid or missing Sec-WebSocket-Accept header in handshake response", WS_ERR_HANDSHAKE_ACCEPT);
return new WebSocketImpl(static_cast<StreamSocketImpl*>(cs.detachSocket().impl()), true);
return new WebSocketImpl(static_cast<StreamSocketImpl*>(cs.detachSocket().impl()), cs, true);
}

View File

@ -17,6 +17,7 @@
#include "Poco/Net/WebSocketImpl.h"
#include "Poco/Net/NetException.h"
#include "Poco/Net/WebSocket.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Buffer.h"
#include "Poco/BinaryWriter.h"
#include "Poco/BinaryReader.h"
@ -29,14 +30,17 @@ namespace Poco {
namespace Net {
WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, bool mustMaskPayload):
WebSocketImpl::WebSocketImpl(StreamSocketImpl* pStreamSocketImpl, HTTPSession& session, bool mustMaskPayload):
StreamSocketImpl(pStreamSocketImpl->sockfd()),
_pStreamSocketImpl(pStreamSocketImpl),
_buffer(0),
_bufferOffset(0),
_frameFlags(0),
_mustMaskPayload(mustMaskPayload)
{
poco_check_ptr(pStreamSocketImpl);
_pStreamSocketImpl->duplicate();
session.drainBuffer(_buffer);
}
@ -211,12 +215,12 @@ int WebSocketImpl::receiveBytes(Poco::Buffer<char>& buffer, int)
int WebSocketImpl::receiveNBytes(void* buffer, int bytes)
{
int received = _pStreamSocketImpl->receiveBytes(reinterpret_cast<char*>(buffer), bytes);
int received = receiveSomeBytes(reinterpret_cast<char*>(buffer), bytes);
if (received > 0)
{
while (received < bytes)
{
int n = _pStreamSocketImpl->receiveBytes(reinterpret_cast<char*>(buffer) + received, bytes - received);
int n = receiveSomeBytes(reinterpret_cast<char*>(buffer) + received, bytes - received);
if (n > 0)
received += n;
else
@ -227,6 +231,23 @@ int WebSocketImpl::receiveNBytes(void* buffer, int bytes)
}
int WebSocketImpl::receiveSomeBytes(char* buffer, int bytes)
{
int n = _buffer.size() - _bufferOffset;
if (n > 0)
{
if (bytes < n) n = bytes;
std::memcpy(buffer, _buffer.begin() + _bufferOffset, n);
_bufferOffset += n;
return n;
}
else
{
return _pStreamSocketImpl->receiveBytes(buffer, bytes);
}
}
SocketImpl* WebSocketImpl::acceptConnection(SocketAddress& clientAddr)
{
throw Poco::InvalidAccessException("Cannot acceptConnection() on a WebSocketImpl");

View File

@ -163,7 +163,7 @@ public:
protected:
int run();
void waitForTerminationRequest();
virtual void waitForTerminationRequest();
#if !defined(_WIN32_WCE)
void defineOptions(OptionSet& options);
#endif

View File

@ -90,7 +90,7 @@ RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES -DPOCO_NO_FORK_EXEC
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_SOCKETADDRESS_DONT_PREFER_IPV4 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES -DPOCO_NO_FORK_EXEC
#
# System Specific Libraries

View File

@ -1,10 +1,11 @@
#
# $Id
# $Id$
#
# Darwin
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.9 (clang++, libc++, x86_64)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
include $(POCO_BASE)/build/config/Darwin-clang
include $(POCO_BASE)/build/config/Darwin-clang-libc++

View File

@ -3,8 +3,10 @@
#
# Darwin-clang
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.7 (clang, libstdc++, x86_64)
#
# NOTE: This build configuration will build 64-bit binaries.
# Use the Darwin32-clang build configuration to build 32-bit binaries.
#
#
@ -14,9 +16,10 @@ LINKMODE ?= SHARED
POCO_TARGET_OSARCH ?= x86_64
POCO_HOST_OSARCH := $(POCO_TARGET_OSARCH)
ARCHFLAGS ?= -arch $(POCO_TARGET_OSARCH)
ARCHFLAGS ?= -arch $(POCO_TARGET_OSARCH)
OSFLAGS ?= -mmacosx-version-min=10.7
OPENSSL_DIR ?= /usr/local/opt/openssl/
OPENSSL_DIR ?= /usr/local/opt/openssl
ifeq ($(POCO_TARGET_OSARCH),i386)
RORELOCS = -read_only_relocs suppress
@ -49,11 +52,11 @@ SHAREDLIBLINKEXT = .dylib
#
# Compiler and Linker Flags
#
CFLAGS = $(ARCHFLAGS)
CXXFLAGS = $(ARCHFLAGS) -std=c++11 -stdlib=libc++ -Wall -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration
LINKFLAGS = $(ARCHFLAGS) -stdlib=libc++
SHLIBFLAGS = $(ARCHFLAGS) -stdlib=libc++
DYLIBFLAGS = $(ARCHFLAGS) -stdlib=libc++
CFLAGS = $(ARCHFLAGS) $(OSFLAGS)
CXXFLAGS = $(ARCHFLAGS) $(OSFLAGS) -std=c++03 -stdlib=libstdc++ -Wall -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration
LINKFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libstdc++
SHLIBFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libstdc++
DYLIBFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libstdc++
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK =
@ -75,4 +78,4 @@ SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64 -I$(OPENSSL_DIR)/include
#
# System Specific Libraries
#
SYSLIBS = -L$(OPENSSL_DIR)/lib -ldl
SYSLIBS = -L$(OPENSSL_DIR)/lib -ldl

View File

@ -3,10 +3,81 @@
#
# Darwin-clang-libc++
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
#
# Note: provided for backwards compatibility.
# Build settings for Mac OS X 10.9 (clang, libc++, x86_64)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
# NOTE: This build configuration will build 64-bit binaries.
# Use the Darwin32-clang-libc++ build configuration to build 32-bit binaries.
#
include $(POCO_BASE)/build/config/Darwin-clang
#
# General Settings
#
LINKMODE ?= SHARED
POCO_TARGET_OSARCH ?= x86_64
POCO_HOST_OSARCH := $(POCO_TARGET_OSARCH)
ARCHFLAGS ?= -arch $(POCO_TARGET_OSARCH)
OSFLAGS ?= -mmacosx-version-min=10.9
OPENSSL_DIR ?= /usr/local/opt/openssl
ifeq ($(POCO_TARGET_OSARCH),i386)
RORELOCS = -read_only_relocs suppress
endif
#
# Tools
#
CC = $(shell xcrun -find clang)
CXX = $(shell xcrun -find clang++)
LINK = $(CXX) -bind_at_load
LIB = libtool -static -o
RANLIB = ranlib
SHLIB = $(CXX) -dynamiclib -Wl,-install_name,$(POCO_LIB_INSTALLDIR)/$(notdir \$@) -o $@
DYLIB = $(CXX) -dynamic -bundle $(RORELOCS) -Wl,-bind_at_load -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
STRIP =
DEP = $(POCO_BASE)/build/script/makedepend.clang
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .$(target_version).dylib
SHAREDLIBLINKEXT = .dylib
#
# Compiler and Linker Flags
#
CFLAGS = $(ARCHFLAGS) $(OSFLAGS)
CXXFLAGS = $(ARCHFLAGS) $(OSFLAGS) -std=c++11 -stdlib=libc++ -Wall -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration
LINKFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libc++
SHLIBFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libc++
DYLIBFLAGS = $(ARCHFLAGS) $(OSFLAGS) -stdlib=libc++
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK =
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK =
DEBUGOPT_CC = -O0 -g -gdwarf-2 -fasm-blocks -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_CXX = -O0 -g -gdwarf-2 -fasm-blocks -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_LINK =
RELEASEOPT_CC = -DNDEBUG -Os -fasm-blocks
RELEASEOPT_CXX = -DNDEBUG -O2 -fasm-blocks
RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64 -I$(OPENSSL_DIR)/include
#
# System Specific Libraries
#
SYSLIBS = -L$(OPENSSL_DIR)/lib -ldl

View File

@ -1,13 +1,14 @@
#
# $Id
# $Id$
#
# Darwin32
#
# Build settings for Mac OS X 10.8 or later, clang, 32-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.9 (clang, libc++, i386)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
ARCHFLAGS = -arch i386
POCO_TARGET_OSARCH = i386
include $(POCO_BASE)/build/config/Darwin-clang
include $(POCO_BASE)/build/config/Darwin-clang-libc++

View File

@ -3,8 +3,7 @@
#
# Darwin32-clang
#
# Build settings for Mac OS X 10.8 or later, clang, 32-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.7 (clang, libstdc++, i386)
#
ARCHFLAGS = -arch i386

View File

@ -3,13 +3,12 @@
#
# Darwin32-clang-libc++
#
# Build settings for Mac OS X 10.8 or later, clang, 32-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
#
# Note: provided for backwards compatibility.
#
# Build settings for Mac OS X 10.9 (clang, libc++, i386)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
ARCHFLAGS = -arch i386
POCO_TARGET_OSARCH = i386
include $(POCO_BASE)/build/config/Darwin-clang
include $(POCO_BASE)/build/config/Darwin-clang-libc++

View File

@ -1,13 +1,14 @@
#
# $Id
# $Id$
#
# Darwin64
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.9 (clang, libc++, x86_64)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
ARCHFLAGS = -arch x86_64
POCO_TARGET_OSARCH = x86_64
include $(POCO_BASE)/build/config/Darwin-clang
include $(POCO_BASE)/build/config/Darwin-clang-libc++

View File

@ -3,8 +3,7 @@
#
# Darwin64-clang
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
# Build settings for Mac OS X 10.7 (clang, libstdc++, x86_64)
#
ARCHFLAGS = -arch x86_64

View File

@ -3,13 +3,12 @@
#
# Darwin64-clang-libc++
#
# Build settings for Mac OS X 10.8 or later, clang, 64-bits, with C++11 support.
# Build settings are compatible with XCode 7 C++ projects.
#
# Note: provided for backwards compatibility.
#
# Build settings for Mac OS X 10.9 (clang, libc++, x86_64)
# The build settings defined in this file are compatible
# with XCode C++ projects.
#
ARCHFLAGS = -arch x86_64
POCO_TARGET_OSARCH = x86_64
include $(POCO_BASE)/build/config/Darwin-clang
include $(POCO_BASE)/build/config/Darwin-clang-libc++

View File

@ -90,7 +90,7 @@ RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES -DPOCO_NO_FORK_EXEC
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_SOCKETADDRESS_DONT_PREFER_IPV4 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES -DPOCO_NO_FORK_EXEC
#
# System Specific Libraries

View File

@ -1,5 +1,5 @@
#
# $Id: //poco/1.4/build/config/iPhone#4 $
# $Id: //poco/1.4/build/config/iPhone#2 $
#
# iPhone
#
@ -23,22 +23,23 @@ LINKMODE ?= STATIC
# Otherwise use the version found.
IPHONE_SDK ?= iPhoneOS
IPHONE_SDK_ROOT = $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/SDKs
IPHONE_SDK_ROOT ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/SDKs
IPHONE_SDK_ROOT_DIR = $(IPHONE_SDK_ROOT)/$(IPHONE_SDK)
IPHONE_SDK_BASE = $(shell ls -d $(IPHONE_SDK_ROOT_DIR)$(IPHONE_SDK_VERSION)*.sdk | tail -1)
IPHONE_SDK_VERSION_MIN ?= $(patsubst %.sdk,%,$(patsubst $(IPHONE_SDK_ROOT_DIR)%,%,$(IPHONE_SDK_BASE)))
POCO_TARGET_OSNAME ?= $(IPHONE_SDK)
POCO_TARGET_OSARCH ?= armv6
POCO_TARGET_OSARCH ?= arm64
TOOL_PREFIX ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -mthumb -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN) -fembed-bitcode
ifneq ($(POCO_TARGET_OSARCH),arm64)
THUMB = -mthumb
endif
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) $(THUMB) -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN) -fembed-bitcode
#
# Tools
#
# If GCC_VER is defined then use it.
# Otherwise select the latest version
#
CC = $(shell xcrun -find clang)
CXX = $(shell xcrun -find clang++)
@ -67,10 +68,10 @@ SHAREDLIBLINKEXT = .dylib
CFLAGS = $(OSFLAGS)
CFLAGS32 =
CFLAGS64 =
CXXFLAGS = $(OSFLAGS) -Wall -Wno-sign-compare
CXXFLAGS = $(OSFLAGS) -std=gnu++11 -stdlib=libc++ -Wall -Wno-sign-compare
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS = $(OSFLAGS)
LINKFLAGS = $(OSFLAGS) -stdlib=libc++
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC =
@ -89,7 +90,7 @@ RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_SOCKETADDRESS_DONT_PREFER_IPV4 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES
#
# System Specific Libraries

View File

@ -6,96 +6,4 @@
# Build settings for iPhone OS, using Apple's iPhone SDK
#
#
# General Settings
#
# iPhone OS does not allow dynamic linking to user libraries
#
LINKMODE ?= STATIC
#
# If the SDK is defined use it
# Otherwise find the latest version installed
#
# IPHONE_SDK_VERSION = 2.2.1
# if IPHONE_SDK_VERSION_MIN is defined use that
# Otherwise use the version found.
IPHONE_SDK ?= iPhoneOS
IPHONE_SDK_ROOT ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/SDKs
IPHONE_SDK_ROOT_DIR = $(IPHONE_SDK_ROOT)/$(IPHONE_SDK)
IPHONE_SDK_BASE = $(shell ls -d $(IPHONE_SDK_ROOT_DIR)$(IPHONE_SDK_VERSION)*.sdk | tail -1)
IPHONE_SDK_VERSION_MIN ?= $(patsubst %.sdk,%,$(patsubst $(IPHONE_SDK_ROOT_DIR)%,%,$(IPHONE_SDK_BASE)))
POCO_TARGET_OSNAME ?= $(IPHONE_SDK)
POCO_TARGET_OSARCH ?= armv7
TOOL_PREFIX ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin
ifneq ($(POCO_TARGET_OSARCH),arm64)
THUMB = -mthumb
endif
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) $(THUMB) -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
#
# Tools
#
# If GCC_VER is defined then use it.
# Otherwise select the latest version
#
CC = $(shell xcrun -find clang)
CXX = $(shell xcrun -find clang++)
LINK = $(CXX) -bind_at_load
LIB = libtool -static -o
RANLIB = ranlib
SHLIB = $(CXX) $(OSFLAGS) -dynamiclib -Wl,-install_name,$@ -o $@
DYLIB = $(CXX) $(OSFLAGS) -dynamic -bundle -read_only_relocs suppress -Wl,-bind_at_load -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
STRIP =
DEP = $(POCO_BASE)/build/script/makedepend.gcc
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .$(target_version).dylib
SHAREDLIBLINKEXT = .dylib
#
# Compiler and Linker Flags
#
CFLAGS = $(OSFLAGS)
CFLAGS32 =
CFLAGS64 =
CXXFLAGS = $(OSFLAGS) -Wall -Wno-sign-compare
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS = $(OSFLAGS)
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK =
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK =
DEBUGOPT_CC = -g -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_CXX = -g -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_LINK =
RELEASEOPT_CC = -DNDEBUG -O2
RELEASEOPT_CXX = -DNDEBUG -O
RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES
#
# System Specific Libraries
#
SYSLIBS = -ldl
include $(POCO_BASE)/build/config/iPhone

View File

@ -6,96 +6,4 @@
# Build settings for iPhone OS, using Apple's iPhone SDK
#
#
# General Settings
#
# iPhone OS does not allow dynamic linking to user libraries
#
LINKMODE ?= STATIC
#
# If the SDK is defined use it
# Otherwise find the latest version installed
#
# IPHONE_SDK_VERSION = 2.2.1
# if IPHONE_SDK_VERSION_MIN is defined use that
# Otherwise use the version found.
IPHONE_SDK ?= iPhoneOS
IPHONE_SDK_ROOT ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/SDKs
IPHONE_SDK_ROOT_DIR = $(IPHONE_SDK_ROOT)/$(IPHONE_SDK)
IPHONE_SDK_BASE = $(shell ls -d $(IPHONE_SDK_ROOT_DIR)$(IPHONE_SDK_VERSION)*.sdk | tail -1)
IPHONE_SDK_VERSION_MIN ?= $(patsubst %.sdk,%,$(patsubst $(IPHONE_SDK_ROOT_DIR)%,%,$(IPHONE_SDK_BASE)))
POCO_TARGET_OSNAME ?= $(IPHONE_SDK)
POCO_TARGET_OSARCH ?= armv7
TOOL_PREFIX ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin
ifneq ($(POCO_TARGET_OSARCH),arm64)
THUMB = -mthumb
endif
OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) $(THUMB) -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
#
# Tools
#
# If GCC_VER is defined then use it.
# Otherwise select the latest version
#
CC = $(shell xcrun -find clang)
CXX = $(shell xcrun -find clang++)
LINK = $(CXX) -bind_at_load
LIB = libtool -static -o
RANLIB = ranlib
SHLIB = $(CXX) $(OSFLAGS) -dynamiclib -Wl,-install_name,$@ -o $@
DYLIB = $(CXX) $(OSFLAGS) -dynamic -bundle -read_only_relocs suppress -Wl,-bind_at_load -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
STRIP =
DEP = $(POCO_BASE)/build/script/makedepend.gcc
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .$(target_version).dylib
SHAREDLIBLINKEXT = .dylib
#
# Compiler and Linker Flags
#
CFLAGS = $(OSFLAGS)
CFLAGS32 =
CFLAGS64 =
CXXFLAGS = $(OSFLAGS) -std=c++11 -stdlib=libc++ -Wall -Wno-sign-compare
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS = $(OSFLAGS) -stdlib=libc++
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK =
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK =
DEBUGOPT_CC = -g -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_CXX = -g -D_DEBUG=$(DEBUGLEVEL)
DEBUGOPT_LINK =
RELEASEOPT_CC = -DNDEBUG -O2
RELEASEOPT_CXX = -DNDEBUG -O
RELEASEOPT_LINK =
#
# System Specific Flags
#
SYSFLAGS = -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES
#
# System Specific Libraries
#
SYSLIBS = -ldl
include $(POCO_BASE)/build/config/iPhone

2
configure vendored
View File

@ -181,7 +181,7 @@ while [ $# -ge 1 ]; do
odbcinclude="`echo ${1} | awk '{print substr($0,16)}'`" ;;
--cflags=*)
flags="`echo ${1} | awk '{print substr($0,10)}'`" ;;
flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;;
--no-samples)
samples="" ;;