Skip to content

Commit

Permalink
Revert "Merge pull request #983 from DiplomInformatikerFranzHoepfinge…
Browse files Browse the repository at this point in the history
…r/feature/fix_32_bit_types"

This reverts commit 8e4bfeb, reversing
changes made to a0f66fd.
  • Loading branch information
leethomason committed Jul 6, 2024
1 parent 8e4bfeb commit c93b6f7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
50 changes: 25 additions & 25 deletions tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,15 +563,15 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
}


void XMLUtil::ToStr( int32_t v, char* buffer, int bufferSize )
void XMLUtil::ToStr( int v, char* buffer, int bufferSize )
{
TIXML_SNPRINTF( buffer, bufferSize, "%ld", v );
TIXML_SNPRINTF( buffer, bufferSize, "%d", v );
}


void XMLUtil::ToStr( uint32_t v, char* buffer, int bufferSize )
void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize )
{
TIXML_SNPRINTF( buffer, bufferSize, "%lu", v );
TIXML_SNPRINTF( buffer, bufferSize, "%u", v );
}


Expand Down Expand Up @@ -618,7 +618,7 @@ bool XMLUtil::ToInt(const char* str, int* value)
}
}
else {
if (TIXML_SSCANF(str, "%ld", value) == 1) {
if (TIXML_SSCANF(str, "%d", value) == 1) {
return true;
}
}
Expand All @@ -627,15 +627,15 @@ bool XMLUtil::ToInt(const char* str, int* value)

bool XMLUtil::ToUnsigned(const char* str, unsigned* value)
{
if (TIXML_SSCANF(str, IsPrefixHex(str) ? "%x" : "%lu", value) == 1) {
if (TIXML_SSCANF(str, IsPrefixHex(str) ? "%x" : "%u", value) == 1) {
return true;
}
return false;
}

bool XMLUtil::ToBool( const char* str, bool* value )
{
int32_t ival = 0;
int ival = 0;
if ( ToInt( str, &ival )) {
*value = (ival==0) ? false : true;
return true;
Expand Down Expand Up @@ -1481,7 +1481,7 @@ void XMLAttribute::SetName( const char* n )
}


XMLError XMLAttribute::QueryIntValue( int32_t* value ) const
XMLError XMLAttribute::QueryIntValue( int* value ) const
{
if ( XMLUtil::ToInt( Value(), value )) {
return XML_SUCCESS;
Expand All @@ -1490,7 +1490,7 @@ XMLError XMLAttribute::QueryIntValue( int32_t* value ) const
}


XMLError XMLAttribute::QueryUnsignedValue( uint32_t* value ) const
XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const
{
if ( XMLUtil::ToUnsigned( Value(), value )) {
return XML_SUCCESS;
Expand Down Expand Up @@ -1550,15 +1550,15 @@ void XMLAttribute::SetAttribute( const char* v )
}


void XMLAttribute::SetAttribute( int32_t v )
void XMLAttribute::SetAttribute( int v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
_value.SetStr( buf );
}


void XMLAttribute::SetAttribute( uint32_t v )
void XMLAttribute::SetAttribute( unsigned v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
Expand Down Expand Up @@ -1644,16 +1644,16 @@ const char* XMLElement::Attribute( const char* name, const char* value ) const
return 0;
}

int32_t XMLElement::IntAttribute(const char* name, int defaultValue) const
int XMLElement::IntAttribute(const char* name, int defaultValue) const
{
int32_t i = defaultValue;
int i = defaultValue;
QueryIntAttribute(name, &i);
return i;
}

uint32_t XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const
unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const
{
uint32_t i = defaultValue;
unsigned i = defaultValue;
QueryUnsignedAttribute(name, &i);
return i;
}
Expand Down Expand Up @@ -1723,15 +1723,15 @@ void XMLElement::SetText( const char* inText )
}


void XMLElement::SetText( int32_t v )
void XMLElement::SetText( int v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
SetText( buf );
}


void XMLElement::SetText( uint32_t v )
void XMLElement::SetText( unsigned v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
Expand Down Expand Up @@ -1777,7 +1777,7 @@ void XMLElement::SetText( double v )
}


XMLError XMLElement::QueryIntText( int32_t* ival ) const
XMLError XMLElement::QueryIntText( int* ival ) const
{
if ( FirstChild() && FirstChild()->ToText() ) {
const char* t = FirstChild()->Value();
Expand All @@ -1790,7 +1790,7 @@ XMLError XMLElement::QueryIntText( int32_t* ival ) const
}


XMLError XMLElement::QueryUnsignedText( uint32_t* uval ) const
XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const
{
if ( FirstChild() && FirstChild()->ToText() ) {
const char* t = FirstChild()->Value();
Expand Down Expand Up @@ -1869,14 +1869,14 @@ XMLError XMLElement::QueryFloatText( float* fval ) const

int XMLElement::IntText(int defaultValue) const
{
int32_t i = defaultValue;
int i = defaultValue;
QueryIntText(&i);
return i;
}

unsigned XMLElement::UnsignedText(unsigned defaultValue) const
{
uint32_t i = defaultValue;
unsigned i = defaultValue;
QueryUnsignedText(&i);
return i;
}
Expand Down Expand Up @@ -2777,15 +2777,15 @@ void XMLPrinter::PushAttribute( const char* name, const char* value )
}


void XMLPrinter::PushAttribute( const char* name, int32_t v )
void XMLPrinter::PushAttribute( const char* name, int v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
PushAttribute( name, buf );
}


void XMLPrinter::PushAttribute( const char* name, uint32_t v )
void XMLPrinter::PushAttribute( const char* name, unsigned v )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( v, buf, BUF_SIZE );
Expand Down Expand Up @@ -2895,15 +2895,15 @@ void XMLPrinter::PushText( uint64_t value )
}


void XMLPrinter::PushText( int32_t value )
void XMLPrinter::PushText( int value )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( value, buf, BUF_SIZE );
PushText( buf, false );
}


void XMLPrinter::PushText( uint32_t value )
void XMLPrinter::PushText( unsigned value )
{
char buf[BUF_SIZE];
XMLUtil::ToStr( value, buf, BUF_SIZE );
Expand Down
56 changes: 28 additions & 28 deletions tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,17 +614,17 @@ class TINYXML2_LIB XMLUtil
static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );

// converts primitive types to strings
static void ToStr( int32_t v, char* buffer, int bufferSize );
static void ToStr( uint32_t v, char* buffer, int bufferSize );
static void ToStr( int v, char* buffer, int bufferSize );
static void ToStr( unsigned v, char* buffer, int bufferSize );
static void ToStr( bool v, char* buffer, int bufferSize );
static void ToStr( float v, char* buffer, int bufferSize );
static void ToStr( double v, char* buffer, int bufferSize );
static void ToStr(int64_t v, char* buffer, int bufferSize);
static void ToStr(uint64_t v, char* buffer, int bufferSize);

// converts strings to primitive types
static bool ToInt( const char* str, int32_t* value );
static bool ToUnsigned( const char* str, uint32_t* value );
static bool ToInt( const char* str, int* value );
static bool ToUnsigned( const char* str, unsigned* value );
static bool ToBool( const char* str, bool* value );
static bool ToFloat( const char* str, float* value );
static bool ToDouble( const char* str, double* value );
Expand Down Expand Up @@ -1162,8 +1162,8 @@ class TINYXML2_LIB XMLAttribute
If the value isn't an integer, 0 will be returned. There is no error checking;
use QueryIntValue() if you need error checking.
*/
int32_t IntValue() const {
int32_t i = 0;
int IntValue() const {
int i = 0;
QueryIntValue(&i);
return i;
}
Expand All @@ -1181,8 +1181,8 @@ class TINYXML2_LIB XMLAttribute
}

/// Query as an unsigned integer. See IntValue()
uint32_t UnsignedValue() const {
uint32_t i=0;
unsigned UnsignedValue() const {
unsigned i=0;
QueryUnsignedValue( &i );
return i;
}
Expand All @@ -1209,9 +1209,9 @@ class TINYXML2_LIB XMLAttribute
in the provided parameter. The function will return XML_SUCCESS on success,
and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
*/
XMLError QueryIntValue( int32_t* value ) const;
XMLError QueryIntValue( int* value ) const;
/// See QueryIntValue
XMLError QueryUnsignedValue( uint32_t* value ) const;
XMLError QueryUnsignedValue( unsigned int* value ) const;
/// See QueryIntValue
XMLError QueryInt64Value(int64_t* value) const;
/// See QueryIntValue
Expand All @@ -1226,9 +1226,9 @@ class TINYXML2_LIB XMLAttribute
/// Set the attribute to a string value.
void SetAttribute( const char* value );
/// Set the attribute to value.
void SetAttribute(int32_t value );
void SetAttribute( int value );
/// Set the attribute to value.
void SetAttribute( uint32_t value );
void SetAttribute( unsigned value );
/// Set the attribute to value.
void SetAttribute(int64_t value);
/// Set the attribute to value.
Expand Down Expand Up @@ -1316,9 +1316,9 @@ class TINYXML2_LIB XMLElement : public XMLNode
or if there is an error. (For a method with error
checking, see QueryIntAttribute()).
*/
int32_t IntAttribute(const char* name, int defaultValue = 0) const;
int IntAttribute(const char* name, int defaultValue = 0) const;
/// See IntAttribute()
uint32_t UnsignedAttribute(const char* name, unsigned defaultValue = 0) const;
unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const;
/// See IntAttribute()
int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const;
/// See IntAttribute()
Expand All @@ -1343,7 +1343,7 @@ class TINYXML2_LIB XMLElement : public XMLNode
QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
@endverbatim
*/
XMLError QueryIntAttribute( const char* name, int32_t* value ) const {
XMLError QueryIntAttribute( const char* name, int* value ) const {
const XMLAttribute* a = FindAttribute( name );
if ( !a ) {
return XML_NO_ATTRIBUTE;
Expand All @@ -1352,7 +1352,7 @@ class TINYXML2_LIB XMLElement : public XMLNode
}

/// See QueryIntAttribute()
XMLError QueryUnsignedAttribute( const char* name, uint32_t* value ) const {
XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {
const XMLAttribute* a = FindAttribute( name );
if ( !a ) {
return XML_NO_ATTRIBUTE;
Expand Down Expand Up @@ -1432,11 +1432,11 @@ class TINYXML2_LIB XMLElement : public XMLNode
QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10
@endverbatim
*/
XMLError QueryAttribute( const char* name, int32_t* value ) const {
XMLError QueryAttribute( const char* name, int* value ) const {
return QueryIntAttribute( name, value );
}

XMLError QueryAttribute( const char* name, uint32_t* value ) const {
XMLError QueryAttribute( const char* name, unsigned int* value ) const {
return QueryUnsignedAttribute( name, value );
}

Expand Down Expand Up @@ -1470,12 +1470,12 @@ class TINYXML2_LIB XMLElement : public XMLNode
a->SetAttribute( value );
}
/// Sets the named attribute to value.
void SetAttribute( const char* name, int32_t value ) {
void SetAttribute( const char* name, int value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
}
/// Sets the named attribute to value.
void SetAttribute( const char* name, uint32_t value ) {
void SetAttribute( const char* name, unsigned value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
}
Expand Down Expand Up @@ -1586,9 +1586,9 @@ class TINYXML2_LIB XMLElement : public XMLNode
*/
void SetText( const char* inText );
/// Convenience method for setting text inside an element. See SetText() for important limitations.
void SetText( int32_t value );
void SetText( int value );
/// Convenience method for setting text inside an element. See SetText() for important limitations.
void SetText( uint32_t value );
void SetText( unsigned value );
/// Convenience method for setting text inside an element. See SetText() for important limitations.
void SetText(int64_t value);
/// Convenience method for setting text inside an element. See SetText() for important limitations.
Expand Down Expand Up @@ -1626,9 +1626,9 @@ class TINYXML2_LIB XMLElement : public XMLNode
to the requested type, and XML_NO_TEXT_NODE if there is no child text to query.
*/
XMLError QueryIntText( int32_t* ival ) const;
XMLError QueryIntText( int* ival ) const;
/// See QueryIntText()
XMLError QueryUnsignedText( uint32_t* uval ) const;
XMLError QueryUnsignedText( unsigned* uval ) const;
/// See QueryIntText()
XMLError QueryInt64Text(int64_t* uval) const;
/// See QueryIntText()
Expand Down Expand Up @@ -2258,8 +2258,8 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
void OpenElement( const char* name, bool compactMode=false );
/// If streaming, add an attribute to an open element.
void PushAttribute( const char* name, const char* value );
void PushAttribute( const char* name, int32_t value );
void PushAttribute( const char* name, uint32_t value );
void PushAttribute( const char* name, int value );
void PushAttribute( const char* name, unsigned value );
void PushAttribute( const char* name, int64_t value );
void PushAttribute( const char* name, uint64_t value );
void PushAttribute( const char* name, bool value );
Expand All @@ -2270,9 +2270,9 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
/// Add a text node.
void PushText( const char* text, bool cdata=false );
/// Add a text node from an integer.
void PushText( int32_t value );
void PushText( int value );
/// Add a text node from an unsigned.
void PushText( uint32_t value );
void PushText( unsigned value );
/// Add a text node from a signed 64bit integer.
void PushText( int64_t value );
/// Add a text node from an unsigned 64bit integer.
Expand Down

0 comments on commit c93b6f7

Please sign in to comment.