12 Commits

Author SHA1 Message Date
e834e174b6 Обновить CMakeLists.txt 2024-06-17 13:19:55 +04:00
5b695f2b64 Обновить CMakeLists.txt 2024-06-17 13:15:55 +04:00
Lee Thomason
a0f66fdf71 Merge pull request #984 from Blake-Madden/master
Fix typo in comment
2024-06-13 08:29:51 -07:00
Lee Thomason
a965e28c4f Merge pull request #978 from AlbertHungGarmin/fix-format-specifier
Fix format specifier mismatch in XMLUtil::ToStr
2024-06-13 08:17:16 -07:00
Blake-Madden
5b04868fee Fix typo in comment 2024-06-01 15:41:57 -04:00
Albert Hung
dded8bb2e9 Fix format specifier mismatch in XMLUtil::ToStr
In the XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize ) function, the format specifier %llu was used with a signed long long argument. This caused a type mismatch warning. The argument has been changed to unsigned long long to match the format specifier, resolving the warning.
2024-05-15 19:43:55 +08:00
Lee Thomason
312a809224 Merge pull request #976 from leethomason/AlbertHungGarmin-format_error
Albert hung garmin format error
2024-04-20 19:46:41 -07:00
Lee Thomason
c33aae04d9 kick the system 2024-04-20 19:44:22 -07:00
Lee Thomason
0f9c021a44 Merge pull request #973 from davidoakley/fix-android-before-api24
Use fseek/ftell on Android when api level < 24
2024-04-20 19:34:58 -07:00
David Oakley
dfc20c5f8f Android SDK<24 doesn’t support fseeko/ftello
Fall back to using fseek/ftell;
This was broken by d9fb8d3443
2024-04-08 12:58:12 +01:00
Albert Hung
1d658f0d95 Fix format error of TIXML_SNPRINTF
The format "%x" is treated as an unsigned int by the GCC compiler. Use static_cast to cast the error to an unsigned int to match the "%x" type. Additionally, replace int(error) with static_cast<int>(error) to avoid the old-style cast warning.
2024-03-19 14:22:17 +08:00
Lee Thomason
321ea883b7 Merge pull request #965 from leethomason/v10.0.0
V10.0.0
2023-12-30 18:08:30 -08:00
3 changed files with 142 additions and 142 deletions

View File

@@ -1,130 +1,134 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
project(tinyxml2 VERSION 10.0.0) project(tinyxml2 VERSION 10.0.0)
include(CTest) if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}") MESSAGE(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()
##
## Honor tinyxml2_SHARED_LIBS to match install interface include(CTest)
## option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}")
if (DEFINED tinyxml2_SHARED_LIBS) ##
set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}") ## Honor tinyxml2_SHARED_LIBS to match install interface
endif () ##
## if (DEFINED tinyxml2_SHARED_LIBS)
## Main library build set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}")
## endif ()
set(CMAKE_CXX_VISIBILITY_PRESET hidden) ##
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES) ## Main library build
##
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
add_library(tinyxml2::tinyxml2 ALIAS tinyxml2) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
# Uncomment the following line to require C++11 (or greater) to use tinyxml2
# target_compile_features(tinyxml2 PUBLIC cxx_std_11) add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>") add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
target_compile_definitions( # Uncomment the following line to require C++11 (or greater) to use tinyxml2
tinyxml2 # target_compile_features(tinyxml2 PUBLIC cxx_std_11)
PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG> target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS> target_compile_definitions(
PUBLIC _FILE_OFFSET_BITS=64 tinyxml2
) PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>
INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
set_target_properties( PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
tinyxml2 PUBLIC _FILE_OFFSET_BITS=64
PROPERTIES )
DEFINE_SYMBOL "TINYXML2_EXPORT"
VERSION "${tinyxml2_VERSION}" set_target_properties(
SOVERSION "${tinyxml2_VERSION_MAJOR}" tinyxml2
) PROPERTIES
DEFINE_SYMBOL "TINYXML2_EXPORT"
if (tinyxml2_BUILD_TESTING) VERSION "${tinyxml2_VERSION}"
add_executable(xmltest xmltest.cpp) SOVERSION "${tinyxml2_VERSION_MAJOR}"
target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2) )
add_test( if (tinyxml2_BUILD_TESTING)
NAME xmltest add_executable(xmltest xmltest.cpp)
COMMAND xmltest target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
) add_test(
NAME xmltest
set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0") COMMAND xmltest
endif () WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
##
## Installation set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
## endif ()
## Standard modules ##
include(GNUInstallDirs) ## Installation
include(CMakePackageConfigHelpers) ##
## Custom locations ## Standard modules
set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig" include(GNUInstallDirs)
CACHE PATH "Directory for pkgconfig files") include(CMakePackageConfigHelpers)
set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2" ## Custom locations
CACHE STRING "Path to tinyxml2 CMake files") set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
CACHE PATH "Directory for pkgconfig files")
## CMake targets and export scripts
set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2"
install( CACHE STRING "Path to tinyxml2 CMake files")
TARGETS tinyxml2 EXPORT tinyxml2-targets
RUNTIME COMPONENT tinyxml2_runtime ## CMake targets and export scripts
LIBRARY COMPONENT tinyxml2_runtime
NAMELINK_COMPONENT tinyxml2_development install(
ARCHIVE COMPONENT tinyxml2_development TARGETS tinyxml2 EXPORT tinyxml2-targets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" RUNTIME COMPONENT tinyxml2_runtime
) LIBRARY COMPONENT tinyxml2_runtime
NAMELINK_COMPONENT tinyxml2_development
# Type-specific targets ARCHIVE COMPONENT tinyxml2_development
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
if (BUILD_SHARED_LIBS) )
set(type shared)
else () # Type-specific targets
set(type static)
endif () if (BUILD_SHARED_LIBS)
set(type shared)
install( else ()
EXPORT tinyxml2-targets set(type static)
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}" endif ()
NAMESPACE tinyxml2::
FILE tinyxml2-${type}-targets.cmake install(
COMPONENT tinyxml2_development EXPORT tinyxml2-targets
) DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
NAMESPACE tinyxml2::
# Auto-generated version compatibility file FILE tinyxml2-${type}-targets.cmake
write_basic_package_version_file( COMPONENT tinyxml2_development
tinyxml2-config-version.cmake )
COMPATIBILITY SameMajorVersion
) # Auto-generated version compatibility file
write_basic_package_version_file(
install( tinyxml2-config-version.cmake
FILES COMPATIBILITY SameMajorVersion
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake" )
"${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}" install(
COMPONENT tinyxml2_development FILES
) "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
## Headers DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
COMPONENT tinyxml2_development
install( )
FILES tinyxml2.h
TYPE INCLUDE ## Headers
COMPONENT tinyxml2_development
) install(
FILES tinyxml2.h
## pkg-config TYPE INCLUDE
COMPONENT tinyxml2_development
configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY) )
file(GENERATE OUTPUT tinyxml2.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc.gen")
install( ## pkg-config
FILES "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc"
DESTINATION "${tinyxml2_INSTALL_PKGCONFIGDIR}" configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY)
COMPONENT tinyxml2_development file(GENERATE OUTPUT tinyxml2.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc.gen")
) install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc"
DESTINATION "${tinyxml2_INSTALL_PKGCONFIGDIR}"
COMPONENT tinyxml2_development
)

