backported #2603 and CppParser fixes; updated changelog

This commit is contained in:
Günter Obiltschnig
2019-08-19 17:58:50 +02:00
parent 2ea1d28acc
commit b4846a220e
11 changed files with 224 additions and 92 deletions

View File

@@ -1,14 +1,18 @@
This is the changelog file for the POCO C++ Libraries.
Release 1.9.3 (2019-08-xx)
Release 1.9.3 (2019-08-20)
==========================
- fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win
- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix)
- fixed GH #2742: Support of vs150 & vs160 with the official Microsoft localization executable,
vswhere.exe, installed by MSVC starting from VS2017
- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix)
- fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win
- Data/ODBC: make binding of std::string configurable (SQL_LONGVARCHAR - default or SQL_VARCHAR)
through a global setting (Poco::Data::ODBC::Connector::bindStringToLongVarChar()).
- added Poco::SharedLibrary::setSearchPath() (currently implemented on Windows only)
- Windows required minimum version is now Windows XP SP2
- upgraded bundled SQLite to 3.29.0
- CppParser now supports type aliases defined with using keyword.
Release 1.9.2 (2019-07-02)

View File

@@ -37,7 +37,7 @@ public:
typedef SymbolTable::const_iterator Iterator;
typedef std::map<std::string, std::string> AliasMap;
typedef std::vector<std::string> NameSpaceVec;
NameSpace();
/// Creates the NameSpace.
@@ -46,53 +46,56 @@ public:
~NameSpace();
/// Destroys the NameSpace.
void addSymbol(Symbol* pSymbol);
/// Adds a symbol to the namespace.
void importSymbol(const std::string& fullName);
/// Imports a symbol from another namespace (using <symbol>).
void importNameSpace(const std::string& nameSpace);
/// Imports a namespace (using namespace <namespace>).
Iterator begin() const;
/// Returns an iterator for iterating over the NameSpace's Symbol's.
Iterator end() const;
/// Returns an iterator for iterating over the NameSpace's Symbol's.
Symbol* lookup(const std::string& name) const;
/// Looks up the given name in the symbol table
/// and returns the corresponsing symbol, or null
/// if no symbol can be found. The name can include
/// a namespace.
static NameSpace* root();
/// Returns the root namespace. Never delete this one!
void nameSpaces(SymbolTable& table) const;
/// Fills the symbol table with all namespaces.
void typeDefs(SymbolTable& table) const;
/// Fills the symbol table with all type definitions.
void typeAliases(SymbolTable& table) const;
/// Fills the symbol table with all type alias (using) definitions.
void enums(SymbolTable& table) const;
/// Fills the symbol table with all enums.
void classes(SymbolTable& table) const;
/// Fills the symbol table with all classes and structs.
void functions(SymbolTable& table) const;
/// Fills the symbol table with all functions.
void variables(SymbolTable& table) const;
/// Fills the symbol table with all variables.
const AliasMap& importedSymbols() const;
/// Returns a const reference to a SymbolTable containing all
/// imported symbols.
const NameSpaceVec& importedNameSpaces() const;
/// Returns a vector containing all imported namespaces.
@@ -125,7 +128,7 @@ inline const NameSpace::AliasMap& NameSpace::importedSymbols() const
return _importedSymbols;
}
inline const NameSpace::NameSpaceVec& NameSpace::importedNameSpaces() const
{
return _importedNameSpaces;

View File

@@ -46,21 +46,22 @@ public:
SYM_PARAMETER, /// A function parameter
SYM_STRUCT, /// A struct or class
SYM_TYPEDEF, /// A typedef
SYM_TYPEALIAS, /// A type alias (using)
SYM_BUILTIN, /// A built-in type
SYM_VARIABLE /// A (member) variable
};
enum Access
{
ACC_PUBLIC, /// public access
ACC_PROTECTED, /// protected access
ACC_PRIVATE /// private access
};
Symbol();
/// Creates the Symbol and assigns the symbol
/// a unique ID.
Symbol(const std::string& name, NameSpace* pNameSpace = 0);
/// Creates the Symbol and assigns the symbol
/// a unique ID.
@@ -73,87 +74,87 @@ public:
const std::string& name() const;
/// Returns the symbol's (local) name.
NameSpace* nameSpace() const;
/// Returns the symbol's namespace which
/// may be null.
void setAccess(Access v);
/// Sets the symbol's access.
Access getAccess() const;
/// Returns the symbol's access.
void setDocumentation(const std::string& text);
/// Sets the symbol's documentation.
void addDocumentation(const std::string& text);
/// Adds text to the symbol's documentation.
const std::string& getDocumentation() const;
/// Returns the symbol's documentation.
void setFile(const std::string& path);
/// Sets the file where the symbol is declared.
const std::string& getFile() const;
/// Returns the file where the symbol is defined.
void setLineNumber(int line);
/// Sets the line number of the symbol's declaration.
int getLineNumber() const;
/// Returns the line number of the symbol's declaration.
void setPackage(const std::string& package);
/// Sets the symbol's package.
const std::string& getPackage() const;
/// Returns the symbol's package.
void setLibrary(const std::string& library);
/// Sets the symbol's library.
const std::string& getLibrary() const;
/// Returns the symbol's library.
const Attributes& attrs() const;
/// Returns the symbol's attributes.
Attributes& attrs();
/// Returns the symbol's attributes.
const Attributes& getAttributes() const;
/// Returns the symbol's attributes.
void setAttributes(const Attributes& attrs);
/// Sets the symbol's attributes.
std::string fullName() const;
/// Returns the symbol's fully qualified name.
static std::string extractName(const std::string& decl);
/// Extracts the name from the declaration.
virtual Kind kind() const = 0;
/// Returns the symbol's kind.
virtual std::string toString() const = 0;
/// Returns a string representation of the symbol.
bool isPublic() const;
/// Returns true iff the symbol is public.
bool isProtected() const;
/// Returns true iff the symbol is public.
bool isPrivate() const;
/// Returns true iff the symbol is public.
protected:
static bool isIdent(char c);
static bool hasAttr(const std::string& decl, const std::string& attr);
private:
Symbol(const Symbol&);
Symbol& operator = (const Symbol&);
@@ -168,7 +169,7 @@ private:
std::string _package;
std::string _library;
Attributes _attrs;
static int _nextId;
};

