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)
project(tinyxml2 VERSION 10.0.0)
include(CTest)
option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}")
##
## Honor tinyxml2_SHARED_LIBS to match install interface
##
if (DEFINED tinyxml2_SHARED_LIBS)
set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}")
endif ()
##
## Main library build
##
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
# Uncomment the following line to require C++11 (or greater) to use tinyxml2
# target_compile_features(tinyxml2 PUBLIC cxx_std_11)
target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_compile_definitions(
tinyxml2
PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>
INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
PUBLIC _FILE_OFFSET_BITS=64
)
set_target_properties(
tinyxml2
PROPERTIES
DEFINE_SYMBOL "TINYXML2_EXPORT"
VERSION "${tinyxml2_VERSION}"
SOVERSION "${tinyxml2_VERSION_MAJOR}"
)
if (tinyxml2_BUILD_TESTING)
add_executable(xmltest xmltest.cpp)
target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
add_test(
NAME xmltest
COMMAND xmltest
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
endif ()
##
## Installation
##
## Standard modules
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
## Custom locations
set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
CACHE PATH "Directory for pkgconfig files")
set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2"
CACHE STRING "Path to tinyxml2 CMake files")
## CMake targets and export scripts
install(
TARGETS tinyxml2 EXPORT tinyxml2-targets
RUNTIME COMPONENT tinyxml2_runtime
LIBRARY COMPONENT tinyxml2_runtime
NAMELINK_COMPONENT tinyxml2_development
ARCHIVE COMPONENT tinyxml2_development
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
# Type-specific targets
if (BUILD_SHARED_LIBS)
set(type shared)
else ()
set(type static)
endif ()
install(
EXPORT tinyxml2-targets
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
NAMESPACE tinyxml2::
FILE tinyxml2-${type}-targets.cmake
COMPONENT tinyxml2_development
)
# Auto-generated version compatibility file
write_basic_package_version_file(
tinyxml2-config-version.cmake
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
COMPONENT tinyxml2_development
)
## Headers
install(
FILES tinyxml2.h
TYPE INCLUDE
COMPONENT tinyxml2_development
)
## pkg-config
configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY)
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
)
cmake_minimum_required(VERSION 3.15)
project(tinyxml2 VERSION 10.0.0)
if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
MESSAGE(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
endif()
include(CTest)
option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}")
##
## Honor tinyxml2_SHARED_LIBS to match install interface
##
if (DEFINED tinyxml2_SHARED_LIBS)
set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}")
endif ()
##
## Main library build
##
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h)
add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
# Uncomment the following line to require C++11 (or greater) to use tinyxml2
# target_compile_features(tinyxml2 PUBLIC cxx_std_11)
target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_compile_definitions(
tinyxml2
PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>
INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
PUBLIC _FILE_OFFSET_BITS=64
)
set_target_properties(
tinyxml2
PROPERTIES
DEFINE_SYMBOL "TINYXML2_EXPORT"
VERSION "${tinyxml2_VERSION}"
SOVERSION "${tinyxml2_VERSION_MAJOR}"
)
if (tinyxml2_BUILD_TESTING)
add_executable(xmltest xmltest.cpp)
target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
add_test(
NAME xmltest
COMMAND xmltest
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
endif ()
##
## Installation
##
## Standard modules
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
## Custom locations
set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
CACHE PATH "Directory for pkgconfig files")
set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2"
CACHE STRING "Path to tinyxml2 CMake files")
## CMake targets and export scripts
install(
TARGETS tinyxml2 EXPORT tinyxml2-targets
RUNTIME COMPONENT tinyxml2_runtime
LIBRARY COMPONENT tinyxml2_runtime
NAMELINK_COMPONENT tinyxml2_development
ARCHIVE COMPONENT tinyxml2_development
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
# Type-specific targets
if (BUILD_SHARED_LIBS)
set(type shared)
else ()
set(type static)
endif ()
install(
EXPORT tinyxml2-targets
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
NAMESPACE tinyxml2::
FILE tinyxml2-${type}-targets.cmake
COMPONENT tinyxml2_development
)
# Auto-generated version compatibility file
write_basic_package_version_file(
tinyxml2-config-version.cmake
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
COMPONENT tinyxml2_development
)
## Headers
install(
FILES tinyxml2.h
TYPE INCLUDE
COMPONENT tinyxml2_development
)
## pkg-config
configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY)
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
// 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.
// 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__)
#define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello
#elif defined(__ANDROID__)
#if __ANDROID_API__ > 24
#define TIXML_FSEEK fseeko64
#define TIXML_FTELL ftello64
#else
#define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello
#endif
#elif defined(__ANDROID__) && __ANDROID_API__ > 24
#define TIXML_FSEEK fseeko64
#define TIXML_FTELL ftello64
#else
#define TIXML_FSEEK fseek
#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 )
{
// 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)
@@ -2509,7 +2504,7 @@ void XMLDocument::ClearError() {
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;
_errorLineNum = lineNum;
_errorStr.Reset();
@@ -2518,7 +2513,8 @@ void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ...
char* buffer = new char[BUFFER_SIZE];
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) {
size_t len = strlen(buffer);