View File

@@ -7,7 +7,7 @@
// In HTML5, there are 16 so-called "void" elements. "void elements" NEVER have // In HTML5, there are 16 so-called "void" elements. "void elements" NEVER have
// inner content (but they MAY have attributes), and are assumed to be self-closing. // inner content (but they MAY have attributes), and are assumed to be self-closing.
// An example of a self-closig HTML5 element is "<br/>" (line break) // An example of a self-closing HTML5 element is "<br/>" (line break)
// All other elements are called "non-void" and MUST never self-close. // All other elements are called "non-void" and MUST never self-close.
// Examples: "<div class='lolcats'></div>". // Examples: "<div class='lolcats'></div>".

View File

@@ -106,14 +106,9 @@ distribution.
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__CYGWIN__)
#define TIXML_FSEEK fseeko #define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello #define TIXML_FTELL ftello
#elif defined(__ANDROID__) #elif defined(__ANDROID__) && __ANDROID_API__ > 24
#if __ANDROID_API__ > 24 #define TIXML_FSEEK fseeko64
#define TIXML_FSEEK fseeko64 #define TIXML_FTELL ftello64
#define TIXML_FTELL ftello64
#else
#define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello
#endif
#else #else
#define TIXML_FSEEK fseek #define TIXML_FSEEK fseek
#define TIXML_FTELL ftell #define TIXML_FTELL ftell
@@ -610,7 +605,7 @@ void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize )
void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize ) void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize )
{ {
// horrible syntax trick to make the compiler happy about %llu // horrible syntax trick to make the compiler happy about %llu
TIXML_SNPRINTF(buffer, bufferSize, "%llu", (long long)v); TIXML_SNPRINTF(buffer, bufferSize, "%llu", static_cast<unsigned long long>(v));
} }
bool XMLUtil::ToInt(const char* str, int* value) bool XMLUtil::ToInt(const char* str, int* value)
@@ -2509,7 +2504,7 @@ void XMLDocument::ClearError() {
void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... ) void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... )
{ {
TIXMLASSERT( error >= 0 && error < XML_ERROR_COUNT ); TIXMLASSERT(error >= 0 && error < XML_ERROR_COUNT);
_errorID = error; _errorID = error;
_errorLineNum = lineNum; _errorLineNum = lineNum;
_errorStr.Reset(); _errorStr.Reset();
@@ -2518,7 +2513,8 @@ void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ...
char* buffer = new char[BUFFER_SIZE]; char* buffer = new char[BUFFER_SIZE];
TIXMLASSERT(sizeof(error) <= sizeof(int)); TIXMLASSERT(sizeof(error) <= sizeof(int));
TIXML_SNPRINTF(buffer, BUFFER_SIZE, "Error=%s ErrorID=%d (0x%x) Line number=%d", ErrorIDToName(error), int(error), int(error), lineNum); TIXML_SNPRINTF(buffer, BUFFER_SIZE, "Error=%s ErrorID=%d (0x%x) Line number=%d",
ErrorIDToName(error), static_cast<int>(error), static_cast<unsigned int>(error), lineNum);
if (format) { if (format) {
size_t len = strlen(buffer); size_t len = strlen(buffer);