View File

@@ -37,7 +37,24 @@ public:
/// Destroys the TypeDef.
Symbol::Kind kind() const;
std::string baseType() const;
/// Returns the underlying base type.
};
class CppParser_API TypeAlias: public Decl
/// This class represents a type alias definition (using).
{
public:
TypeAlias(const std::string& decl, NameSpace* pNameSpace);
/// Creates the TypeAlias.
~TypeAlias();
/// Destroys the TypeAlias.
Symbol::Kind kind() const;
std::string baseType() const;
/// Returns the underlying base type.
};

View File

@@ -49,7 +49,7 @@ NameSpace::~NameSpace()
void NameSpace::addSymbol(Symbol* pSymbol)
{
poco_check_ptr (pSymbol);
_symbols.insert(SymbolTable::value_type(pSymbol->name(), pSymbol));
}
@@ -65,7 +65,7 @@ void NameSpace::importSymbol(const std::string& fullName)
}
}
void NameSpace::importNameSpace(const std::string& nameSpace)
{
_importedNameSpaces.push_back(nameSpace);
@@ -94,7 +94,7 @@ Symbol* NameSpace::lookup(const std::string& name) const
Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& alreadyVisited) const
{
Symbol* pSymbol = 0;
if (name.empty())
return pSymbol;
@@ -103,12 +103,12 @@ Symbol* NameSpace::lookup(const std::string& name, std::set<const NameSpace*>& a
std::string head;
std::string tail;
splitName(name, head, tail);
alreadyVisited.insert(this);
bool currentNSInserted = true;
if (head.empty())
if (head.empty())
{
alreadyVisited.insert(this);
return root()->lookup(tail, alreadyVisited);
@@ -161,31 +161,37 @@ void NameSpace::nameSpaces(SymbolTable& table) const
extract(Symbol::SYM_NAMESPACE, table);
}
void NameSpace::typeDefs(SymbolTable& table) const
{
extract(Symbol::SYM_TYPEDEF, table);
}
void NameSpace::typeAliases(SymbolTable& table) const
{
extract(Symbol::SYM_TYPEALIAS, table);
}
void NameSpace::enums(SymbolTable& table) const
{
extract(Symbol::SYM_ENUM, table);
}
void NameSpace::classes(SymbolTable& table) const
{
extract(Symbol::SYM_STRUCT, table);
}
void NameSpace::functions(SymbolTable& table) const
{
extract(Symbol::SYM_FUNCTION, table);
}
void NameSpace::variables(SymbolTable& table) const
{
extract(Symbol::SYM_VARIABLE, table);
@@ -220,7 +226,7 @@ void NameSpace::splitName(const std::string& name, std::string& head, std::strin
head.assign(name, 0, pos);
pos += 2;
poco_assert (pos < name.length());
tail.assign(name, pos, name.length() - pos);
tail.assign(name, pos, name.length() - pos);
}
else head = name;
}

View File

@@ -108,7 +108,12 @@ bool Parameter::vectorType(const std::string& type, NameSpace* pNS)
if (pSym->kind() == Symbol::SYM_TYPEDEF)
{
TypeDef* pType = static_cast<TypeDef*>(pSym);
ret = pType->declaration().find("vector") != std::string::npos;
ret = pType->baseType().find("vector") != std::string::npos;
}
else if (pSym->kind() == Symbol::SYM_TYPEALIAS)
{
TypeAlias* pType = static_cast<TypeAlias*>(pSym);
ret = pType->baseType().find("vector") != std::string::npos;
}
}
}

