Skip to content

Commit

Permalink
Remove LFS64 calls and set _FILE_OFFSET_BITS=64
Browse files Browse the repository at this point in the history
Musl 1.2.4 made the LFS64 interfaces only available when
_LARGEFILE64_SOURCE is defined, and they will be removed altogether in
Musl 1.2.5. This commit replaces the LFS64 calls with their non-LFS64
versions and defines _FILE_OFFSET_BITS=64, which makes all interfaces
64-bit.

Bug: https://bugs.gentoo.org/905999
  • Loading branch information
vimproved committed Jun 8, 2023
1 parent e059560 commit 2077dd1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ target_compile_definitions(
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(
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARFLAGS = cr
RM = rm -f
RANLIB = ranlib
MKDIR = mkdir -p
CXXFLAGS = -fPIC
CXXFLAGS = -D_FILE_OFFSET_BITS=64 -fPIC

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ if get_option('debug')
tinyxml_extra_args += '-DTINYXML2_DEBUG'
endif

if host_machine.system() == 'linux'
tinyxml_extra_args += '-D_FILE_OFFSET_BITS=64'
endif

lib_tinyxml2 = library(
'tinyxml2',
['tinyxml2.cpp'],
Expand Down
3 changes: 0 additions & 3 deletions tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ distribution.
#define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello
#endif
#elif defined(__unix__) && defined(__x86_64__)
#define TIXML_FSEEK fseeko64
#define TIXML_FTELL ftello64
#else
#define TIXML_FSEEK fseek
#define TIXML_FTELL ftell
Expand Down

0 comments on commit 2077dd1

Please sign in to comment.