From c36d945c515bd3c4380278f978f313001780abfb Mon Sep 17 00:00:00 2001 From: Quentin Fiard Date: Mon, 4 Nov 2013 21:20:18 +0000 Subject: [PATCH 1/3] Fixed language linkage issue under clang-500.2.79 The declarations must be located before the respective friend declaration to have a correct C language linkage. --- include/SAX/wrappers/saxlibxml2.hpp | 51 +++++++++++++++-------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/include/SAX/wrappers/saxlibxml2.hpp b/include/SAX/wrappers/saxlibxml2.hpp index 831e955d..76072d83 100644 --- a/include/SAX/wrappers/saxlibxml2.hpp +++ b/include/SAX/wrappers/saxlibxml2.hpp @@ -38,6 +38,32 @@ namespace libxml2_wrapper_impl_tiddle extern "C" { +void lwit_startDocument(void* user_data); +void lwit_endDocument(void* user_data); +void lwit_startElement(void *user_data, const xmlChar* name, const xmlChar** attrs); +void lwit_endElement(void *user_data, const xmlChar* name); +void lwit_characters(void* user_data, const xmlChar* ch, int len); +void lwit_cdata(void* user_data, const xmlChar* ch, int len); +void lwit_ignorableWhitespace(void *user_data, const xmlChar* ch, int len); +void lwit_processingInstruction(void *user_data, const xmlChar* target, const xmlChar* data); +void lwit_comment(void *user_data, const xmlChar* comment); +void lwit_warning(void *user_data, const char* fmt, ...); +void lwit_error(void* user_data, const char* fmt, ...); +void lwit_fatalError(void* user_data, const char* fmt, ...); +void lwit_locator(void* user_data, xmlSAXLocatorPtr locator); +void lwit_notationDecl(void* user_data, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); +void lwit_unparsedEntityDecl(void* user_data, + const xmlChar *name, const xmlChar *publicId, + const xmlChar *systemId, const xmlChar *notationName); +void lwit_elementDecl(void* user_date, const xmlChar *name, int type, xmlElementContentPtr content); +void lwit_attributeDecl(void *user_data, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); +void lwit_entityDecl(void* user_data, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); +void lwit_setFeature(xmlParserCtxtPtr context, const char* name, bool value); +bool lwit_getFeature(xmlParserCtxtPtr context, const char* name); +xmlEntityPtr lwit_getEntity(void* user_data, const xmlChar* name); +xmlParserInputPtr lwit_resolveEntity(void* user_data, const xmlChar* publicId, const xmlChar* systemId); +xmlSAXHandler* lwit_SaxHandler(); + class libxml2_base { protected: @@ -90,31 +116,6 @@ class libxml2_base friend xmlParserInputPtr lwit_resolveEntity(void* user_data, const xmlChar* publicId, const xmlChar* systemId); }; // class libxml2_base -void lwit_startDocument(void* user_data); -void lwit_endDocument(void* user_data); -void lwit_startElement(void *user_data, const xmlChar* name, const xmlChar** attrs); -void lwit_endElement(void *user_data, const xmlChar* name); -void lwit_characters(void* user_data, const xmlChar* ch, int len); -void lwit_cdata(void* user_data, const xmlChar* ch, int len); -void lwit_ignorableWhitespace(void *user_data, const xmlChar* ch, int len); -void lwit_processingInstruction(void *user_data, const xmlChar* target, const xmlChar* data); -void lwit_comment(void *user_data, const xmlChar* comment); -void lwit_warning(void *user_data, const char* fmt, ...); -void lwit_error(void* user_data, const char* fmt, ...); -void lwit_fatalError(void* user_data, const char* fmt, ...); -void lwit_locator(void* user_data, xmlSAXLocatorPtr locator); -void lwit_notationDecl(void* user_data, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); -void lwit_unparsedEntityDecl(void* user_data, - const xmlChar *name, const xmlChar *publicId, - const xmlChar *systemId, const xmlChar *notationName); -void lwit_elementDecl(void* user_date, const xmlChar *name, int type, xmlElementContentPtr content); -void lwit_attributeDecl(void *user_data, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -void lwit_entityDecl(void* user_data, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); -void lwit_setFeature(xmlParserCtxtPtr context, const char* name, bool value); -bool lwit_getFeature(xmlParserCtxtPtr context, const char* name); -xmlEntityPtr lwit_getEntity(void* user_data, const xmlChar* name); -xmlParserInputPtr lwit_resolveEntity(void* user_data, const xmlChar* publicId, const xmlChar* systemId); -xmlSAXHandler* lwit_SaxHandler(); } // extern "C" } // namespace libxml2_wrapper_impl_tiddle From 642efc8d007d58a14990763c1f9fda0706841f5f Mon Sep 17 00:00:00 2001 From: Quentin Fiard Date: Mon, 4 Nov 2013 21:31:35 +0000 Subject: [PATCH 2/3] Fixed c++11-narrowing errors for C++11 compatibility char(0x80): constant expression evaluates to -128 which cannot be narrowed to type 'unsigned char' [-Wc++11-narrowing] --- src/convert/impl/ucs2_utf8.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/convert/impl/ucs2_utf8.cpp b/src/convert/impl/ucs2_utf8.cpp index 929b52ac..4b9f5d86 100644 --- a/src/convert/impl/ucs2_utf8.cpp +++ b/src/convert/impl/ucs2_utf8.cpp @@ -20,10 +20,10 @@ namespace { static const Tab tab[] = { - { char(0x80), char(0x00), 0*6, 0x7F, }, // 1 byte sequence - { char(0xE0), char(0xC0), 1*6, 0x7FF, }, // 2 byte sequence - { char(0xF0), char(0xE0), 2*6, 0xFFFF, }, // 3 byte sequence - { 0, 0, 0, 0, } // end of table + { (unsigned char)(0x80), (unsigned char)(0x00), 0*6, 0x7F, }, // 1 byte sequence + { (unsigned char)(0xE0), (unsigned char)(0xC0), 1*6, 0x7FF, }, // 2 byte sequence + { (unsigned char)(0xF0), (unsigned char)(0xE0), 2*6, 0xFFFF, }, // 3 byte sequence + { 0, 0, 0, 0, } // end of table }; } // namespace From cc9355c03822ca8efbc6d83deae65722e0b1b464 Mon Sep 17 00:00:00 2001 From: Quentin Fiard Date: Thu, 27 Feb 2014 21:26:22 +0000 Subject: [PATCH 3/3] Fixed string+int issues in headers --- include/SAX/helpers/AttributesImpl.hpp | 7 ++++--- include/Taggle/impl/html/HTMLScanner.hpp | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/SAX/helpers/AttributesImpl.hpp b/include/SAX/helpers/AttributesImpl.hpp index 064c2841..12ae708d 100644 --- a/include/SAX/helpers/AttributesImpl.hpp +++ b/include/SAX/helpers/AttributesImpl.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace Arabica { @@ -546,9 +547,9 @@ private: void badIndex(unsigned int index) { // sort out - std::string msg = - "Attempt to modify attribute at illegal index: " + index; - throw std::out_of_range(msg); + std::stringstream msg; + msg << "Attempt to modify attribute at illegal index: " << index; + throw std::out_of_range(msg.str()); } class AttributeNamed diff --git a/include/Taggle/impl/html/HTMLScanner.hpp b/include/Taggle/impl/html/HTMLScanner.hpp index 6be7aaf8..1001b2d7 100644 --- a/include/Taggle/impl/html/HTMLScanner.hpp +++ b/include/Taggle/impl/html/HTMLScanner.hpp @@ -1,6 +1,7 @@ #ifndef ARABICA_SAX_TAGGLE_HTML_SCANNER_HPP #define ARABICA_SAX_TAGGLE_HTML_SCANNER_HPP +#include #include #include #include @@ -473,7 +474,9 @@ public: outputBuffer_.clear(); break; default: - throw std::runtime_error("Can't process state " + action); + throw std::runtime_error( + "Can't process state " + static_cast( + std::stringstream() << action).str()); } // switch ... state_ = nextState_; } // while (state_ != S_DONE)