View File

@@ -58,7 +58,7 @@ Parser::Parser(NameSpace::SymbolTable& gst, const std::string& file, std::istrea
p.makeAbsolute();
_path = p.toString();
_currentPath = _path;
_nsStack.push_back(NameSpace::root());
}
@@ -205,7 +205,7 @@ const Token* Parser::parseFile(const Token* pNext)
const Token* Parser::parseNameSpace(const Token* pNext)
{
poco_assert (isKeyword(pNext, IdentifierToken::KW_NAMESPACE));
pNext = next();
if (pNext->is(Token::IDENTIFIER_TOKEN))
{
@@ -213,11 +213,11 @@ const Token* Parser::parseNameSpace(const Token* pNext)
std::string name = pNext->tokenString();
pNext = next();
expectOperator(pNext, OperatorToken::OP_OPENBRACE, "{");
std::string fullName = currentNameSpace()->fullName();
if (!fullName.empty()) fullName += "::";
fullName += name;
NameSpace* pNS = dynamic_cast<NameSpace*>(currentNameSpace()->lookup(fullName));
bool undefined = (pNS == 0);
if (undefined) pNS = new NameSpace(name, currentNameSpace());
@@ -376,7 +376,7 @@ const Token* Parser::parseBaseClassList(const Token* pNext, Struct* pClass)
const Token* Parser::parseClassMembers(const Token* pNext, Struct* pClass)
{
poco_assert (isOperator(pNext, OperatorToken::OP_OPENBRACE));
pNext = next();
while (pNext->is(Token::IDENTIFIER_TOKEN) || pNext->is(Token::KEYWORD_TOKEN) || isOperator(pNext, OperatorToken::OP_COMPL))
{
@@ -452,7 +452,7 @@ const Token* Parser::parseTemplate(const Token* pNext)
const Token* Parser::parseTemplateArgs(const Token* pNext, std::string& decl)
{
poco_assert (isOperator(pNext, OperatorToken::OP_LT));
append(decl, pNext);
int depth = 1;
pNext = next();
@@ -492,7 +492,9 @@ const Token* Parser::parseTypeDef(const Token* pNext)
const Token* Parser::parseUsing(const Token* pNext)
{
poco_assert (isKeyword(pNext, IdentifierToken::KW_USING));
_pCurrentSymbol = 0;
int line = _istr.getCurrentLineNumber();
pNext = next();
if (isKeyword(pNext, IdentifierToken::KW_NAMESPACE))
{
@@ -511,20 +513,39 @@ const Token* Parser::parseUsing(const Token* pNext)
{
std::string id;
pNext = parseIdentifier(pNext, id);
currentNameSpace()->importSymbol(id);
}
if (isOperator(pNext, OperatorToken::OP_ASSIGN))
{
pNext = next();
std::string decl("using ");
decl += id;
decl += " = ";
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !isEOF(pNext))
{
append(decl, pNext);
pNext = next();
}
TypeAlias* pTypeAlias = new TypeAlias(decl, currentNameSpace());
addSymbol(pTypeAlias, line);
}
else
{
currentNameSpace()->importSymbol(id);
}
}
}
if (!isOperator(pNext, OperatorToken::OP_SEMICOLON))
syntaxError("semicolon");
return next();
pNext = next();
_pCurrentSymbol = 0;
return pNext;
}
const Token* Parser::parseFriend(const Token* pNext)
{
poco_assert (isKeyword(pNext, IdentifierToken::KW_FRIEND));
pNext = next();
while (!isOperator(pNext, OperatorToken::OP_SEMICOLON) && !isEOF(pNext))
@@ -593,7 +614,7 @@ const Token* Parser::parseVarFunc(const Token* pNext, std::string& decl)
const Token* Parser::parseExtern(const Token* pNext)
{
poco_assert (isKeyword(pNext, IdentifierToken::KW_EXTERN));
pNext = next();
if (pNext->is(Token::STRING_LITERAL_TOKEN))
pNext = next();
@@ -628,7 +649,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
expectOperator(pNext, OperatorToken::OP_CLOSPARENT, ")");
pNext = next();
while (pNext->is(Poco::Token::IDENTIFIER_TOKEN) || pNext->is(Poco::Token::KEYWORD_TOKEN))
{
{
if (isKeyword(pNext, IdentifierToken::KW_CONST))
{
if (pFunc) pFunc->makeConst();
@@ -636,7 +657,7 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
}
if (isKeyword(pNext, IdentifierToken::KW_THROW))
{
while (!isOperator(pNext, OperatorToken::OP_ASSIGN) && !isOperator(pNext, OperatorToken::OP_SEMICOLON) &&
while (!isOperator(pNext, OperatorToken::OP_ASSIGN) && !isOperator(pNext, OperatorToken::OP_SEMICOLON) &&
!isOperator(pNext, OperatorToken::OP_OPENBRACE) && !isEOF(pNext))
pNext = next();
}
@@ -693,16 +714,16 @@ const Token* Parser::parseFunc(const Token* pNext, std::string& decl)
pNext = next();
pNext = parseBlock(pNext);
if (isKeyword(pNext, IdentifierToken::KW_CATCH))
{
while (!isOperator(pNext, OperatorToken::OP_OPENBRACE) && !isEOF(pNext))
pNext = next();
pNext = parseBlock(pNext);
}
else syntaxError("expected catch block");
if (!pFunc)
pFunc = dynamic_cast<Function*>(currentNameSpace()->lookup(name));
if (pFunc)
@@ -755,7 +776,7 @@ const Token* Parser::parseParameters(const Token* pNext, Function* pFunc)
const Token* Parser::parseBlock(const Token* pNext)
{
poco_assert (isOperator(pNext, OperatorToken::OP_OPENBRACE));
pNext = next();
int depth = 1;
while (depth > 0 && !isEOF(pNext))

View File

@@ -54,4 +54,37 @@ std::string TypeDef::baseType() const
}
TypeAlias::TypeAlias(const std::string& decl, NameSpace* pNameSpace):
Decl(decl, pNameSpace)
{
}
TypeAlias::~TypeAlias()
{
}
Symbol::Kind TypeAlias::kind() const
{
return Symbol::SYM_TYPEALIAS;
}
std::string TypeAlias::baseType() const
{
std::string decl = declaration();
if (decl.compare(0, 5, "using") == 0)
{
decl.erase(0, 5);
std::string::size_type pos = 0;
while (pos < decl.size() && std::isspace(decl[pos])) pos++;
while (pos < decl.size() && decl[pos] != '=') pos++;
decl.erase(0, pos);
Poco::trimInPlace(decl);
}
return decl;
}
} } // namespace Poco::CppParser

View File

@@ -29,7 +29,7 @@ namespace Net {
class NetSSL_Win_API SecureSMTPClientSession: public SMTPClientSession
/// This class implements an Simple Mail
/// Transfer Procotol (SMTP, RFC 2821)
/// Transfer Protocol (SMTP, RFC 2821)
/// client for sending e-mail messages that
/// supports the STARTTLS command for secure
/// connections.
@@ -59,7 +59,7 @@ public:
/// Destroys the SMTPClientSession.
bool startTLS();
/// Sends a STARTTLS command and, if successful,
/// Sends a STARTTLS command and, if successful,
/// creates a secure SSL/TLS connection over the
/// existing socket connection.
///
@@ -71,7 +71,7 @@ public:
/// false otherwise.
bool startTLS(Context::Ptr pContext);
/// Sends a STARTTLS command and, if successful,
/// Sends a STARTTLS command and, if successful,
/// creates a secure SSL/TLS connection over the
/// existing socket connection.
///

View File

@@ -39,7 +39,7 @@ const std::string Context::CERT_STORE_USERDS("USERDS");
Context::Context(Usage usage,
const std::string& certNameOrPath,
const std::string& certNameOrPath,
VerificationMode verMode,
int options,
const std::string& certStore):
@@ -314,7 +314,7 @@ void Context::acquireSchannelCredentials(CredHandle& credHandle) const
SECURITY_STATUS status = _securityFunctions.AcquireCredentialsHandleW(
NULL,
UNISP_NAME_W,
isForServerUse() ? SECPKG_CRED_INBOUND : SECPKG_CRED_OUTBOUND,
isForServerUse() ? SECPKG_CRED_INBOUND : SECPKG_CRED_OUTBOUND,
NULL,
&schannelCred,
NULL,
@@ -334,18 +334,56 @@ DWORD Context::proto() const
switch (_usage)
{
case Context::CLIENT_USE:
return SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_CLIENT;
return SP_PROT_SSL3_CLIENT
| SP_PROT_TLS1_CLIENT
#if defined(SP_PROT_TLS1_1)
| SP_PROT_TLS1_1_CLIENT
#endif
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_CLIENT
#endif
;
case Context::SERVER_USE:
return SP_PROT_SSL3_SERVER | SP_PROT_TLS1_SERVER;
return SP_PROT_SSL3_SERVER
| SP_PROT_TLS1_SERVER
#if defined(SP_PROT_TLS1_1)
| SP_PROT_TLS1_1_SERVER
#endif
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_SERVER
#endif
;
case Context::TLSV1_CLIENT_USE:
return SP_PROT_TLS1_CLIENT;
return SP_PROT_TLS1_CLIENT
#if defined(SP_PROT_TLS1_1)
| SP_PROT_TLS1_1_CLIENT
#endif
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_CLIENT
#endif
;
case Context::TLSV1_SERVER_USE:
return SP_PROT_TLS1_SERVER;
return SP_PROT_TLS1_SERVER
#if defined(SP_PROT_TLS1_1)
| SP_PROT_TLS1_1_SERVER
#endif
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_SERVER
#endif
;
#if defined(SP_PROT_TLS1_1)
case Context::TLSV1_1_CLIENT_USE:
return SP_PROT_TLS1_1_CLIENT;
return SP_PROT_TLS1_1_CLIENT
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_CLIENT
#endif
;
case Context::TLSV1_1_SERVER_USE:
return SP_PROT_TLS1_1_SERVER;
return SP_PROT_TLS1_1_SERVER
#if defined(SP_PROT_TLS1_2)
| SP_PROT_TLS1_2_SERVER
#endif
;
#endif
#if defined(SP_PROT_TLS1_2)
case Context::TLSV1_2_CLIENT_USE:

View File

@@ -5,12 +5,16 @@ AAAIntroduction
!!Summary of Changes
- fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win
- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix)
- fixed GH #2742: Support of vs150 & vs160 with the official Microsoft localization executable,
vswhere.exe, installed by MSVC starting from VS2017
- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix)
- fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win
- Data/ODBC: make binding of std::string configurable (SQL_LONGVARCHAR - default or SQL_VARCHAR)
through a global setting (Poco::Data::ODBC::Connector::bindStringToLongVarChar()).
- added Poco::SharedLibrary::setSearchPath() (currently implemented on Windows only)
- Windows required minimum version is now Windows XP SP2
- upgraded bundled SQLite to 3.29.0
- CppParser now supports type aliases defined with using keyword.
!!!Release 1.9.2