node-expat
Advanced tools
@@ -9,3 +9,3 @@ # This file is copyrighted under the BSD-license for buildsystem files of KDE | ||
| set(PACKAGE_NAME "expat") | ||
| set(PACKAGE_VERSION "2.1.0") | ||
| set(PACKAGE_VERSION "2.2.0") | ||
| set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") | ||
@@ -45,2 +45,6 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}") | ||
| endif(MSVC) | ||
| if(WIN32) | ||
| add_definitions(-DWIN32) | ||
| set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows") | ||
| endif(WIN32) | ||
@@ -55,10 +59,12 @@ set(expat_SRCS | ||
| if(WIN32 AND BUILD_shared) | ||
| set(expat_SRCS ${expat_SRCS} lib/libexpat.def) | ||
| endif(WIN32 AND BUILD_shared) | ||
| if(BUILD_shared) | ||
| set(_SHARED SHARED) | ||
| if(WIN32) | ||
| set(expat_SRCS ${expat_SRCS} lib/libexpat.def) | ||
| endif(WIN32) | ||
| else(BUILD_shared) | ||
| set(_SHARED STATIC) | ||
| if(WIN32) | ||
| add_definitions(-DXML_STATIC) | ||
| endif(WIN32) | ||
| endif(BUILD_shared) | ||
@@ -68,2 +74,13 @@ | ||
| set(LIBCURRENT 7) # sync | ||
| set(LIBREVISION 2) # with | ||
| set(LIBAGE 6) # configure.ac! | ||
| math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}") | ||
| if(NOT WIN32) | ||
| set_property(TARGET expat PROPERTY VERSION ${LIBCURRENT_MINUS_AGE}.${LIBAGE}.${LIBREVISION}) | ||
| set_property(TARGET expat PROPERTY SOVERSION ${LIBCURRENT_MINUS_AGE}) | ||
| set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME}) | ||
| endif(NOT WIN32) | ||
| install(TARGETS expat RUNTIME DESTINATION bin | ||
@@ -83,2 +100,3 @@ LIBRARY DESTINATION lib | ||
| add_custom_command(TARGET expat PRE_BUILD COMMAND $(MAKE) -C doc xmlwf.1) | ||
@@ -94,2 +112,3 @@ if(BUILD_tools AND NOT WINCE) | ||
| add_executable(xmlwf ${xmlwf_SRCS}) | ||
| set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf) | ||
| target_link_libraries(xmlwf expat) | ||
@@ -102,5 +121,7 @@ install(TARGETS xmlwf DESTINATION bin) | ||
| add_executable(elements examples/elements.c) | ||
| set_property(TARGET elements PROPERTY RUNTIME_OUTPUT_DIRECTORY examples) | ||
| target_link_libraries(elements expat) | ||
| add_executable(outline examples/outline.c) | ||
| set_property(TARGET outline PROPERTY RUNTIME_OUTPUT_DIRECTORY examples) | ||
| target_link_libraries(outline expat) | ||
@@ -112,8 +133,10 @@ endif(BUILD_examples) | ||
| add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) | ||
| set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) | ||
| target_link_libraries(runtests expat) | ||
| add_test(runtests runtests) | ||
| add_test(runtests tests/runtests) | ||
| add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) | ||
| set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) | ||
| target_link_libraries(runtestspp expat) | ||
| add_test(runtestspp runtestspp) | ||
| add_test(runtestspp tests/runtestspp) | ||
| endif(BUILD_tests) |
@@ -1,4 +0,3 @@ | ||
| Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd | ||
| and Clark Cooper | ||
| Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. | ||
| Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper | ||
| Copyright (c) 2001-2016 Expat maintainers | ||
@@ -5,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
@@ -30,2 +30,4 @@ /* This is simple demonstration of how to use expat. This program | ||
| int *depthPtr = (int *)userData; | ||
| (void)atts; | ||
| for (i = 0; i < *depthPtr; i++) | ||
@@ -41,2 +43,4 @@ putchar('\t'); | ||
| int *depthPtr = (int *)userData; | ||
| (void)name; | ||
| *depthPtr -= 1; | ||
@@ -52,6 +56,9 @@ } | ||
| int depth = 0; | ||
| (void)argc; | ||
| (void)argv; | ||
| XML_SetUserData(parser, &depth); | ||
| XML_SetElementHandler(parser, startElement, endElement); | ||
| do { | ||
| int len = (int)fread(buf, 1, sizeof(buf), stdin); | ||
| size_t len = fread(buf, 1, sizeof(buf), stdin); | ||
| done = len < sizeof(buf); | ||
@@ -58,0 +65,0 @@ if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { |
@@ -52,2 +52,3 @@ /***************************************************************** | ||
| int i; | ||
| (void)data; | ||
@@ -70,2 +71,5 @@ for (i = 0; i < Depth; i++) | ||
| { | ||
| (void)data; | ||
| (void)el; | ||
| Depth--; | ||
@@ -78,2 +82,5 @@ } | ||
| XML_Parser p = XML_ParserCreate(NULL); | ||
| (void)argc; | ||
| (void)argv; | ||
| if (! p) { | ||
@@ -80,0 +87,0 @@ fprintf(stderr, "Couldn't allocate memory for parser\n"); |
@@ -10,5 +10,2 @@ #ifndef AMIGACONFIG_H | ||
| /* Define to 1 if you have the <check.h> header file. */ | ||
| #undef HAVE_CHECK_H | ||
| /* Define to 1 if you have the `memmove' function. */ | ||
@@ -15,0 +12,0 @@ #define HAVE_MEMMOVE 1 |
@@ -68,2 +68,5 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd | ||
| #if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) | ||
| #define XMLIMPORT __attribute__ ((visibility ("default"))) | ||
| #endif | ||
@@ -75,3 +78,14 @@ /* If we didn't define it above, define it away: */ | ||
| #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) | ||
| #define XML_ATTR_MALLOC __attribute__((__malloc__)) | ||
| #else | ||
| #define XML_ATTR_MALLOC | ||
| #endif | ||
| #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) | ||
| #define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) | ||
| #else | ||
| #define XML_ATTR_ALLOC_SIZE(x) | ||
| #endif | ||
| #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL | ||
@@ -78,0 +92,0 @@ |
@@ -345,3 +345,3 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd | ||
| /* OBSOLETE -- OBSOLETE -- OBSOLETE | ||
| This handler has been superceded by the EntityDeclHandler above. | ||
| This handler has been superseded by the EntityDeclHandler above. | ||
| It is provided here for backward compatibility. | ||
@@ -977,5 +977,8 @@ | ||
| XMLPARSEAPI(void *) | ||
| XML_ATTR_MALLOC | ||
| XML_ATTR_ALLOC_SIZE(2) | ||
| XML_MemMalloc(XML_Parser parser, size_t size); | ||
| XMLPARSEAPI(void *) | ||
| XML_ATTR_ALLOC_SIZE(3) | ||
| XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); | ||
@@ -1036,9 +1039,7 @@ | ||
| /* Expat follows the GNU/Linux convention of odd number minor version for | ||
| beta/development releases and even number minor version for stable | ||
| releases. Micro is bumped with each release, and set to 0 with each | ||
| change to major or minor version. | ||
| /* Expat follows the semantic versioning convention. | ||
| See http://semver.org. | ||
| */ | ||
| #define XML_MAJOR_VERSION 2 | ||
| #define XML_MINOR_VERSION 1 | ||
| #define XML_MINOR_VERSION 2 | ||
| #define XML_MICRO_VERSION 0 | ||
@@ -1045,0 +1046,0 @@ |
@@ -74,1 +74,23 @@ /* internal.h | ||
| #endif | ||
| #ifndef UNUSED_P | ||
| # ifdef __GNUC__ | ||
| # define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) | ||
| # else | ||
| # define UNUSED_P(p) UNUSED_ ## p | ||
| # endif | ||
| #endif | ||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
| void | ||
| align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef); | ||
| #ifdef __cplusplus | ||
| } | ||
| #endif |
+112
-112
@@ -7,3 +7,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #ifdef COMPILED_FROM_DSP | ||
| #ifdef WIN32 | ||
| #include "winconfig.h" | ||
@@ -20,3 +20,3 @@ #elif defined(MACOS_CLASSIC) | ||
| #endif | ||
| #endif /* ndef COMPILED_FROM_DSP */ | ||
| #endif /* ndef WIN32 */ | ||
@@ -200,5 +200,5 @@ #include "expat_external.h" | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -222,5 +222,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -271,5 +271,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -289,5 +289,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -307,5 +307,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -328,5 +328,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -448,5 +448,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -469,5 +469,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -515,5 +515,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -533,5 +533,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -574,5 +574,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -621,5 +621,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -639,5 +639,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -657,5 +657,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -675,5 +675,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -717,5 +717,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -735,5 +735,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -754,5 +754,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -776,5 +776,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -795,5 +795,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -858,5 +858,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -878,5 +878,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -899,5 +899,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -917,5 +917,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -935,5 +935,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -997,5 +997,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1015,5 +1015,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1104,5 +1104,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1130,5 +1130,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1149,5 +1149,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1171,5 +1171,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1202,5 +1202,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1277,5 +1277,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1296,5 +1296,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1316,5 +1316,5 @@ switch (tok) { | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1332,7 +1332,7 @@ switch (tok) { | ||
| static int PTRCALL | ||
| error(PROLOG_STATE *state, | ||
| int tok, | ||
| const char *ptr, | ||
| const char *end, | ||
| const ENCODING *enc) | ||
| error(PROLOG_STATE *UNUSED_P(state), | ||
| int UNUSED_P(tok), | ||
| const char *UNUSED_P(ptr), | ||
| const char *UNUSED_P(end), | ||
| const ENCODING *UNUSED_P(enc)) | ||
| { | ||
@@ -1339,0 +1339,0 @@ return XML_ROLE_NONE; |
+111
-115
@@ -90,2 +90,20 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #define HAS_CHARS(enc, ptr, end, count) \ | ||
| (end - ptr >= count * MINBPC(enc)) | ||
| #define HAS_CHAR(enc, ptr, end) \ | ||
| HAS_CHARS(enc, ptr, end, 1) | ||
| #define REQUIRE_CHARS(enc, ptr, end, count) \ | ||
| { \ | ||
| if (! HAS_CHARS(enc, ptr, end, count)) { \ | ||
| return XML_TOK_PARTIAL; \ | ||
| } \ | ||
| } | ||
| #define REQUIRE_CHAR(enc, ptr, end) \ | ||
| REQUIRE_CHARS(enc, ptr, end, 1) | ||
| /* ptr points to character following "<!-" */ | ||
@@ -97,3 +115,3 @@ | ||
| { | ||
| if (ptr != end) { | ||
| if (HAS_CHAR(enc, ptr, end)) { | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { | ||
@@ -104,11 +122,11 @@ *nextTokPtr = ptr; | ||
| ptr += MINBPC(enc); | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
| INVALID_CASES(ptr, nextTokPtr) | ||
| case BT_MINUS: | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) { | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -137,4 +155,3 @@ *nextTokPtr = ptr; | ||
| { | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -154,7 +171,6 @@ case BT_MINUS: | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
| case BT_PERCNT: | ||
| if (ptr + MINBPC(enc) == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHARS(enc, ptr, end, 2); | ||
| /* don't allow <!ENTITY% foo "whatever"> */ | ||
@@ -183,3 +199,3 @@ switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { | ||
| static int PTRCALL | ||
| PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, | ||
| PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr, | ||
| const char *end, int *tokPtr) | ||
@@ -234,4 +250,3 @@ { | ||
| const char *target = ptr; | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -243,3 +258,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -253,3 +268,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -259,4 +274,3 @@ INVALID_CASES(ptr, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -279,4 +293,3 @@ *nextTokPtr = ptr + MINBPC(enc); | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -296,3 +309,3 @@ *nextTokPtr = ptr + MINBPC(enc); | ||
| static int PTRCALL | ||
| PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr, | ||
| PREFIX(scanCdataSection)(const ENCODING *UNUSED_P(enc), const char *ptr, | ||
| const char *end, const char **nextTokPtr) | ||
@@ -304,4 +317,3 @@ { | ||
| /* CDATA[ */ | ||
| if (end - ptr < 6 * MINBPC(enc)) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHARS(enc, ptr, end, 6); | ||
| for (i = 0; i < 6; i++, ptr += MINBPC(enc)) { | ||
@@ -321,3 +333,3 @@ if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) { | ||
| { | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
@@ -336,9 +348,7 @@ if (MINBPC(enc) > 1) { | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) | ||
| break; | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -352,4 +362,3 @@ ptr -= MINBPC(enc); | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (BYTE_TYPE(enc, ptr) == BT_LF) | ||
@@ -367,3 +376,3 @@ ptr += MINBPC(enc); | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -403,4 +412,3 @@ #define LEAD_CASE(n) \ | ||
| { | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -412,7 +420,7 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
| CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| case BT_S: case BT_CR: case BT_LF: | ||
| for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { | ||
| for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -454,3 +462,3 @@ case BT_S: case BT_CR: case BT_LF: | ||
| { | ||
| if (ptr != end) { | ||
| if (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -464,3 +472,3 @@ case BT_DIGIT: | ||
| } | ||
| for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { | ||
| for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -488,3 +496,3 @@ case BT_DIGIT: | ||
| { | ||
| if (ptr != end) { | ||
| if (HAS_CHAR(enc, ptr, end)) { | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_x)) | ||
@@ -499,3 +507,3 @@ return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); | ||
| } | ||
| for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) { | ||
| for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -522,4 +530,3 @@ case BT_DIGIT: | ||
| { | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -533,3 +540,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -557,3 +564,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| #endif | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -569,4 +576,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -585,4 +591,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| t = BYTE_TYPE(enc, ptr); | ||
@@ -610,4 +615,3 @@ if (t == BT_EQUALS) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| open = BYTE_TYPE(enc, ptr); | ||
@@ -630,4 +634,3 @@ if (open == BT_QUOT || open == BT_APOS) | ||
| int t; | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| t = BYTE_TYPE(enc, ptr); | ||
@@ -657,4 +660,3 @@ if (t == open) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -676,4 +678,3 @@ case BT_S: | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -690,4 +691,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -724,9 +724,8 @@ *nextTokPtr = ptr; | ||
| #endif | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
| CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| case BT_EXCL: | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -753,3 +752,3 @@ case BT_MINUS: | ||
| /* we have a start-tag */ | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -765,4 +764,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -779,3 +777,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -805,4 +803,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -826,3 +823,3 @@ *nextTokPtr = ptr; | ||
| { | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
@@ -845,3 +842,3 @@ if (MINBPC(enc) > 1) { | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_TRAILING_CR; | ||
@@ -857,3 +854,3 @@ if (BYTE_TYPE(enc, ptr) == BT_LF) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_TRAILING_RSQB; | ||
@@ -863,3 +860,3 @@ if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_TRAILING_RSQB; | ||
@@ -877,3 +874,3 @@ if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -891,3 +888,3 @@ #define LEAD_CASE(n) \ | ||
| case BT_RSQB: | ||
| if (ptr + MINBPC(enc) != end) { | ||
| if (HAS_CHARS(enc, ptr, end, 2)) { | ||
| if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { | ||
@@ -897,3 +894,3 @@ ptr += MINBPC(enc); | ||
| } | ||
| if (ptr + 2*MINBPC(enc) != end) { | ||
| if (HAS_CHARS(enc, ptr, end, 3)) { | ||
| if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { | ||
@@ -932,4 +929,3 @@ ptr += MINBPC(enc); | ||
| { | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -944,3 +940,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -963,4 +959,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| { | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -972,3 +967,3 @@ CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -993,3 +988,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| { | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| int t = BYTE_TYPE(enc, ptr); | ||
@@ -1003,3 +998,3 @@ switch (t) { | ||
| break; | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return -XML_TOK_LITERAL; | ||
@@ -1027,3 +1022,3 @@ *nextTokPtr = ptr; | ||
| int tok; | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
@@ -1047,4 +1042,3 @@ if (MINBPC(enc) > 1) { | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1077,3 +1071,3 @@ case BT_EXCL: | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| break; | ||
@@ -1105,7 +1099,6 @@ switch (BYTE_TYPE(enc, ptr)) { | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return -XML_TOK_CLOSE_BRACKET; | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { | ||
| if (ptr + MINBPC(enc) == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHARS(enc, ptr, end, 2); | ||
| if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { | ||
@@ -1123,3 +1116,3 @@ *nextTokPtr = ptr + 2*MINBPC(enc); | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return -XML_TOK_CLOSE_PAREN; | ||
@@ -1200,3 +1193,3 @@ switch (BYTE_TYPE(enc, ptr)) { | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1214,4 +1207,3 @@ CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) | ||
| case XML_TOK_NAME: | ||
| if (ptr == end) | ||
| return XML_TOK_PARTIAL; | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| tok = XML_TOK_PREFIXED_NAME; | ||
@@ -1265,6 +1257,8 @@ switch (BYTE_TYPE(enc, ptr)) { | ||
| const char *start; | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
| else if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_PARTIAL; | ||
| start = ptr; | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1294,3 +1288,3 @@ #define LEAD_CASE(n) \ | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_TRAILING_CR; | ||
@@ -1325,6 +1319,8 @@ if (BYTE_TYPE(enc, ptr) == BT_LF) | ||
| const char *start; | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
| else if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_PARTIAL; | ||
| start = ptr; | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1358,3 +1354,3 @@ #define LEAD_CASE(n) \ | ||
| ptr += MINBPC(enc); | ||
| if (ptr == end) | ||
| if (! HAS_CHAR(enc, ptr, end)) | ||
| return XML_TOK_TRAILING_CR; | ||
@@ -1391,11 +1387,11 @@ if (BYTE_TYPE(enc, ptr) == BT_LF) | ||
| } | ||
| while (ptr != end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
| INVALID_CASES(ptr, nextTokPtr) | ||
| case BT_LT: | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { | ||
@@ -1408,7 +1404,7 @@ ++level; | ||
| case BT_RSQB: | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { | ||
| if ((ptr += MINBPC(enc)) == end) | ||
| return XML_TOK_PARTIAL; | ||
| ptr += MINBPC(enc); | ||
| REQUIRE_CHAR(enc, ptr, end); | ||
| if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { | ||
@@ -1440,3 +1436,3 @@ ptr += MINBPC(enc); | ||
| end -= MINBPC(enc); | ||
| for (; ptr != end; ptr += MINBPC(enc)) { | ||
| for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1589,3 +1585,3 @@ case BT_DIGIT: | ||
| static int PTRFASTCALL | ||
| PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) | ||
| PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) | ||
| { | ||
@@ -1634,3 +1630,3 @@ int result = 0; | ||
| static int PTRCALL | ||
| PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, | ||
| PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, | ||
| const char *end) | ||
@@ -1753,7 +1749,7 @@ { | ||
| static int PTRCALL | ||
| PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, | ||
| PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1, | ||
| const char *end1, const char *ptr2) | ||
| { | ||
| for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { | ||
| if (ptr1 == end1) | ||
| if (end1 - ptr1 < MINBPC(enc)) | ||
| return 0; | ||
@@ -1815,3 +1811,3 @@ if (!CHAR_MATCHES(enc, ptr1, *ptr2)) | ||
| { | ||
| while (ptr < end) { | ||
| while (HAS_CHAR(enc, ptr, end)) { | ||
| switch (BYTE_TYPE(enc, ptr)) { | ||
@@ -1832,3 +1828,3 @@ #define LEAD_CASE(n) \ | ||
| ptr += MINBPC(enc); | ||
| if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) | ||
| if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF) | ||
| ptr += MINBPC(enc); | ||
@@ -1835,0 +1831,0 @@ pos->columnNumber = (XML_Size)-1; |
+165
-65
@@ -7,3 +7,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #ifdef COMPILED_FROM_DSP | ||
| #ifdef WIN32 | ||
| #include "winconfig.h" | ||
@@ -20,3 +20,3 @@ #elif defined(MACOS_CLASSIC) | ||
| #endif | ||
| #endif /* ndef COMPILED_FROM_DSP */ | ||
| #endif /* ndef WIN32 */ | ||
@@ -51,3 +51,3 @@ #include "expat_external.h" | ||
| #define UCS2_GET_NAMING(pages, hi, lo) \ | ||
| (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) | ||
| (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo) & 0x1F))) | ||
@@ -62,3 +62,3 @@ /* A 2 byte UTF-8 representation splits the characters 11 bits between | ||
| + ((((byte)[1]) >> 5) & 1)] \ | ||
| & (1 << (((byte)[1]) & 0x1F))) | ||
| & (1u << (((byte)[1]) & 0x1F))) | ||
@@ -76,3 +76,3 @@ /* A 3 byte UTF-8 representation splits the characters 16 bits between | ||
| + ((((byte)[2]) >> 5) & 1)] \ | ||
| & (1 << (((byte)[2]) & 0x1F))) | ||
| & (1u << (((byte)[2]) & 0x1F))) | ||
@@ -130,3 +130,3 @@ #define UTF8_GET_NAMING(pages, p, n) \ | ||
| static int PTRFASTCALL | ||
| isNever(const ENCODING *enc, const char *p) | ||
| isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p)) | ||
| { | ||
@@ -137,3 +137,3 @@ return 0; | ||
| static int PTRFASTCALL | ||
| utf8_isName2(const ENCODING *enc, const char *p) | ||
| utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -144,3 +144,3 @@ return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isName3(const ENCODING *enc, const char *p) | ||
| utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -153,3 +153,3 @@ return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isNmstrt2(const ENCODING *enc, const char *p) | ||
| utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -160,3 +160,3 @@ return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isNmstrt3(const ENCODING *enc, const char *p) | ||
| utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -169,3 +169,3 @@ return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isInvalid2(const ENCODING *enc, const char *p) | ||
| utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -176,3 +176,3 @@ return UTF8_INVALID2((const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isInvalid3(const ENCODING *enc, const char *p) | ||
| utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -183,3 +183,3 @@ return UTF8_INVALID3((const unsigned char *)p); | ||
| static int PTRFASTCALL | ||
| utf8_isInvalid4(const ENCODING *enc, const char *p) | ||
| utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p) | ||
| { | ||
@@ -238,2 +238,13 @@ return UTF8_INVALID4((const unsigned char *)p); | ||
| #define NULL_VTABLE \ | ||
| /* isName2 */ NULL, \ | ||
| /* isName3 */ NULL, \ | ||
| /* isName4 */ NULL, \ | ||
| /* isNmstrt2 */ NULL, \ | ||
| /* isNmstrt3 */ NULL, \ | ||
| /* isNmstrt4 */ NULL, \ | ||
| /* isInvalid2 */ NULL, \ | ||
| /* isInvalid3 */ NULL, \ | ||
| /* isInvalid4 */ NULL | ||
| static int FASTCALL checkCharRefNumber(int); | ||
@@ -335,7 +346,43 @@ | ||
| static void PTRCALL | ||
| utf8_toUtf8(const ENCODING *enc, | ||
| void | ||
| align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef) | ||
| { | ||
| const char * fromLim = *fromLimRef; | ||
| size_t walked = 0; | ||
| for (; fromLim > from; fromLim--, walked++) { | ||
| const unsigned char prev = (unsigned char)fromLim[-1]; | ||
| if ((prev & 0xf8u) == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */ | ||
| if (walked + 1 >= 4) { | ||
| fromLim += 4 - 1; | ||
| break; | ||
| } else { | ||
| walked = 0; | ||
| } | ||
| } else if ((prev & 0xf0u) == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */ | ||
| if (walked + 1 >= 3) { | ||
| fromLim += 3 - 1; | ||
| break; | ||
| } else { | ||
| walked = 0; | ||
| } | ||
| } else if ((prev & 0xe0u) == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */ | ||
| if (walked + 1 >= 2) { | ||
| fromLim += 2 - 1; | ||
| break; | ||
| } else { | ||
| walked = 0; | ||
| } | ||
| } else if ((prev & 0x80u) == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */ | ||
| break; | ||
| } | ||
| } | ||
| *fromLimRef = fromLim; | ||
| } | ||
| static enum XML_Convert_Result PTRCALL | ||
| utf8_toUtf8(const ENCODING *UNUSED_P(enc), | ||
| const char **fromP, const char *fromLim, | ||
| char **toP, const char *toLim) | ||
| { | ||
| enum XML_Convert_Result res = XML_CONVERT_COMPLETED; | ||
| char *to; | ||
@@ -345,13 +392,18 @@ const char *from; | ||
| /* Avoid copying partial characters. */ | ||
| for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) | ||
| if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) | ||
| break; | ||
| res = XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| fromLim = *fromP + (toLim - *toP); | ||
| align_limit_to_full_utf8_characters(*fromP, &fromLim); | ||
| } | ||
| for (to = *toP, from = *fromP; from != fromLim; from++, to++) | ||
| for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) | ||
| *to = *from; | ||
| *fromP = from; | ||
| *toP = to; | ||
| if ((to == toLim) && (from < fromLim)) | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| else | ||
| return res; | ||
| } | ||
| static void PTRCALL | ||
| static enum XML_Convert_Result PTRCALL | ||
| utf8_toUtf16(const ENCODING *enc, | ||
@@ -361,7 +413,12 @@ const char **fromP, const char *fromLim, | ||
| { | ||
| enum XML_Convert_Result res = XML_CONVERT_COMPLETED; | ||
| unsigned short *to = *toP; | ||
| const char *from = *fromP; | ||
| while (from != fromLim && to != toLim) { | ||
| while (from < fromLim && to < toLim) { | ||
| switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { | ||
| case BT_LEAD2: | ||
| if (fromLim - from < 2) { | ||
| res = XML_CONVERT_INPUT_INCOMPLETE; | ||
| break; | ||
| } | ||
| *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); | ||
@@ -371,2 +428,6 @@ from += 2; | ||
| case BT_LEAD3: | ||
| if (fromLim - from < 3) { | ||
| res = XML_CONVERT_INPUT_INCOMPLETE; | ||
| break; | ||
| } | ||
| *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ||
@@ -379,4 +440,10 @@ | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); | ||
| unsigned long n; | ||
| if (to + 1 == toLim) | ||
| if (toLim - to < 2) { | ||
| res = XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| goto after; | ||
| } | ||
| if (fromLim - from < 4) { | ||
| res = XML_CONVERT_INPUT_INCOMPLETE; | ||
| goto after; | ||
| } | ||
| n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ||
@@ -399,2 +466,3 @@ | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); | ||
| *toP = to; | ||
| return res; | ||
| } | ||
@@ -448,4 +516,4 @@ | ||
| static void PTRCALL | ||
| latin1_toUtf8(const ENCODING *enc, | ||
| static enum XML_Convert_Result PTRCALL | ||
| latin1_toUtf8(const ENCODING *UNUSED_P(enc), | ||
| const char **fromP, const char *fromLim, | ||
@@ -457,7 +525,7 @@ char **toP, const char *toLim) | ||
| if (*fromP == fromLim) | ||
| break; | ||
| return XML_CONVERT_COMPLETED; | ||
| c = (unsigned char)**fromP; | ||
| if (c & 0x80) { | ||
| if (toLim - *toP < 2) | ||
| break; | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| *(*toP)++ = (char)((c >> 6) | UTF8_cval2); | ||
@@ -469,3 +537,3 @@ *(*toP)++ = (char)((c & 0x3f) | 0x80); | ||
| if (*toP == toLim) | ||
| break; | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| *(*toP)++ = *(*fromP)++; | ||
@@ -476,9 +544,14 @@ } | ||
| static void PTRCALL | ||
| latin1_toUtf16(const ENCODING *enc, | ||
| static enum XML_Convert_Result PTRCALL | ||
| latin1_toUtf16(const ENCODING *UNUSED_P(enc), | ||
| const char **fromP, const char *fromLim, | ||
| unsigned short **toP, const unsigned short *toLim) | ||
| { | ||
| while (*fromP != fromLim && *toP != toLim) | ||
| while (*fromP < fromLim && *toP < toLim) | ||
| *(*toP)++ = (unsigned char)*(*fromP)++; | ||
| if ((*toP == toLim) && (*fromP < fromLim)) | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| else | ||
| return XML_CONVERT_COMPLETED; | ||
| } | ||
@@ -494,3 +567,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(sb_) | ||
| STANDARD_VTABLE(sb_) NULL_VTABLE | ||
| }; | ||
@@ -508,12 +581,17 @@ | ||
| }, | ||
| STANDARD_VTABLE(sb_) | ||
| STANDARD_VTABLE(sb_) NULL_VTABLE | ||
| }; | ||
| static void PTRCALL | ||
| ascii_toUtf8(const ENCODING *enc, | ||
| static enum XML_Convert_Result PTRCALL | ||
| ascii_toUtf8(const ENCODING *UNUSED_P(enc), | ||
| const char **fromP, const char *fromLim, | ||
| char **toP, const char *toLim) | ||
| { | ||
| while (*fromP != fromLim && *toP != toLim) | ||
| while (*fromP < fromLim && *toP < toLim) | ||
| *(*toP)++ = *(*fromP)++; | ||
| if ((*toP == toLim) && (*fromP < fromLim)) | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| else | ||
| return XML_CONVERT_COMPLETED; | ||
| } | ||
@@ -529,3 +607,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(sb_) | ||
| STANDARD_VTABLE(sb_) NULL_VTABLE | ||
| }; | ||
@@ -543,3 +621,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(sb_) | ||
| STANDARD_VTABLE(sb_) NULL_VTABLE | ||
| }; | ||
@@ -567,9 +645,10 @@ | ||
| #define DEFINE_UTF16_TO_UTF8(E) \ | ||
| static void PTRCALL \ | ||
| E ## toUtf8(const ENCODING *enc, \ | ||
| static enum XML_Convert_Result PTRCALL \ | ||
| E ## toUtf8(const ENCODING *UNUSED_P(enc), \ | ||
| const char **fromP, const char *fromLim, \ | ||
| char **toP, const char *toLim) \ | ||
| { \ | ||
| const char *from; \ | ||
| for (from = *fromP; from != fromLim; from += 2) { \ | ||
| const char *from = *fromP; \ | ||
| fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \ | ||
| for (; from < fromLim; from += 2) { \ | ||
| int plane; \ | ||
@@ -584,3 +663,3 @@ unsigned char lo2; \ | ||
| *fromP = from; \ | ||
| return; \ | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; \ | ||
| } \ | ||
@@ -595,3 +674,3 @@ *(*toP)++ = lo; \ | ||
| *fromP = from; \ | ||
| return; \ | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; \ | ||
| } \ | ||
@@ -604,3 +683,3 @@ *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ | ||
| *fromP = from; \ | ||
| return; \ | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; \ | ||
| } \ | ||
@@ -615,4 +694,8 @@ /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ | ||
| *fromP = from; \ | ||
| return; \ | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; \ | ||
| } \ | ||
| if (fromLim - from < 4) { \ | ||
| *fromP = from; \ | ||
| return XML_CONVERT_INPUT_INCOMPLETE; \ | ||
| } \ | ||
| plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ | ||
@@ -632,16 +715,28 @@ *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ | ||
| *fromP = from; \ | ||
| if (from < fromLim) \ | ||
| return XML_CONVERT_INPUT_INCOMPLETE; \ | ||
| else \ | ||
| return XML_CONVERT_COMPLETED; \ | ||
| } | ||
| #define DEFINE_UTF16_TO_UTF16(E) \ | ||
| static void PTRCALL \ | ||
| E ## toUtf16(const ENCODING *enc, \ | ||
| static enum XML_Convert_Result PTRCALL \ | ||
| E ## toUtf16(const ENCODING *UNUSED_P(enc), \ | ||
| const char **fromP, const char *fromLim, \ | ||
| unsigned short **toP, const unsigned short *toLim) \ | ||
| { \ | ||
| enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \ | ||
| fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \ | ||
| /* Avoid copying first half only of surrogate */ \ | ||
| if (fromLim - *fromP > ((toLim - *toP) << 1) \ | ||
| && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ | ||
| && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \ | ||
| fromLim -= 2; \ | ||
| for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ | ||
| res = XML_CONVERT_INPUT_INCOMPLETE; \ | ||
| } \ | ||
| for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \ | ||
| *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ | ||
| if ((*toP == toLim) && (*fromP < fromLim)) \ | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; \ | ||
| else \ | ||
| return res; \ | ||
| } | ||
@@ -763,3 +858,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(little2_) | ||
| STANDARD_VTABLE(little2_) NULL_VTABLE | ||
| }; | ||
@@ -783,3 +878,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(little2_) | ||
| STANDARD_VTABLE(little2_) NULL_VTABLE | ||
| }; | ||
@@ -797,3 +892,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(little2_) | ||
| STANDARD_VTABLE(little2_) NULL_VTABLE | ||
| }; | ||
@@ -811,3 +906,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(little2_) | ||
| STANDARD_VTABLE(little2_) NULL_VTABLE | ||
| }; | ||
@@ -908,3 +1003,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(big2_) | ||
| STANDARD_VTABLE(big2_) NULL_VTABLE | ||
| }; | ||
@@ -928,3 +1023,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(big2_) | ||
| STANDARD_VTABLE(big2_) NULL_VTABLE | ||
| }; | ||
@@ -942,3 +1037,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(big2_) | ||
| STANDARD_VTABLE(big2_) NULL_VTABLE | ||
| }; | ||
@@ -956,3 +1051,3 @@ | ||
| }, | ||
| STANDARD_VTABLE(big2_) | ||
| STANDARD_VTABLE(big2_) NULL_VTABLE | ||
| }; | ||
@@ -983,3 +1078,3 @@ | ||
| static void PTRCALL | ||
| initUpdatePosition(const ENCODING *enc, const char *ptr, | ||
| initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr, | ||
| const char *end, POSITION *pos) | ||
@@ -1334,3 +1429,3 @@ { | ||
| static void PTRCALL | ||
| static enum XML_Convert_Result PTRCALL | ||
| unknown_toUtf8(const ENCODING *enc, | ||
@@ -1346,3 +1441,3 @@ const char **fromP, const char *fromLim, | ||
| if (*fromP == fromLim) | ||
| break; | ||
| return XML_CONVERT_COMPLETED; | ||
| utf8 = uenc->utf8[(unsigned char)**fromP]; | ||
@@ -1354,3 +1449,3 @@ n = *utf8++; | ||
| if (n > toLim - *toP) | ||
| break; | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| utf8 = buf; | ||
@@ -1362,3 +1457,3 @@ *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] | ||
| if (n > toLim - *toP) | ||
| break; | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| (*fromP)++; | ||
@@ -1372,3 +1467,3 @@ } | ||
| static void PTRCALL | ||
| static enum XML_Convert_Result PTRCALL | ||
| unknown_toUtf16(const ENCODING *enc, | ||
@@ -1379,3 +1474,3 @@ const char **fromP, const char *fromLim, | ||
| const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); | ||
| while (*fromP != fromLim && *toP != toLim) { | ||
| while (*fromP < fromLim && *toP < toLim) { | ||
| unsigned short c = uenc->utf16[(unsigned char)**fromP]; | ||
@@ -1392,2 +1487,7 @@ if (c == 0) { | ||
| } | ||
| if ((*toP == toLim) && (*fromP < fromLim)) | ||
| return XML_CONVERT_OUTPUT_EXHAUSTED; | ||
| else | ||
| return XML_CONVERT_COMPLETED; | ||
| } | ||
@@ -1556,3 +1656,3 @@ | ||
| if (ptr == end) | ||
| if (ptr >= end) | ||
| return XML_TOK_NONE; | ||
@@ -1559,0 +1659,0 @@ encPtr = enc->encPtr; |
@@ -133,2 +133,8 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| enum XML_Convert_Result { | ||
| XML_CONVERT_COMPLETED = 0, | ||
| XML_CONVERT_INPUT_INCOMPLETE = 1, | ||
| XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */ | ||
| }; | ||
| struct encoding { | ||
@@ -162,3 +168,3 @@ SCANNER scanners[XML_N_STATES]; | ||
| const char **badPtr); | ||
| void (PTRCALL *utf8Convert)(const ENCODING *enc, | ||
| enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc, | ||
| const char **fromP, | ||
@@ -168,3 +174,3 @@ const char *fromLim, | ||
| const char *toLim); | ||
| void (PTRCALL *utf16Convert)(const ENCODING *enc, | ||
| enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc, | ||
| const char **fromP, | ||
@@ -171,0 +177,0 @@ const char *fromLim, |
@@ -45,3 +45,3 @@ ################################################################ | ||
| MANFILE = $(srcdir)/doc/xmlwf.1 | ||
| APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h | ||
| APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h expat_config.h | ||
| LIBRARY = libexpat.la | ||
@@ -55,3 +55,3 @@ | ||
| all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline | ||
| all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline $(MANFILE) | ||
@@ -82,3 +82,6 @@ clean: | ||
| install: xmlwf/xmlwf@EXEEXT@ installlib | ||
| $(MANFILE): | ||
| $(MAKE) -C doc xmlwf.1 | ||
| install: xmlwf/xmlwf@EXEEXT@ installlib $(MANFILE) | ||
| $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) | ||
@@ -122,3 +125,3 @@ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf | ||
| ### autoconf this? | ||
| LTFLAGS = --silent | ||
| LTFLAGS = --verbose | ||
@@ -161,7 +164,7 @@ COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS) | ||
| examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) | ||
| $(LINK_EXE) $< $(LIBRARY) | ||
| $(LINK_EXE) examples/elements.@OBJEXT@ $(LIBRARY) | ||
| examples/outline.@OBJEXT@: examples/outline.c | ||
| examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) | ||
| $(LINK_EXE) $< $(LIBRARY) | ||
| $(LINK_EXE) examples/outline.@OBJEXT@ $(LIBRARY) | ||
@@ -188,8 +191,16 @@ tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h | ||
| tests/XML-Test-Suite: tests/xmlts.zip | ||
| tests/xmlconf: tests/xmlts.zip | ||
| cd tests && unzip -q xmlts.zip | ||
| run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite | ||
| tests/xmltest.sh | ||
| run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/xmlconf | ||
| tests/xmltest.sh 2>&1 | tee tests/xmltest.log | ||
| diff -u tests/xmltest.log.expected tests/xmltest.log | ||
| .PHONY: qa | ||
| qa: | ||
| ./qa.sh address | ||
| ./qa.sh memory | ||
| ./qa.sh undefined | ||
| ./qa.sh coverage | ||
| .SUFFIXES: .c .cpp .lo .@OBJEXT@ | ||
@@ -196,0 +207,0 @@ |
@@ -47,3 +47,3 @@ amiga/launch.c | ||
| doc/xmlwf.1 | ||
| doc/xmlwf.sgml | ||
| doc/xmlwf.xml | ||
| CMakeLists.txt | ||
@@ -58,3 +58,3 @@ CMake.README | ||
| configure | ||
| configure.in | ||
| configure.ac | ||
| expat_config.h.in | ||
@@ -61,0 +61,0 @@ expat_config.h.cmake |
| Expat, Release 2.1.0 | ||
| Expat, Release 2.2.0 | ||
@@ -117,3 +117,3 @@ This is Expat, a C library for parsing XML, written by James Clark. | ||
| to GNU make (the "make" found in /usr/ccs/bin does not seem to work | ||
| properly -- appearantly it does not understand .PHONY directives). If | ||
| properly -- apparently it does not understand .PHONY directives). If | ||
| you're using ksh or bash, use this command to build: | ||
@@ -120,0 +120,0 @@ |
@@ -16,2 +16,2 @@ Use this benchmark command line utility as follows: | ||
| The time (in seconds) it takes to parse the test file, | ||
| averaged over the number of iterations. | ||
| averaged over the number of iterations.@ |
@@ -10,7 +10,3 @@ /* Copyright (c) 1998-2003 Thai Open Source Software Center Ltd | ||
| #endif | ||
| #ifdef HAVE_CHECK_H | ||
| #include <check.h> | ||
| #else | ||
| #include "minicheck.h" | ||
| #endif | ||
@@ -55,3 +51,3 @@ #include <assert.h> | ||
| } | ||
| if (len + storage->count < sizeof(storage->data)) { | ||
| if (len + storage->count < (int)sizeof(storage->data)) { | ||
| memcpy(storage->data + storage->count, s, len); | ||
@@ -77,3 +73,3 @@ storage->count += len; | ||
| } | ||
| if (len + storage->count < sizeof(storage->data)) { | ||
| if (len + storage->count < (int)sizeof(storage->data)) { | ||
| memcpy(storage->data + storage->count, s, | ||
@@ -80,0 +76,0 @@ len * sizeof(storage->data[0])); |
@@ -13,6 +13,7 @@ /* Miniature re-implementation of the "check" library. | ||
| #include "internal.h" /* for UNUSED_P only */ | ||
| #include "minicheck.h" | ||
| Suite * | ||
| suite_create(char *name) | ||
| suite_create(const char *name) | ||
| { | ||
@@ -27,3 +28,3 @@ Suite *suite = (Suite *) calloc(1, sizeof(Suite)); | ||
| TCase * | ||
| tcase_create(char *name) | ||
| tcase_create(const char *name) | ||
| { | ||
@@ -161,3 +162,3 @@ TCase *tc = (TCase *) calloc(1, sizeof(TCase)); | ||
| void | ||
| _fail_unless(int condition, const char *file, int line, char *msg) | ||
| _fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(line), const char *msg) | ||
| { | ||
@@ -164,0 +165,0 @@ /* Always print the error message so it isn't lost. In this case, |
@@ -29,2 +29,7 @@ /* Miniature re-implementation of the "check" library. | ||
| /* ISO C90 does not support '__func__' predefined identifier */ | ||
| #if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901) | ||
| # define __func__ "(unknown)" | ||
| #endif | ||
| #define START_TEST(testname) static void testname(void) { \ | ||
@@ -52,3 +57,3 @@ _check_set_test_info(__func__, __FILE__, __LINE__); \ | ||
| struct Suite { | ||
| char *name; | ||
| const char *name; | ||
| TCase *tests; | ||
@@ -58,3 +63,3 @@ }; | ||
| struct TCase { | ||
| char *name; | ||
| const char *name; | ||
| tcase_setup_function setup; | ||
@@ -78,5 +83,5 @@ tcase_teardown_function teardown; | ||
| void _fail_unless(int condition, const char *file, int line, char *msg); | ||
| Suite *suite_create(char *name); | ||
| TCase *tcase_create(char *name); | ||
| void _fail_unless(int condition, const char *file, int line, const char *msg); | ||
| Suite *suite_create(const char *name); | ||
| TCase *tcase_create(const char *name); | ||
| void suite_add_tcase(Suite *suite, TCase *tc); | ||
@@ -83,0 +88,0 @@ void tcase_add_checked_fixture(TCase *, |
+333
-146
@@ -16,5 +16,10 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd | ||
| #include <stdint.h> | ||
| #include <stddef.h> /* ptrdiff_t */ | ||
| #ifndef __cplusplus | ||
| # include <stdbool.h> | ||
| #endif | ||
| #include "expat.h" | ||
| #include "chardata.h" | ||
| #include "internal.h" /* for UNUSED_P only */ | ||
| #include "minicheck.h" | ||
@@ -70,9 +75,30 @@ | ||
| static enum XML_Status | ||
| _XML_Parse_SINGLE_BYTES(XML_Parser parser, const char *s, int len, int isFinal) | ||
| { | ||
| enum XML_Status res = XML_STATUS_ERROR; | ||
| int offset = 0; | ||
| if (len == 0) { | ||
| return XML_Parse(parser, s, len, isFinal); | ||
| } | ||
| for (; offset < len; offset++) { | ||
| const int innerIsFinal = (offset == len - 1) && isFinal; | ||
| const char c = s[offset]; /* to help out-of-bounds detection */ | ||
| res = XML_Parse(parser, &c, sizeof(char), innerIsFinal); | ||
| if (res != XML_STATUS_OK) { | ||
| return res; | ||
| } | ||
| } | ||
| return res; | ||
| } | ||
| #define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__) | ||
| static void | ||
| _expect_failure(char *text, enum XML_Error errorCode, char *errorMessage, | ||
| char *file, int lineno) | ||
| _expect_failure(const char *text, enum XML_Error errorCode, const char *errorMessage, | ||
| const char *file, int lineno) | ||
| { | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) | ||
| /* Hackish use of _fail_unless() macro, but let's us report | ||
@@ -94,59 +120,59 @@ the right filename and line number. */ | ||
| static void XMLCALL | ||
| dummy_start_doctype_handler(void *userData, | ||
| const XML_Char *doctypeName, | ||
| const XML_Char *sysid, | ||
| const XML_Char *pubid, | ||
| int has_internal_subset) | ||
| dummy_start_doctype_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(doctypeName), | ||
| const XML_Char *UNUSED_P(sysid), | ||
| const XML_Char *UNUSED_P(pubid), | ||
| int UNUSED_P(has_internal_subset)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_end_doctype_handler(void *userData) | ||
| dummy_end_doctype_handler(void *UNUSED_P(userData)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_entity_decl_handler(void *userData, | ||
| const XML_Char *entityName, | ||
| int is_parameter_entity, | ||
| const XML_Char *value, | ||
| int value_length, | ||
| const XML_Char *base, | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId, | ||
| const XML_Char *notationName) | ||
| dummy_entity_decl_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(entityName), | ||
| int UNUSED_P(is_parameter_entity), | ||
| const XML_Char *UNUSED_P(value), | ||
| int UNUSED_P(value_length), | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *UNUSED_P(systemId), | ||
| const XML_Char *UNUSED_P(publicId), | ||
| const XML_Char *UNUSED_P(notationName)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_notation_decl_handler(void *userData, | ||
| const XML_Char *notationName, | ||
| const XML_Char *base, | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| dummy_notation_decl_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(notationName), | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *UNUSED_P(systemId), | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_element_decl_handler(void *userData, | ||
| const XML_Char *name, | ||
| XML_Content *model) | ||
| dummy_element_decl_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(name), | ||
| XML_Content *UNUSED_P(model)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_attlist_decl_handler(void *userData, | ||
| const XML_Char *elname, | ||
| const XML_Char *attname, | ||
| const XML_Char *att_type, | ||
| const XML_Char *dflt, | ||
| int isrequired) | ||
| dummy_attlist_decl_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(elname), | ||
| const XML_Char *UNUSED_P(attname), | ||
| const XML_Char *UNUSED_P(att_type), | ||
| const XML_Char *UNUSED_P(dflt), | ||
| int UNUSED_P(isrequired)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_comment_handler(void *userData, const XML_Char *data) | ||
| dummy_comment_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(data)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data) | ||
| dummy_pi_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), const XML_Char *UNUSED_P(data)) | ||
| {} | ||
| static void XMLCALL | ||
| dummy_start_element(void *userData, | ||
| const XML_Char *name, const XML_Char **atts) | ||
| dummy_start_element(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) | ||
| {} | ||
@@ -164,3 +190,3 @@ | ||
| /* test that a NUL byte (in US-ASCII data) is an error */ | ||
| if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK) | ||
| fail("Parser did not report error on NUL-byte."); | ||
@@ -185,5 +211,5 @@ if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) | ||
| /* This test is really just making sure we don't core on a UTF-8 BOM. */ | ||
| char *text = "\357\273\277<e/>"; | ||
| const char *text = "\357\273\277<e/>"; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -197,3 +223,3 @@ } | ||
| if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -207,3 +233,3 @@ } | ||
| if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -220,3 +246,3 @@ } | ||
| static void XMLCALL | ||
| accumulate_attribute(void *userData, const XML_Char *name, | ||
| accumulate_attribute(void *userData, const XML_Char *UNUSED_P(name), | ||
| const XML_Char **atts) | ||
@@ -233,3 +259,3 @@ { | ||
| static void | ||
| _run_character_check(XML_Char *text, XML_Char *expected, | ||
| _run_character_check(const XML_Char *text, const XML_Char *expected, | ||
| const char *file, int line) | ||
@@ -242,3 +268,3 @@ { | ||
| XML_SetCharacterDataHandler(parser, accumulate_characters); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| _xml_failure(parser, file, line); | ||
@@ -252,3 +278,3 @@ CharData_CheckXMLChars(&storage, expected); | ||
| static void | ||
| _run_attribute_check(XML_Char *text, XML_Char *expected, | ||
| _run_attribute_check(const XML_Char *text, const XML_Char *expected, | ||
| const char *file, int line) | ||
@@ -261,3 +287,3 @@ { | ||
| XML_SetStartElementHandler(parser, accumulate_attribute); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| _xml_failure(parser, file, line); | ||
@@ -273,3 +299,3 @@ CharData_CheckXMLChars(&storage, expected); | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?>\n" | ||
@@ -286,3 +312,3 @@ "<e>J\xF8rgen \xE6\xF8\xE5\xC6\xD8\xC5</e>"; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?>\n" | ||
@@ -297,3 +323,3 @@ "<doc>éèàçêÈ</doc>"; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?>\n" | ||
@@ -308,3 +334,3 @@ "<doc>éèàçêÈ</doc>"; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?>\n" | ||
@@ -319,3 +345,3 @@ "<doc>\xE9\xE8\xE0\xE7\xEa\xC8</doc>"; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='utf-8'?>\n" | ||
@@ -334,3 +360,3 @@ "<doc>\xC3\xA9</doc>"; | ||
| { | ||
| char *text = "<doc>\xEF\xBA\xBF</doc>"; | ||
| const char *text = "<doc>\xEF\xBA\xBF</doc>"; | ||
| run_character_check(text, "\xEF\xBA\xBF"); | ||
@@ -352,3 +378,3 @@ } | ||
| sprintf(text, "<e>%ccd</e>", i); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) { | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) { | ||
| sprintf(text, | ||
@@ -367,2 +393,64 @@ "expected token error for '%c' (ordinal %d) in UTF-8 text", | ||
| /* Examples, not masks: */ | ||
| #define UTF8_LEAD_1 "\x7f" /* 0b01111111 */ | ||
| #define UTF8_LEAD_2 "\xdf" /* 0b11011111 */ | ||
| #define UTF8_LEAD_3 "\xef" /* 0b11101111 */ | ||
| #define UTF8_LEAD_4 "\xf7" /* 0b11110111 */ | ||
| #define UTF8_FOLLOW "\xbf" /* 0b10111111 */ | ||
| START_TEST(test_utf8_auto_align) | ||
| { | ||
| struct TestCase { | ||
| ptrdiff_t expectedMovementInChars; | ||
| const char * input; | ||
| }; | ||
| struct TestCase cases[] = { | ||
| {00, ""}, | ||
| {00, UTF8_LEAD_1}, | ||
| {-1, UTF8_LEAD_2}, | ||
| {00, UTF8_LEAD_2 UTF8_FOLLOW}, | ||
| {-1, UTF8_LEAD_3}, | ||
| {-2, UTF8_LEAD_3 UTF8_FOLLOW}, | ||
| {00, UTF8_LEAD_3 UTF8_FOLLOW UTF8_FOLLOW}, | ||
| {-1, UTF8_LEAD_4}, | ||
| {-2, UTF8_LEAD_4 UTF8_FOLLOW}, | ||
| {-3, UTF8_LEAD_4 UTF8_FOLLOW UTF8_FOLLOW}, | ||
| {00, UTF8_LEAD_4 UTF8_FOLLOW UTF8_FOLLOW UTF8_FOLLOW}, | ||
| }; | ||
| size_t i = 0; | ||
| bool success = true; | ||
| for (; i < sizeof(cases) / sizeof(*cases); i++) { | ||
| const char * fromLim = cases[i].input + strlen(cases[i].input); | ||
| const char * const fromLimInitially = fromLim; | ||
| ptrdiff_t actualMovementInChars; | ||
| align_limit_to_full_utf8_characters(cases[i].input, &fromLim); | ||
| actualMovementInChars = (fromLim - fromLimInitially); | ||
| if (actualMovementInChars != cases[i].expectedMovementInChars) { | ||
| size_t j = 0; | ||
| success = false; | ||
| printf("[-] UTF-8 case %2lu: Expected movement by %2ld chars" | ||
| ", actually moved by %2ld chars: \"", | ||
| i + 1, cases[i].expectedMovementInChars, actualMovementInChars); | ||
| for (; j < strlen(cases[i].input); j++) { | ||
| printf("\\x%02x", (unsigned char)cases[i].input[j]); | ||
| } | ||
| printf("\"\n"); | ||
| } | ||
| } | ||
| if (! success) { | ||
| fail("UTF-8 auto-alignment is not bullet-proof\n"); | ||
| } | ||
| } | ||
| END_TEST | ||
| START_TEST(test_utf16) | ||
@@ -381,3 +469,3 @@ { | ||
| "\000d\000o\000c\000>"; | ||
| if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -397,3 +485,3 @@ } | ||
| fail("bad value of first_chunk_bytes"); | ||
| if ( XML_Parse(parser, text, first_chunk_bytes, XML_FALSE) | ||
| if ( _XML_Parse_SINGLE_BYTES(parser, text, first_chunk_bytes, XML_FALSE) | ||
| == XML_STATUS_ERROR) | ||
@@ -403,3 +491,3 @@ xml_failure(parser); | ||
| enum XML_Status rc; | ||
| rc = XML_Parse(parser, text + first_chunk_bytes, | ||
| rc = _XML_Parse_SINGLE_BYTES(parser, text + first_chunk_bytes, | ||
| sizeof(text) - first_chunk_bytes - 1, XML_TRUE); | ||
@@ -415,7 +503,7 @@ if (rc == XML_STATUS_ERROR) | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?>\n" | ||
| "<e a='\xE4 \xF6 \xFC ä ö ü ä ö ü >'\n" | ||
| " >\xE4 \xF6 \xFC ä ö ü ä ö ü ></e>"; | ||
| char *utf8 = | ||
| const char *utf8 = | ||
| "\xC3\xA4 \xC3\xB6 \xC3\xBC " | ||
@@ -433,3 +521,3 @@ "\xC3\xA4 \xC3\xB6 \xC3\xBC " | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<tag>\n" | ||
@@ -440,3 +528,3 @@ "\n" | ||
| if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -456,6 +544,6 @@ lineno = XML_GetCurrentLineNumber(parser); | ||
| { | ||
| char *text = "<tag></tag>"; | ||
| const char *text = "<tag></tag>"; | ||
| XML_Size colno; | ||
| if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -474,3 +562,3 @@ colno = XML_GetCurrentColumnNumber(parser); | ||
| start_element_event_handler2(void *userData, const XML_Char *name, | ||
| const XML_Char **attr) | ||
| const XML_Char **UNUSED_P(attr)) | ||
| { | ||
@@ -505,3 +593,3 @@ CharData *storage = (CharData *) userData; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<a>\n" /* Unix end-of-line */ | ||
@@ -515,3 +603,3 @@ " <b>\r\n" /* Windows end-of-line */ | ||
| "</a>"; | ||
| char *expected = | ||
| const char *expected = | ||
| "<a> at col:0 line:1\n" | ||
@@ -533,3 +621,3 @@ "<b> at col:2 line:2\n" | ||
| XML_SetEndElementHandler(parser, end_element_event_handler2); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -544,3 +632,3 @@ | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<a>\n" | ||
@@ -550,3 +638,3 @@ " <b>\n" | ||
| XML_Size lineno; | ||
| if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) | ||
| fail("Expected a parse error"); | ||
@@ -566,3 +654,3 @@ | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<a>\n" | ||
@@ -572,3 +660,3 @@ " <b>\n" | ||
| XML_Size colno; | ||
| if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) | ||
| fail("Expected a parse error"); | ||
@@ -594,3 +682,3 @@ | ||
| */ | ||
| char *text = | ||
| const char *text = | ||
| "<e>" | ||
@@ -617,3 +705,3 @@ /* 64 chars */ | ||
| "</e>"; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -638,4 +726,4 @@ } | ||
| { | ||
| char *text = "<a><b><c/></b><d><f/></d></a>"; | ||
| char *expected = "/c/b/f/d/a"; | ||
| const char *text = "<a><b><c/></b><d><f/></d></a>"; | ||
| const char *expected = "/c/b/f/d/a"; | ||
| CharData storage; | ||
@@ -646,3 +734,3 @@ | ||
| XML_SetEndElementHandler(parser, end_element_event_handler); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -721,4 +809,4 @@ CharData_CheckString(&storage, expected); | ||
| static void XMLCALL | ||
| check_attr_contains_normalized_whitespace(void *userData, | ||
| const XML_Char *name, | ||
| check_attr_contains_normalized_whitespace(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(name), | ||
| const XML_Char **atts) | ||
@@ -745,3 +833,3 @@ { | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -762,3 +850,3 @@ " <!ATTLIST doc\n" | ||
| check_attr_contains_normalized_whitespace); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -785,3 +873,3 @@ } | ||
| static int XMLCALL | ||
| UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info) | ||
| UnknownEncodingHandler(void *UNUSED_P(data),const XML_Char *encoding,XML_Encoding *info) | ||
| { | ||
@@ -802,3 +890,3 @@ if (strcmp(encoding,"unsupported-encoding") == 0) { | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='unsupported-encoding'?>\n" | ||
@@ -809,3 +897,3 @@ "<!DOCTYPE test [<!ENTITY foo 'bar'>]>\n" | ||
| XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -819,5 +907,5 @@ } | ||
| const XML_Char *context, | ||
| const XML_Char *base, | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *UNUSED_P(systemId), | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| { | ||
@@ -827,3 +915,3 @@ /* This text says it's an unsupported encoding, but it's really | ||
| */ | ||
| char *text = | ||
| const char *text = | ||
| "<?xml encoding='iso-8859-3'?>" | ||
@@ -838,3 +926,3 @@ "\xC3\xA9"; | ||
| fail("XML_SetEncoding() ignored for external entity"); | ||
| if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) | ||
| if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE) | ||
| == XML_STATUS_ERROR) { | ||
@@ -849,3 +937,3 @@ xml_failure(parser); | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -866,7 +954,7 @@ " <!ENTITY en SYSTEM 'http://xml.libexpat.org/dummy.ent'>\n" | ||
| START_TEST(test_wfc_undeclared_entity_unread_external_subset) { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc SYSTEM 'foo'>\n" | ||
| "<doc>&entity;</doc>"; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -890,3 +978,3 @@ } | ||
| START_TEST(test_wfc_undeclared_entity_standalone) { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n" | ||
@@ -905,5 +993,5 @@ "<!DOCTYPE doc SYSTEM 'foo'>\n" | ||
| const XML_Char *context, | ||
| const XML_Char *base, | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *UNUSED_P(systemId), | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| { | ||
@@ -916,3 +1004,3 @@ char *text = (char *)XML_GetUserData(parser); | ||
| fail("Could not create external entity parser."); | ||
| if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) | ||
| if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE) | ||
| == XML_STATUS_ERROR) { | ||
@@ -929,7 +1017,7 @@ xml_failure(parser); | ||
| START_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n" | ||
| "<!DOCTYPE doc SYSTEM 'foo'>\n" | ||
| "<doc>&entity;</doc>"; | ||
| char *foo_text = | ||
| char foo_text[] = | ||
| "<!ELEMENT doc (#PCDATA)*>"; | ||
@@ -950,7 +1038,7 @@ | ||
| START_TEST(test_wfc_undeclared_entity_with_external_subset) { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0' encoding='us-ascii'?>\n" | ||
| "<!DOCTYPE doc SYSTEM 'foo'>\n" | ||
| "<doc>&entity;</doc>"; | ||
| char *foo_text = | ||
| char foo_text[] = | ||
| "<!ELEMENT doc (#PCDATA)*>"; | ||
@@ -961,3 +1049,3 @@ | ||
| XML_SetExternalEntityRefHandler(parser, external_entity_loader); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -969,3 +1057,3 @@ } | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -985,3 +1073,3 @@ " <!ENTITY entity '&entity;'>\n" | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -1018,3 +1106,3 @@ "<!ENTITY e SYSTEM 'http://xml.libexpat.org/e'>\n" | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<doc xmlns:prefix='http://www.example.com/'>\n" | ||
@@ -1024,3 +1112,3 @@ " <e xmlns:prefix=''/>\n" | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1036,3 +1124,3 @@ } | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE e:element [\n" | ||
@@ -1044,3 +1132,3 @@ " <!ATTLIST e:element\n" | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1050,3 +1138,3 @@ } | ||
| static char *long_character_data_text = | ||
| static const char *long_character_data_text = | ||
| "<?xml version='1.0' encoding='iso-8859-1'?><s>" | ||
@@ -1078,4 +1166,4 @@ "012345678901234567890123456789012345678901234567890123456789" | ||
| static void | ||
| clearing_aborting_character_handler(void *userData, | ||
| const XML_Char *s, int len) | ||
| clearing_aborting_character_handler(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(s), int UNUSED_P(len)) | ||
| { | ||
@@ -1096,7 +1184,7 @@ XML_StopParser(parser, resumable); | ||
| */ | ||
| char *text = long_character_data_text; | ||
| const char *text = long_character_data_text; | ||
| XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); | ||
| resumable = XML_FALSE; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1118,7 +1206,7 @@ if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED) | ||
| */ | ||
| char *text = long_character_data_text; | ||
| const char *text = long_character_data_text; | ||
| XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); | ||
| resumable = XML_TRUE; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED) | ||
| xml_failure(parser); | ||
@@ -1130,3 +1218,98 @@ if (XML_GetErrorCode(parser) != XML_ERROR_NONE) | ||
| START_TEST(test_good_cdata_ascii) | ||
| { | ||
| const char *text = "<a><![CDATA[<greeting>Hello, world!</greeting>]]></a>"; | ||
| const char *expected = "<greeting>Hello, world!</greeting>"; | ||
| CharData storage; | ||
| CharData_Init(&storage); | ||
| XML_SetUserData(parser, &storage); | ||
| XML_SetCharacterDataHandler(parser, accumulate_characters); | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
| CharData_CheckXMLChars(&storage, expected); | ||
| } | ||
| END_TEST | ||
| START_TEST(test_good_cdata_utf16) | ||
| { | ||
| /* Test data is: | ||
| * <?xml version='1.0' encoding='utf-16'?> | ||
| * <a><![CDATA[hello]]></a> | ||
| */ | ||
| const char text[] = | ||
| "\0<\0?\0x\0m\0l\0" | ||
| " \0v\0e\0r\0s\0i\0o\0n\0=\0'\0\x31\0.\0\x30\0'\0" | ||
| " \0e\0n\0c\0o\0d\0i\0n\0g\0=\0'\0u\0t\0f\0-\0""1\0""6\0'" | ||
| "\0?\0>\0\n" | ||
| "\0<\0a\0>\0<\0!\0[\0C\0D\0A\0T\0A\0[\0h\0e\0l\0l\0o\0]\0]\0>\0<\0/\0a\0>"; | ||
| const char *expected = "hello"; | ||
| CharData storage; | ||
| CharData_Init(&storage); | ||
| XML_SetUserData(parser, &storage); | ||
| XML_SetCharacterDataHandler(parser, accumulate_characters); | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
| CharData_CheckXMLChars(&storage, expected); | ||
| } | ||
| END_TEST | ||
| START_TEST(test_bad_cdata) | ||
| { | ||
| struct CaseData { | ||
| const char *text; | ||
| enum XML_Error expectedError; | ||
| }; | ||
| struct CaseData cases[] = { | ||
| {"<a><", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><!", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![C", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![CD", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![CDA", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![CDAT", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![CDATA", XML_ERROR_UNCLOSED_TOKEN}, | ||
| {"<a><![CDATA[", XML_ERROR_UNCLOSED_CDATA_SECTION}, | ||
| {"<a><![CDATA[]", XML_ERROR_UNCLOSED_CDATA_SECTION}, | ||
| {"<a><![CDATA[]]", XML_ERROR_UNCLOSED_CDATA_SECTION}, | ||
| {"<a><!<a/>", XML_ERROR_INVALID_TOKEN}, | ||
| {"<a><![<a/>", XML_ERROR_UNCLOSED_TOKEN}, /* ?! */ | ||
| {"<a><![C<a/>", XML_ERROR_UNCLOSED_TOKEN}, /* ?! */ | ||
| {"<a><![CD<a/>", XML_ERROR_INVALID_TOKEN}, | ||
| {"<a><![CDA<a/>", XML_ERROR_INVALID_TOKEN}, | ||
| {"<a><![CDAT<a/>", XML_ERROR_INVALID_TOKEN}, | ||
| {"<a><![CDATA<a/>", XML_ERROR_INVALID_TOKEN}, | ||
| {"<a><![CDATA[<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION}, | ||
| {"<a><![CDATA[]<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION}, | ||
| {"<a><![CDATA[]]<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION} | ||
| }; | ||
| size_t i = 0; | ||
| for (; i < sizeof(cases) / sizeof(struct CaseData); i++) { | ||
| const enum XML_Status actualStatus = _XML_Parse_SINGLE_BYTES( | ||
| parser, cases[i].text, strlen(cases[i].text), XML_TRUE); | ||
| const enum XML_Error actualError = XML_GetErrorCode(parser); | ||
| assert(actualStatus == XML_STATUS_ERROR); | ||
| if (actualError != cases[i].expectedError) { | ||
| char message[100]; | ||
| sprintf(message, "Expected error %d but got error %d for case %u: \"%s\"\n", | ||
| cases[i].expectedError, actualError, (unsigned int)i + 1, cases[i].text); | ||
| fail(message); | ||
| } | ||
| XML_ParserReset(parser, NULL); | ||
| } | ||
| } | ||
| END_TEST | ||
| /* | ||
@@ -1188,6 +1371,6 @@ * Namespaces tests. | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<foo:e xmlns:foo='http://expat.sf.net/' bar:a='12'\n" | ||
| " xmlns:bar='http://expat.sf.net/'></foo:e>"; | ||
| char *elemstr[] = { | ||
| const char *elemstr[] = { | ||
| "http://expat.sf.net/ e foo", | ||
@@ -1199,3 +1382,3 @@ "http://expat.sf.net/ a bar" | ||
| XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1230,3 +1413,3 @@ } | ||
| static void | ||
| run_ns_tagname_overwrite_test(char *text, char *result) | ||
| run_ns_tagname_overwrite_test(const char *text, const char *result) | ||
| { | ||
@@ -1238,3 +1421,3 @@ CharData storage; | ||
| overwrite_start_checker, overwrite_end_checker); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1247,3 +1430,3 @@ CharData_CheckString(&storage, result); | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<n:e xmlns:n='http://xml.libexpat.org/'>\n" | ||
@@ -1253,3 +1436,3 @@ " <n:f n:attr='foo'/>\n" | ||
| "</n:e>"; | ||
| char *result = | ||
| const char *result = | ||
| "start http://xml.libexpat.org/ e\n" | ||
@@ -1270,3 +1453,3 @@ "start http://xml.libexpat.org/ f\n" | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<n:e xmlns:n='http://xml.libexpat.org/'>\n" | ||
@@ -1276,3 +1459,3 @@ " <n:f n:attr='foo'/>\n" | ||
| "</n:e>"; | ||
| char *result = | ||
| const char *result = | ||
| "start http://xml.libexpat.org/ e n\n" | ||
@@ -1294,4 +1477,4 @@ "start http://xml.libexpat.org/ f n\n" | ||
| static void XMLCALL | ||
| start_element_fail(void *userData, | ||
| const XML_Char *name, const XML_Char **atts) | ||
| start_element_fail(void *UNUSED_P(userData), | ||
| const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) | ||
| { | ||
@@ -1304,4 +1487,4 @@ /* We should never get here. */ | ||
| start_ns_clearing_start_element(void *userData, | ||
| const XML_Char *prefix, | ||
| const XML_Char *uri) | ||
| const XML_Char *UNUSED_P(prefix), | ||
| const XML_Char *UNUSED_P(uri)) | ||
| { | ||
@@ -1317,3 +1500,3 @@ XML_SetStartElementHandler((XML_Parser) userData, NULL); | ||
| */ | ||
| char *text = "<e xmlns='http://xml.libexpat.org/'></e>"; | ||
| const char *text = "<e xmlns='http://xml.libexpat.org/'></e>"; | ||
@@ -1323,3 +1506,3 @@ XML_SetStartElementHandler(parser, start_element_fail); | ||
| XML_UseParserAsHandlerArg(parser); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1333,8 +1516,8 @@ } | ||
| const XML_Char *context, | ||
| const XML_Char *base, | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *UNUSED_P(systemId), | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| { | ||
| intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser); | ||
| char *text; | ||
| const char *text; | ||
| XML_Parser p2; | ||
@@ -1352,3 +1535,3 @@ | ||
| p2 = XML_ExternalEntityParserCreate(parser, context, NULL); | ||
| if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { | ||
| if (_XML_Parse_SINGLE_BYTES(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { | ||
| xml_failure(p2); | ||
@@ -1363,3 +1546,3 @@ return 0; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0'?>\n" | ||
@@ -1378,3 +1561,3 @@ "<!DOCTYPE doc SYSTEM 'http://xml.libexpat.org/doc.dtd' [\n" | ||
| XML_SetUserData(parser, NULL); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1387,3 +1570,3 @@ } | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<doc xmlns:prefix='http://xml.libexpat.org/'>\n" | ||
@@ -1403,3 +1586,3 @@ " <e xmlns:prefix=''/>\n" | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<?xml version='1.0'?>\n" | ||
@@ -1417,3 +1600,3 @@ "<docelem xmlns:pre=''/>"; | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -1435,3 +1618,3 @@ " <!ELEMENT doc EMPTY>\n" | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<!DOCTYPE doc [\n" | ||
@@ -1446,3 +1629,3 @@ " <!ELEMENT prefix:doc EMPTY>\n" | ||
| function also used for another test. */ | ||
| char *elemstr[] = { | ||
| const char *elemstr[] = { | ||
| "http://xml.libexpat.org/ doc prefix" | ||
@@ -1453,3 +1636,3 @@ }; | ||
| XML_SetEndElementHandler(parser, triplet_end_checker); | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1461,7 +1644,7 @@ } | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<doc xmlns='http://xml.libexpat.org/'>\n" | ||
| " <e xmlns=''/>\n" | ||
| "</doc>"; | ||
| if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) | ||
| xml_failure(parser); | ||
@@ -1474,3 +1657,3 @@ } | ||
| { | ||
| char *text = | ||
| const char *text = | ||
| "<doc xmlns:a='http://xml.libexpat.org/a'\n" | ||
@@ -1488,3 +1671,3 @@ " xmlns:b='http://xml.libexpat.org/a'\n" | ||
| { | ||
| char *text = "<doc a:attr=''/>"; | ||
| const char *text = "<doc a:attr=''/>"; | ||
| expect_failure(text, | ||
@@ -1499,3 +1682,3 @@ XML_ERROR_UNBOUND_PREFIX, | ||
| { | ||
| char *text = "<a:doc/>"; | ||
| const char *text = "<a:doc/>"; | ||
| expect_failure(text, | ||
@@ -1522,2 +1705,3 @@ XML_ERROR_UNBOUND_PREFIX, | ||
| tcase_add_test(tc_basic, test_illegal_utf8); | ||
| tcase_add_test(tc_basic, test_utf8_auto_align); | ||
| tcase_add_test(tc_basic, test_utf16); | ||
@@ -1558,2 +1742,5 @@ tcase_add_test(tc_basic, test_utf16_le_epilog_newline); | ||
| tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls); | ||
| tcase_add_test(tc_basic, test_good_cdata_ascii); | ||
| tcase_add_test(tc_basic, test_good_cdata_utf16); | ||
| tcase_add_test(tc_basic, test_bad_cdata); | ||
@@ -1560,0 +1747,0 @@ suite_add_tcase(s, tc_namespace); |
@@ -1,2 +0,2 @@ | ||
| #! /bin/sh | ||
| #! /usr/bin/env bash | ||
@@ -23,2 +23,4 @@ # EXPAT TEST SCRIPT FOR W3C XML TEST SUITE | ||
| shopt -s nullglob | ||
| MYDIR="`dirname \"$0\"`" | ||
@@ -29,3 +31,3 @@ cd "$MYDIR" | ||
| # XMLWF=/usr/local/bin/xmlwf | ||
| TS="$MYDIR/XML-Test-Suite" | ||
| TS="$MYDIR" | ||
| # OUTPUT must terminate with the directory separator. | ||
@@ -105,3 +107,3 @@ OUTPUT="$TS/out/" | ||
| done | ||
| rm outfile | ||
| rm -f outfile | ||
| done | ||
@@ -108,0 +110,0 @@ |
@@ -19,2 +19,10 @@ | ||
| can be opened and imported in VS.NET without problems. | ||
| Note: Tests have their own *.dsw files. | ||
| * MS Visual Studio 2013 and 2015: | ||
| A solution file for Visual Studio 2013 is provided: expat.sln. | ||
| The associated project files (*.vcxproj) reside in the appropriate | ||
| project directories. This solution file can be opened in VS 2015 | ||
| and should be upgraded automatically if VS 2013 is not also installed. | ||
| Note: Tests have their own solution files. | ||
@@ -21,0 +29,0 @@ * All MS C/C++ compilers: |
@@ -6,2 +6,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #include "codepage.h" | ||
| #include "internal.h" /* for UNUSED_P only */ | ||
@@ -58,3 +59,3 @@ #if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) | ||
| int | ||
| codepageMap(int cp, int *map) | ||
| codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) | ||
| { | ||
@@ -65,3 +66,3 @@ return 0; | ||
| int | ||
| codepageConvert(int cp, const char *p) | ||
| codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) | ||
| { | ||
@@ -68,0 +69,0 @@ return -1; |
@@ -11,2 +11,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| /* Functions close(2) and read(2) */ | ||
| #ifdef __WATCOMC__ | ||
@@ -18,8 +19,8 @@ #ifndef __LINUX__ | ||
| #endif | ||
| #else | ||
| # if !defined(WIN32) && !defined(_WIN32) && !defined(_WIN64) | ||
| # include <unistd.h> | ||
| # endif | ||
| #endif | ||
| #ifdef __BEOS__ | ||
| #include <unistd.h> | ||
| #endif | ||
| #ifndef S_ISREG | ||
@@ -26,0 +27,0 @@ #ifndef S_IFREG |
@@ -54,3 +54,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| } | ||
| p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, | ||
| p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, | ||
| MAP_FILE|MAP_PRIVATE, fd, (off_t)0); | ||
@@ -63,5 +63,5 @@ if (p == (void *)-1) { | ||
| processor(p, nbytes, name, arg); | ||
| munmap((caddr_t)p, nbytes); | ||
| munmap((void *)p, nbytes); | ||
| close(fd); | ||
| return 1; | ||
| } |
@@ -11,3 +11,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #ifdef COMPILED_FROM_DSP | ||
| #ifdef WIN32 | ||
| #include "winconfig.h" | ||
@@ -22,5 +22,6 @@ #elif defined(MACOS_CLASSIC) | ||
| #include <expat_config.h> | ||
| #endif /* ndef COMPILED_FROM_DSP */ | ||
| #endif /* ndef WIN32 */ | ||
| #include "expat.h" | ||
| #include "internal.h" /* for UNUSED_P only */ | ||
| #include "xmlfile.h" | ||
@@ -137,3 +138,3 @@ #include "xmltchar.h" | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| { | ||
@@ -206,3 +207,3 @@ int result; | ||
| const XML_Char *systemId, | ||
| const XML_Char *publicId) | ||
| const XML_Char *UNUSED_P(publicId)) | ||
| { | ||
@@ -209,0 +210,0 @@ XML_Char *s; |
@@ -12,2 +12,3 @@ /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | ||
| #include "codepage.h" | ||
| #include "internal.h" /* for UNUSED_P only */ | ||
| #include "xmlfile.h" | ||
@@ -252,3 +253,3 @@ #include "xmltchar.h" | ||
| static void XMLCALL | ||
| defaultCharacterData(void *userData, const XML_Char *s, int len) | ||
| defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len)) | ||
| { | ||
@@ -259,4 +260,4 @@ XML_DefaultCurrent((XML_Parser) userData); | ||
| static void XMLCALL | ||
| defaultStartElement(void *userData, const XML_Char *name, | ||
| const XML_Char **atts) | ||
| defaultStartElement(void *userData, const XML_Char *UNUSED_P(name), | ||
| const XML_Char **UNUSED_P(atts)) | ||
| { | ||
@@ -267,3 +268,3 @@ XML_DefaultCurrent((XML_Parser) userData); | ||
| static void XMLCALL | ||
| defaultEndElement(void *userData, const XML_Char *name) | ||
| defaultEndElement(void *userData, const XML_Char *UNUSED_P(name)) | ||
| { | ||
@@ -274,4 +275,4 @@ XML_DefaultCurrent((XML_Parser) userData); | ||
| static void XMLCALL | ||
| defaultProcessingInstruction(void *userData, const XML_Char *target, | ||
| const XML_Char *data) | ||
| defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target), | ||
| const XML_Char *UNUSED_P(data)) | ||
| { | ||
@@ -282,3 +283,3 @@ XML_DefaultCurrent((XML_Parser) userData); | ||
| static void XMLCALL | ||
| nopCharacterData(void *userData, const XML_Char *s, int len) | ||
| nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len)) | ||
| { | ||
@@ -288,3 +289,3 @@ } | ||
| static void XMLCALL | ||
| nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) | ||
| nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) | ||
| { | ||
@@ -294,3 +295,3 @@ } | ||
| static void XMLCALL | ||
| nopEndElement(void *userData, const XML_Char *name) | ||
| nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name)) | ||
| { | ||
@@ -300,4 +301,4 @@ } | ||
| static void XMLCALL | ||
| nopProcessingInstruction(void *userData, const XML_Char *target, | ||
| const XML_Char *data) | ||
| nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), | ||
| const XML_Char *UNUSED_P(data)) | ||
| { | ||
@@ -446,5 +447,5 @@ } | ||
| const XML_Char *doctypeName, | ||
| const XML_Char *sysid, | ||
| const XML_Char *pubid, | ||
| int has_internal_subset) | ||
| const XML_Char *UNUSED_P(sysid), | ||
| const XML_Char *UNUSED_P(pubid), | ||
| int UNUSED_P(has_internal_subset)) | ||
| { | ||
@@ -471,3 +472,3 @@ XML_Parser parser = (XML_Parser) userData; | ||
| const XML_Char *notationName, | ||
| const XML_Char *base, | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *systemId, | ||
@@ -494,6 +495,6 @@ const XML_Char *publicId) | ||
| const XML_Char *entityName, | ||
| int is_param, | ||
| int UNUSED_P(is_param), | ||
| const XML_Char *value, | ||
| int value_length, | ||
| const XML_Char *base, | ||
| const XML_Char *UNUSED_P(base), | ||
| const XML_Char *systemId, | ||
@@ -573,3 +574,3 @@ const XML_Char *publicId, | ||
| static int XMLCALL | ||
| unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) | ||
| unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info) | ||
| { | ||
@@ -610,3 +611,3 @@ int cp; | ||
| static int XMLCALL | ||
| notStandalone(void *userData) | ||
| notStandalone(void *UNUSED_P(userData)) | ||
| { | ||
@@ -651,4 +652,3 @@ return 0; | ||
| ftprintf(stderr, | ||
| T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] " | ||
| "[-e encoding] file ...\n"), prog); | ||
| T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [file ...]\n"), prog); | ||
| exit(rc); | ||
@@ -778,2 +778,8 @@ } | ||
| parser = XML_ParserCreate(encoding); | ||
| if (! parser) { | ||
| tperror("Could not instantiate parser"); | ||
| exit(1); | ||
| } | ||
| if (requireStandalone) | ||
@@ -780,0 +786,0 @@ XML_SetNotStandaloneHandler(parser, notStandalone); |
+25
-17
| { | ||
| "name": "node-expat", | ||
| "version": "2.3.13", | ||
| "version": "2.3.14", | ||
| "main": "./lib/node-expat", | ||
@@ -18,7 +18,8 @@ "description": "NodeJS binding for fast XML parsing.", | ||
| "unit": "vows --spec ./test/**/*.js", | ||
| "test": "npm run unit && npm run lint" | ||
| "test": "npm run unit && npm run lint", | ||
| "benchmark": "node ./benchmark.js" | ||
| }, | ||
| "dependencies": { | ||
| "bindings": "^1.2.1", | ||
| "nan": "^2.2.0" | ||
| "nan": "^2.2.1" | ||
| }, | ||
@@ -29,11 +30,12 @@ "devDependencies": { | ||
| "iconv": "^2.1.11", | ||
| "libxmljs": "^0.17.0", | ||
| "ltx": "^2.2.0", | ||
| "libxmljs": "^0.17.1", | ||
| "ltx": "^2.2.2", | ||
| "node-xml": "^1.0.2", | ||
| "sax": "^1.1.5", | ||
| "sax": "^1.2.1", | ||
| "standard": "^7.1.2", | ||
| "vows": "^0.8.1" | ||
| }, | ||
| "repository": "github:node-xmpp/node-expat", | ||
| "homepage": "http://github.com/node-xmpp/node-expat", | ||
| "bugs": "https://github.com/node-xmpp/node-expat/issues", | ||
| "repository": "github:astro/node-expat", | ||
| "homepage": "http://github.com/astro/node-expat", | ||
| "bugs": "https://github.com/astro/node-expat/issues", | ||
| "author": { | ||
@@ -44,9 +46,2 @@ "name": "Astro", | ||
| }, | ||
| "maintainers": [ | ||
| { | ||
| "name": "Lloyd Watkin", | ||
| "email": "lloyd@evilprofessor.co.uk", | ||
| "web": "http://www.evilprofessor.co.uk" | ||
| } | ||
| ], | ||
| "contributors": [ | ||
@@ -66,5 +61,18 @@ "Stephan Maka", | ||
| "Julien Genestoux", | ||
| "Sonny Piers" | ||
| "Sonny Piers", | ||
| "Lloyd Watkin", | ||
| "AJ ONeal", | ||
| "Rod Vagg", | ||
| "Christoph Hartmann", | ||
| "Corbin Uselton", | ||
| "Julian Duque", | ||
| "Lovell Fuller", | ||
| "Antonio Bustos" | ||
| ], | ||
| "licenses": [ | ||
| { | ||
| "type": "MIT" | ||
| } | ||
| ], | ||
| "license": "MIT" | ||
| } |
+93
-17
| # node-expat | ||
| [](https://travis-ci.org/node-xmpp/node-expat/branches) | ||
| [](https://travis-ci.org/astro/node-expat/branches) | ||
| [](http://standardjs.com/) | ||
@@ -8,9 +8,4 @@ | ||
| You use [Node.js](https://nodejs.org) for speed? You process | ||
| XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourceforge.net/)! | ||
| You use [Node.js](https://nodejs.org) for speed? You process XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourceforge.net/)! | ||
| ## Manual | ||
| Please see the [node-expat manual](http://node-xmpp.org/doc/expat.html) | ||
| ## Install | ||
@@ -22,2 +17,79 @@ | ||
| ## Usage | ||
| Important events emitted by a parser: | ||
| ```javascript | ||
| (function () { | ||
| "use strict"; | ||
| var expat = require('node-expat') | ||
| var parser = new expat.Parser('UTF-8') | ||
| parser.on('startElement', function (name, attrs) { | ||
| console.log(name, attrs) | ||
| }) | ||
| parser.on('endElement', function (name) { | ||
| console.log(name) | ||
| }) | ||
| parser.on('text', function (text) { | ||
| console.log(text) | ||
| }) | ||
| parser.on('error', function (error) { | ||
| console.error(error) | ||
| }) | ||
| parser.write('<html><head><title>Hello World</title></head><body><p>Foobar</p></body></html>') | ||
| }()) | ||
| ``` | ||
| ## API | ||
| * `#on('startElement' function (name, attrs) {})` | ||
| * `#on('endElement' function (name) {})` | ||
| * `#on('text' function (text) {})` | ||
| * `#on('processingInstruction', function (target, data) {})` | ||
| * `#on('comment', function (s) {})` | ||
| * `#on('xmlDecl', function (version, encoding, standalone) {})` | ||
| * `#on('startCdata', function () {})` | ||
| * `#on('startCdata', function () {})` | ||
| * `#on('endCdata', function () {})` | ||
| * `#on('entityDecl', function (entityName, isParameterEntity, value, base, systemId, publicId, notationName) {})` | ||
| * `#on('error', function (e) {})` | ||
| * `#stop()` pauses | ||
| * `#resume()` resumes | ||
| ## Error handling | ||
| We don't emit an error event because libexpat doesn't use a callback | ||
| either. Instead, check that `parse()` returns `true`. A descriptive | ||
| string can be obtained via `getError()` to provide user feedback. | ||
| Alternatively, use the Parser like a node Stream. `write()` will emit | ||
| error events. | ||
| ## Namespace handling | ||
| A word about special parsing of *xmlns:* this is not necessary in a | ||
| bare SAX parser like this, given that the DOM replacement you are | ||
| using (if any) is not relevant to the parser. | ||
| ## Benchmark | ||
| `npm run benchmark` | ||
| | module | ops/sec | native | XML compliant | stream | | ||
| |---------------------------------------------------------------------------------------|--------:|:------:|:-------------:|:--------------:| | ||
| | [sax-js](https://github.com/isaacs/sax-js) | 99,412 | ☐ | ☑ | ☑ | | ||
| | [node-xml](https://github.com/dylang/node-xml) | 130,631 | ☐ | ☑ | ☑ | | ||
| | [libxmljs](https://github.com/polotek/libxmljs) | 276,136 | ☑ | ☑ | ☐ | | ||
| | **node-expat** | 322,769 | ☑ | ☑ | ☑ | | ||
| Higher is better. | ||
| ## Testing | ||
@@ -30,14 +102,18 @@ | ||
| ## Benchmark | ||
| ## Windows | ||
| ```node benchmark.js``` | ||
| If you fail to install node-expat as a dependency of node-xmpp, please update node-xmpp as it doesn't use node-expat anymore. | ||
| | module | ops/sec | native | XML compliant | | ||
| |---------------------------------------------------------------------------------------|--------:|:------:|:-------------:| | ||
| | [sax-js](https://github.com/isaacs/sax-js) | 18,641 | ☐ | ☑ | | ||
| | [node-xml](https://github.com/dylang/node-xml) | 49,257 | ☐ | ☑ | | ||
| | [libxmljs](https://github.com/polotek/libxmljs) | 95,169 | ☑ | ☑ | | ||
| | **node-expat** | 130,776 | ☑ | ☑ | | ||
| | [ltx/lib/parsers/ltx](https://github.com/node-xmpp/ltx/blob/master/lib/parsers/ltx.js)| 172,596 | ☐ | ☐ | | ||
| Dependencies for `node-gyp` https://github.com/TooTallNate/node-gyp#installation | ||
| Higher is better. | ||
| See https://github.com/astro/node-expat/issues/78 if you are getting errors about not finding `nan.h`. | ||
| ### expat.vcproj | ||
| ``` | ||
| VCBUILD : error : project file 'node-expat\build\deps\libexpat\expat.vcproj' was not found or not a valid proj | ||
| ect file. [C:\Users\admin\AppData\Roaming\npm\node_modules\node-expat\build\bin | ||
| ding.sln] | ||
| ``` | ||
| Install [Visual Studio C++ 2012](http://go.microsoft.com/?linkid=9816758) and run npm with the [`--msvs_version=2012` flag](http://stackoverflow.com/a/16854333/937891). |
| # This file is generated by gyp; do not edit. | ||
| export builddir_name ?= ./build/. | ||
| .PHONY: all | ||
| all: | ||
| $(MAKE) node_expat |
| # This file is generated by gyp; do not edit. | ||
| TOOLSET := target | ||
| TARGET := expat | ||
| DEFS_Debug := \ | ||
| '-DNODE_GYP_MODULE_NAME=expat' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DPIC' \ | ||
| '-DHAVE_EXPAT_CONFIG_H' \ | ||
| '-DDEBUG' \ | ||
| '-D_DEBUG' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Debug := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -Wno-missing-field-initializers \ | ||
| -g \ | ||
| -O0 | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Debug := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Debug := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Debug := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| DEFS_Release := \ | ||
| '-DNODE_GYP_MODULE_NAME=expat' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DPIC' \ | ||
| '-DHAVE_EXPAT_CONFIG_H' \ | ||
| '-DNDEBUG' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Release := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -Wno-missing-field-initializers \ | ||
| -O3 \ | ||
| -ffunction-sections \ | ||
| -fdata-sections \ | ||
| -fno-omit-frame-pointer | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Release := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Release := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Release := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| OBJS := \ | ||
| $(obj).target/$(TARGET)/deps/libexpat/lib/xmlparse.o \ | ||
| $(obj).target/$(TARGET)/deps/libexpat/lib/xmltok.o \ | ||
| $(obj).target/$(TARGET)/deps/libexpat/lib/xmlrole.o | ||
| # Add to the list of files we specially track dependencies for. | ||
| all_deps += $(OBJS) | ||
| # CFLAGS et al overrides must be target-local. | ||
| # See "Target-specific Variable Values" in the GNU Make manual. | ||
| $(OBJS): TOOLSET := $(TOOLSET) | ||
| $(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) | ||
| $(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) | ||
| # Suffix rules, putting all outputs into $(obj). | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| # Try building from generated source, too. | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| # End of this set of suffix rules | ||
| ### Rules for final target. | ||
| LDFLAGS_Debug := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LDFLAGS_Release := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LIBS := | ||
| $(obj).target/deps/libexpat/libexpat.a: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) | ||
| $(obj).target/deps/libexpat/libexpat.a: LIBS := $(LIBS) | ||
| $(obj).target/deps/libexpat/libexpat.a: TOOLSET := $(TOOLSET) | ||
| $(obj).target/deps/libexpat/libexpat.a: $(OBJS) FORCE_DO_CMD | ||
| $(call do_cmd,alink) | ||
| all_deps += $(obj).target/deps/libexpat/libexpat.a | ||
| # Add target alias | ||
| .PHONY: expat | ||
| expat: $(obj).target/deps/libexpat/libexpat.a | ||
| # Add target alias to "all" target. | ||
| .PHONY: all | ||
| all: expat | ||
| # Add target alias | ||
| .PHONY: expat | ||
| expat: $(builddir)/libexpat.a | ||
| # Copy this to the static library output path. | ||
| $(builddir)/libexpat.a: TOOLSET := $(TOOLSET) | ||
| $(builddir)/libexpat.a: $(obj).target/deps/libexpat/libexpat.a FORCE_DO_CMD | ||
| $(call do_cmd,copy) | ||
| all_deps += $(builddir)/libexpat.a | ||
| # Short alias for building this static library. | ||
| .PHONY: libexpat.a | ||
| libexpat.a: $(obj).target/deps/libexpat/libexpat.a $(builddir)/libexpat.a | ||
| # Add static library to "all" target. | ||
| .PHONY: all | ||
| all: $(builddir)/libexpat.a | ||
| # This file is generated by gyp; do not edit. | ||
| export builddir_name ?= ./build/deps/libexpat/. | ||
| .PHONY: all | ||
| all: | ||
| $(MAKE) -C ../.. expat |
| # This file is generated by gyp; do not edit. | ||
| TOOLSET := target | ||
| TARGET := version | ||
| DEFS_Debug := \ | ||
| '-DNODE_GYP_MODULE_NAME=version' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DDEBUG' \ | ||
| '-D_DEBUG' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Debug := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -g \ | ||
| -O0 | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Debug := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Debug := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Debug := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| DEFS_Release := \ | ||
| '-DNODE_GYP_MODULE_NAME=version' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DNDEBUG' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Release := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -O3 \ | ||
| -ffunction-sections \ | ||
| -fdata-sections \ | ||
| -fno-omit-frame-pointer | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Release := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Release := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Release := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| OBJS := \ | ||
| $(obj).target/$(TARGET)/deps/libexpat/version.o | ||
| # Add to the list of files we specially track dependencies for. | ||
| all_deps += $(OBJS) | ||
| # Make sure our dependencies are built before any of us. | ||
| $(OBJS): | $(builddir)/libexpat.a $(obj).target/deps/libexpat/libexpat.a | ||
| # CFLAGS et al overrides must be target-local. | ||
| # See "Target-specific Variable Values" in the GNU Make manual. | ||
| $(OBJS): TOOLSET := $(TOOLSET) | ||
| $(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) | ||
| $(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) | ||
| # Suffix rules, putting all outputs into $(obj). | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| # Try building from generated source, too. | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| # End of this set of suffix rules | ||
| ### Rules for final target. | ||
| LDFLAGS_Debug := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LDFLAGS_Release := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LIBS := | ||
| $(builddir)/version: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) | ||
| $(builddir)/version: LIBS := $(LIBS) | ||
| $(builddir)/version: LD_INPUTS := $(OBJS) $(obj).target/deps/libexpat/libexpat.a | ||
| $(builddir)/version: TOOLSET := $(TOOLSET) | ||
| $(builddir)/version: $(OBJS) $(obj).target/deps/libexpat/libexpat.a FORCE_DO_CMD | ||
| $(call do_cmd,link) | ||
| all_deps += $(builddir)/version | ||
| # Add target alias | ||
| .PHONY: version | ||
| version: $(builddir)/version | ||
-334
| # We borrow heavily from the kernel build setup, though we are simpler since | ||
| # we don't have Kconfig tweaking settings on us. | ||
| # The implicit make rules have it looking for RCS files, among other things. | ||
| # We instead explicitly write all the rules we care about. | ||
| # It's even quicker (saves ~200ms) to pass -r on the command line. | ||
| MAKEFLAGS=-r | ||
| # The source directory tree. | ||
| srcdir := .. | ||
| abs_srcdir := $(abspath $(srcdir)) | ||
| # The name of the builddir. | ||
| builddir_name ?= . | ||
| # The V=1 flag on command line makes us verbosely print command lines. | ||
| ifdef V | ||
| quiet= | ||
| else | ||
| quiet=quiet_ | ||
| endif | ||
| # Specify BUILDTYPE=Release on the command line for a release build. | ||
| BUILDTYPE ?= Release | ||
| # Directory all our build output goes into. | ||
| # Note that this must be two directories beneath src/ for unit tests to pass, | ||
| # as they reach into the src/ directory for data with relative paths. | ||
| builddir ?= $(builddir_name)/$(BUILDTYPE) | ||
| abs_builddir := $(abspath $(builddir)) | ||
| depsdir := $(builddir)/.deps | ||
| # Object output directory. | ||
| obj := $(builddir)/obj | ||
| abs_obj := $(abspath $(obj)) | ||
| # We build up a list of every single one of the targets so we can slurp in the | ||
| # generated dependency rule Makefiles in one pass. | ||
| all_deps := | ||
| CC.target ?= $(CC) | ||
| CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS) | ||
| CXX.target ?= $(CXX) | ||
| CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS) | ||
| LINK.target ?= $(LINK) | ||
| LDFLAGS.target ?= $(LDFLAGS) | ||
| AR.target ?= $(AR) | ||
| # C++ apps need to be linked with g++. | ||
| LINK ?= $(CXX.target) | ||
| # TODO(evan): move all cross-compilation logic to gyp-time so we don't need | ||
| # to replicate this environment fallback in make as well. | ||
| CC.host ?= gcc | ||
| CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host) | ||
| CXX.host ?= g++ | ||
| CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) | ||
| LINK.host ?= $(CXX.host) | ||
| LDFLAGS.host ?= | ||
| AR.host ?= ar | ||
| # Define a dir function that can handle spaces. | ||
| # http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions | ||
| # "leading spaces cannot appear in the text of the first argument as written. | ||
| # These characters can be put into the argument value by variable substitution." | ||
| empty := | ||
| space := $(empty) $(empty) | ||
| # http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces | ||
| replace_spaces = $(subst $(space),?,$1) | ||
| unreplace_spaces = $(subst ?,$(space),$1) | ||
| dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) | ||
| # Flags to make gcc output dependency info. Note that you need to be | ||
| # careful here to use the flags that ccache and distcc can understand. | ||
| # We write to a dep file on the side first and then rename at the end | ||
| # so we can't end up with a broken dep file. | ||
| depfile = $(depsdir)/$(call replace_spaces,$@).d | ||
| DEPFLAGS = -MMD -MF $(depfile).raw | ||
| # We have to fixup the deps output in a few ways. | ||
| # (1) the file output should mention the proper .o file. | ||
| # ccache or distcc lose the path to the target, so we convert a rule of | ||
| # the form: | ||
| # foobar.o: DEP1 DEP2 | ||
| # into | ||
| # path/to/foobar.o: DEP1 DEP2 | ||
| # (2) we want missing files not to cause us to fail to build. | ||
| # We want to rewrite | ||
| # foobar.o: DEP1 DEP2 \ | ||
| # DEP3 | ||
| # to | ||
| # DEP1: | ||
| # DEP2: | ||
| # DEP3: | ||
| # so if the files are missing, they're just considered phony rules. | ||
| # We have to do some pretty insane escaping to get those backslashes | ||
| # and dollar signs past make, the shell, and sed at the same time. | ||
| # Doesn't work with spaces, but that's fine: .d files have spaces in | ||
| # their names replaced with other characters. | ||
| define fixup_dep | ||
| # The depfile may not exist if the input file didn't have any #includes. | ||
| touch $(depfile).raw | ||
| # Fixup path as in (1). | ||
| sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) | ||
| # Add extra rules as in (2). | ||
| # We remove slashes and replace spaces with new lines; | ||
| # remove blank lines; | ||
| # delete the first line and append a colon to the remaining lines. | ||
| sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ | ||
| grep -v '^$$' |\ | ||
| sed -e 1d -e 's|$$|:|' \ | ||
| >> $(depfile) | ||
| rm $(depfile).raw | ||
| endef | ||
| # Command definitions: | ||
| # - cmd_foo is the actual command to run; | ||
| # - quiet_cmd_foo is the brief-output summary of the command. | ||
| quiet_cmd_cc = CC($(TOOLSET)) $@ | ||
| cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< | ||
| quiet_cmd_cxx = CXX($(TOOLSET)) $@ | ||
| cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< | ||
| quiet_cmd_touch = TOUCH $@ | ||
| cmd_touch = touch $@ | ||
| quiet_cmd_copy = COPY $@ | ||
| # send stderr to /dev/null to ignore messages when linking directories. | ||
| cmd_copy = rm -rf "$@" && cp -af "$<" "$@" | ||
| quiet_cmd_alink = AR($(TOOLSET)) $@ | ||
| cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) | ||
| quiet_cmd_alink_thin = AR($(TOOLSET)) $@ | ||
| cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) | ||
| # Due to circular dependencies between libraries :(, we wrap the | ||
| # special "figure out circular dependencies" flags around the entire | ||
| # input list during linking. | ||
| quiet_cmd_link = LINK($(TOOLSET)) $@ | ||
| cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) | ||
| # We support two kinds of shared objects (.so): | ||
| # 1) shared_library, which is just bundling together many dependent libraries | ||
| # into a link line. | ||
| # 2) loadable_module, which is generating a module intended for dlopen(). | ||
| # | ||
| # They differ only slightly: | ||
| # In the former case, we want to package all dependent code into the .so. | ||
| # In the latter case, we want to package just the API exposed by the | ||
| # outermost module. | ||
| # This means shared_library uses --whole-archive, while loadable_module doesn't. | ||
| # (Note that --whole-archive is incompatible with the --start-group used in | ||
| # normal linking.) | ||
| # Other shared-object link notes: | ||
| # - Set SONAME to the library filename so our binaries don't reference | ||
| # the local, absolute paths used on the link command-line. | ||
| quiet_cmd_solink = SOLINK($(TOOLSET)) $@ | ||
| cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) | ||
| quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ | ||
| cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) | ||
| # Define an escape_quotes function to escape single quotes. | ||
| # This allows us to handle quotes properly as long as we always use | ||
| # use single quotes and escape_quotes. | ||
| escape_quotes = $(subst ','\'',$(1)) | ||
| # This comment is here just to include a ' to unconfuse syntax highlighting. | ||
| # Define an escape_vars function to escape '$' variable syntax. | ||
| # This allows us to read/write command lines with shell variables (e.g. | ||
| # $LD_LIBRARY_PATH), without triggering make substitution. | ||
| escape_vars = $(subst $$,$$$$,$(1)) | ||
| # Helper that expands to a shell command to echo a string exactly as it is in | ||
| # make. This uses printf instead of echo because printf's behaviour with respect | ||
| # to escape sequences is more portable than echo's across different shells | ||
| # (e.g., dash, bash). | ||
| exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' | ||
| # Helper to compare the command we're about to run against the command | ||
| # we logged the last time we ran the command. Produces an empty | ||
| # string (false) when the commands match. | ||
| # Tricky point: Make has no string-equality test function. | ||
| # The kernel uses the following, but it seems like it would have false | ||
| # positives, where one string reordered its arguments. | ||
| # arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ | ||
| # $(filter-out $(cmd_$@), $(cmd_$(1)))) | ||
| # We instead substitute each for the empty string into the other, and | ||
| # say they're equal if both substitutions produce the empty string. | ||
| # .d files contain ? instead of spaces, take that into account. | ||
| command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ | ||
| $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) | ||
| # Helper that is non-empty when a prerequisite changes. | ||
| # Normally make does this implicitly, but we force rules to always run | ||
| # so we can check their command lines. | ||
| # $? -- new prerequisites | ||
| # $| -- order-only dependencies | ||
| prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) | ||
| # Helper that executes all postbuilds until one fails. | ||
| define do_postbuilds | ||
| @E=0;\ | ||
| for p in $(POSTBUILDS); do\ | ||
| eval $$p;\ | ||
| E=$$?;\ | ||
| if [ $$E -ne 0 ]; then\ | ||
| break;\ | ||
| fi;\ | ||
| done;\ | ||
| if [ $$E -ne 0 ]; then\ | ||
| rm -rf "$@";\ | ||
| exit $$E;\ | ||
| fi | ||
| endef | ||
| # do_cmd: run a command via the above cmd_foo names, if necessary. | ||
| # Should always run for a given target to handle command-line changes. | ||
| # Second argument, if non-zero, makes it do asm/C/C++ dependency munging. | ||
| # Third argument, if non-zero, makes it do POSTBUILDS processing. | ||
| # Note: We intentionally do NOT call dirx for depfile, since it contains ? for | ||
| # spaces already and dirx strips the ? characters. | ||
| define do_cmd | ||
| $(if $(or $(command_changed),$(prereq_changed)), | ||
| @$(call exact_echo, $($(quiet)cmd_$(1))) | ||
| @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" | ||
| $(if $(findstring flock,$(word 1,$(cmd_$1))), | ||
| @$(cmd_$(1)) | ||
| @echo " $(quiet_cmd_$(1)): Finished", | ||
| @$(cmd_$(1)) | ||
| ) | ||
| @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) | ||
| @$(if $(2),$(fixup_dep)) | ||
| $(if $(and $(3), $(POSTBUILDS)), | ||
| $(call do_postbuilds) | ||
| ) | ||
| ) | ||
| endef | ||
| # Declare the "all" target first so it is the default, | ||
| # even though we don't have the deps yet. | ||
| .PHONY: all | ||
| all: | ||
| # make looks for ways to re-generate included makefiles, but in our case, we | ||
| # don't have a direct way. Explicitly telling make that it has nothing to do | ||
| # for them makes it go faster. | ||
| %.d: ; | ||
| # Use FORCE_DO_CMD to force a target to run. Should be coupled with | ||
| # do_cmd. | ||
| .PHONY: FORCE_DO_CMD | ||
| FORCE_DO_CMD: | ||
| TOOLSET := target | ||
| # Suffix rules, putting all outputs into $(obj). | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| # Try building from generated source, too. | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| $(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD | ||
| @$(call do_cmd,cc,1) | ||
| ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ | ||
| $(findstring $(join ^,$(prefix)),\ | ||
| $(join ^,deps/libexpat/expat.target.mk)))),) | ||
| include deps/libexpat/expat.target.mk | ||
| endif | ||
| ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ | ||
| $(findstring $(join ^,$(prefix)),\ | ||
| $(join ^,deps/libexpat/version.target.mk)))),) | ||
| include deps/libexpat/version.target.mk | ||
| endif | ||
| ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ | ||
| $(findstring $(join ^,$(prefix)),\ | ||
| $(join ^,node_expat.target.mk)))),) | ||
| include node_expat.target.mk | ||
| endif | ||
| quiet_cmd_regen_makefile = ACTION Regenerating $@ | ||
| cmd_regen_makefile = cd $(srcdir); /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/sonny/Projects/node-xmpp/node-expat/build/config.gypi -I/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/sonny/.node-gyp/5.5.0/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/sonny/.node-gyp/5.5.0" "-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=node.lib" "-Dmodule_root_dir=/home/sonny/Projects/node-xmpp/node-expat" binding.gyp | ||
| Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../.node-gyp/5.5.0/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/deps/libexpat/libexpat.gyp $(srcdir)/../../../../../usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi | ||
| $(call do_cmd,regen_makefile) | ||
| # "all" is a concatenation of the "all" targets from all the included | ||
| # sub-makefiles. This is just here to clarify. | ||
| all: | ||
| # Add in dependency-tracking rules. $(all_deps) is the list of every single | ||
| # target in our tree. Only consider the ones with .d (dependency) info: | ||
| d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) | ||
| ifneq ($(d_files),) | ||
| include $(d_files) | ||
| endif |
| # This file is generated by gyp; do not edit. | ||
| TOOLSET := target | ||
| TARGET := node_expat | ||
| DEFS_Debug := \ | ||
| '-DNODE_GYP_MODULE_NAME=node_expat' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DBUILDING_NODE_EXTENSION' \ | ||
| '-DDEBUG' \ | ||
| '-D_DEBUG' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Debug := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -g \ | ||
| -O0 | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Debug := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Debug := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Debug := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/node_modules/nan \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| DEFS_Release := \ | ||
| '-DNODE_GYP_MODULE_NAME=node_expat' \ | ||
| '-D_LARGEFILE_SOURCE' \ | ||
| '-D_FILE_OFFSET_BITS=64' \ | ||
| '-DBUILDING_NODE_EXTENSION' | ||
| # Flags passed to all source files. | ||
| CFLAGS_Release := \ | ||
| -fPIC \ | ||
| -pthread \ | ||
| -Wall \ | ||
| -Wextra \ | ||
| -Wno-unused-parameter \ | ||
| -m64 \ | ||
| -O3 \ | ||
| -ffunction-sections \ | ||
| -fdata-sections \ | ||
| -fno-omit-frame-pointer | ||
| # Flags passed to only C files. | ||
| CFLAGS_C_Release := | ||
| # Flags passed to only C++ files. | ||
| CFLAGS_CC_Release := \ | ||
| -fno-rtti \ | ||
| -fno-exceptions \ | ||
| -std=gnu++0x | ||
| INCS_Release := \ | ||
| -I/home/sonny/.node-gyp/5.5.0/include/node \ | ||
| -I/home/sonny/.node-gyp/5.5.0/src \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/uv/include \ | ||
| -I/home/sonny/.node-gyp/5.5.0/deps/v8/include \ | ||
| -I$(srcdir)/node_modules/nan \ | ||
| -I$(srcdir)/deps/libexpat \ | ||
| -I$(srcdir)/deps/libexpat/lib | ||
| OBJS := \ | ||
| $(obj).target/$(TARGET)/node-expat.o | ||
| # Add to the list of files we specially track dependencies for. | ||
| all_deps += $(OBJS) | ||
| # Make sure our dependencies are built before any of us. | ||
| $(OBJS): | $(builddir)/libexpat.a $(obj).target/deps/libexpat/libexpat.a | ||
| # CFLAGS et al overrides must be target-local. | ||
| # See "Target-specific Variable Values" in the GNU Make manual. | ||
| $(OBJS): TOOLSET := $(TOOLSET) | ||
| $(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) | ||
| $(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) | ||
| # Suffix rules, putting all outputs into $(obj). | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| # Try building from generated source, too. | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD | ||
| @$(call do_cmd,cxx,1) | ||
| # End of this set of suffix rules | ||
| ### Rules for final target. | ||
| LDFLAGS_Debug := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LDFLAGS_Release := \ | ||
| -pthread \ | ||
| -rdynamic \ | ||
| -m64 | ||
| LIBS := | ||
| $(obj).target/node_expat.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) | ||
| $(obj).target/node_expat.node: LIBS := $(LIBS) | ||
| $(obj).target/node_expat.node: TOOLSET := $(TOOLSET) | ||
| $(obj).target/node_expat.node: $(OBJS) $(obj).target/deps/libexpat/libexpat.a FORCE_DO_CMD | ||
| $(call do_cmd,solink_module) | ||
| all_deps += $(obj).target/node_expat.node | ||
| # Add target alias | ||
| .PHONY: node_expat | ||
| node_expat: $(builddir)/node_expat.node | ||
| # Copy this to the executable output path. | ||
| $(builddir)/node_expat.node: TOOLSET := $(TOOLSET) | ||
| $(builddir)/node_expat.node: $(obj).target/node_expat.node FORCE_DO_CMD | ||
| $(call do_cmd,copy) | ||
| all_deps += $(builddir)/node_expat.node | ||
| # Short alias for building this executable. | ||
| .PHONY: node_expat.node | ||
| node_expat.node: $(obj).target/node_expat.node $(builddir)/node_expat.node | ||
| # Add executable to "all" target. | ||
| .PHONY: all | ||
| all: $(builddir)/node_expat.node | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
117
185.37%1
-88.89%2579691
-42.98%9
12.5%150
-12.79%Updated