6 Commits

Author SHA1 Message Date
Lee Thomason
a2d675139b fix cygwin 2022-04-02 14:05:47 -07:00
Lee Thomason
a1ea80ba74 Merge pull request #894 from saran-t/master
Change argument names in tinyxml2.cpp to match those in tinyxml2.h.
2022-04-02 13:59:56 -07:00
Lee Thomason
435c0a1199 Merge pull request #893 from eli-schwartz/meson-test-cleanup
meson: simplify test setup
2022-04-02 13:53:09 -07:00
Saran Tunyasuvunakool
4cc4145d7f Change argument names in tinyxml2.cpp to match those in tinyxml2.h.
Affected functions are `XMLElement::QueryUnsigned64Text` and `XMLDocument::Parse`.
2021-12-21 16:06:24 +00:00
Saran Tunyasuvunakool
6cc405853b Convert endings of lines 106-107 in tinyxml2.cpp to CRLF. 2021-12-21 16:05:29 +00:00
Eli Schwartz
f6c991658b meson: simplify test setup
Resources are loaded from the current working directory. By setting the
current working directory to the source dir, rather than the out of tree
build dir, we can easily pick up the original resources without copying
them around during configuration.
2021-12-14 19:29:56 -05:00
2 changed files with 12 additions and 32 deletions

View File

@@ -62,26 +62,6 @@ if meson.version().version_compare('>= 0.54.0')
endif
if get_option('tests')
# Try to find a copy command. If this is windows we probably don't have cp,
# but if this is msys then we do, so make cp not required in that case, and
# try Xcopy if cp isn't found
prog_cp = find_program('cp', required : build_machine.system() != 'windows')
command = ['-r']
if not prog_cp.found()
prog_cp = find_program('Xcopy')
command = ['/E', '/I']
endif
# Copy the test resources into the build dir
run_command(
prog_cp,
[
command,
meson.current_source_dir() / 'resources',
meson.current_build_dir(),
],
)
test(
'xmltest',
executable(
@@ -89,7 +69,7 @@ if get_option('tests')
['xmltest.cpp'],
link_with : [lib_tinyxml2],
),
workdir : meson.current_build_dir(),
workdir : meson.current_source_dir(),
)
endif

View File

@@ -103,8 +103,8 @@ distribution.
#if defined(_WIN64)
#define TIXML_FSEEK _fseeki64
#define TIXML_FTELL _ftelli64
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) \
|| defined(__NetBSD__) || defined(__DragonFly__) || defined(__ANDROID__)
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) \
|| defined(__NetBSD__) || defined(__DragonFly__) || defined(__ANDROID__) || (__CYGWIN__)
#define TIXML_FSEEK fseeko
#define TIXML_FTELL ftello
#elif defined(__unix__) && defined(__x86_64__)
@@ -1777,11 +1777,11 @@ XMLError XMLElement::QueryInt64Text(int64_t* ival) const
}
XMLError XMLElement::QueryUnsigned64Text(uint64_t* ival) const
XMLError XMLElement::QueryUnsigned64Text(uint64_t* uval) const
{
if(FirstChild() && FirstChild()->ToText()) {
const char* t = FirstChild()->Value();
if(XMLUtil::ToUnsigned64(t, ival)) {
if(XMLUtil::ToUnsigned64(t, uval)) {
return XML_SUCCESS;
}
return XML_CAN_NOT_CONVERT_TEXT;
@@ -2413,21 +2413,21 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact )
}
XMLError XMLDocument::Parse( const char* p, size_t len )
XMLError XMLDocument::Parse( const char* xml, size_t nBytes )
{
Clear();
if ( len == 0 || !p || !*p ) {
if ( nBytes == 0 || !xml || !*xml ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
if ( len == static_cast<size_t>(-1) ) {
len = strlen( p );
if ( nBytes == static_cast<size_t>(-1) ) {
nBytes = strlen( xml );
}
TIXMLASSERT( _charBuffer == 0 );
_charBuffer = new char[ len+1 ];
memcpy( _charBuffer, p, len );
_charBuffer[len] = 0;
_charBuffer = new char[ nBytes+1 ];
memcpy( _charBuffer, xml, nBytes );
_charBuffer[nBytes] = 0;
Parse();
if ( Error() ) {