From a9e8578eb12afc993af22fa680d8c00105b79bc1 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 8 May 2025 18:57:24 +0200 Subject: [PATCH] MT#59962 xmlrpc2di: rename TypeInt into TypeLong Because actually it's the long type, not the int one. Rename also func helpers. Change-Id: Ie1a6803a9d6edfa7f9fc531aa9c4496351783823 --- apps/xmlrpc2di/XMLRPC2DI.cpp | 2 +- apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp | 14 +++++++------- apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/xmlrpc2di/XMLRPC2DI.cpp b/apps/xmlrpc2di/XMLRPC2DI.cpp index 851de3ba..152b2c90 100644 --- a/apps/xmlrpc2di/XMLRPC2DI.cpp +++ b/apps/xmlrpc2di/XMLRPC2DI.cpp @@ -642,7 +642,7 @@ void XMLRPC2DIServer::xmlrpcval2amargarray(XmlRpcValue& v, AmArg& a, void XMLRPC2DIServer::xmlrpcval2amarg(XmlRpcValue& v, AmArg& a) { if (v.valid()) { switch (v.getType()) { - case XmlRpcValue::TypeInt: { /* DBG("X->A INT\n"); */ a = static_cast(v); } break; + case XmlRpcValue::TypeLong: { /* DBG("X->A INT\n"); */ a = static_cast(v); } break; case XmlRpcValue::TypeDouble:{ /* DBG("X->A DBL\n"); */ a = static_cast(v); } break; case XmlRpcValue::TypeString:{ /* DBG("X->A STR\n"); */ a = (static_cast(v)).c_str(); } break; case XmlRpcValue::TypeBoolean : { /* DBG("X->A BOL\n"); */ a = static_cast(v); } diff --git a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp index 5b9f62f2..fbec7ee8 100644 --- a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp +++ b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.cpp @@ -69,7 +69,7 @@ namespace XmlRpc { case TypeBase64: _value = BinaryData(); break; case TypeArray: _value = ValueArray(); break; case TypeStruct: _value = ValueStruct(); break; - case TypeInt: _value = 0; break; + case TypeLong: _value = 0; break; case TypeDouble: _value = 0.0; break; case TypeBoolean: _value = false; break; case TypeInvalid: _value = std::monostate(); break; @@ -146,7 +146,7 @@ namespace XmlRpc { if (typeTag == BOOLEAN_TAG) result = boolFromXml(valueXml, offset); else if (typeTag == I4_TAG || typeTag == INT_TAG) - result = intFromXml(valueXml, offset); + result = longFromXml(valueXml, offset); else if (typeTag == DOUBLE_TAG) result = doubleFromXml(valueXml, offset); else if (typeTag.empty() || typeTag == STRING_TAG) @@ -179,7 +179,7 @@ namespace XmlRpc { { switch (_type) { case TypeBoolean: return boolToXml(); - case TypeInt: return intToXml(); + case TypeLong: return longToXml(); case TypeDouble: return doubleToXml(); case TypeString: return stringToXml(); case TypeDateTime: return timeToXml(); @@ -218,7 +218,7 @@ namespace XmlRpc { } // Int - bool XmlRpcValue::intFromXml(std::string const& valueXml, size_t* offset) + bool XmlRpcValue::longFromXml(std::string const& valueXml, size_t* offset) { const char* valueStart = valueXml.c_str() + *offset; char* valueEnd; @@ -226,13 +226,13 @@ namespace XmlRpc { if (valueEnd == valueStart) return false; - _type = TypeInt; + _type = TypeLong; _value = ivalue; *offset += valueEnd - valueStart; return true; } - std::string XmlRpcValue::intToXml() const + std::string XmlRpcValue::longToXml() const { char buf[256]; snprintf(buf, sizeof(buf)-1, "%ld", std::get(_value)); @@ -473,7 +473,7 @@ namespace XmlRpc { switch (_type) { default: break; case TypeBoolean: os << std::get(_value); break; - case TypeInt: os << std::get(_value); break; + case TypeLong: os << std::get(_value); break; case TypeDouble: os << std::get(_value); break; case TypeString: os << std::get(_value); break; case TypeDateTime: diff --git a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h index 405be2ab..fcc71015 100644 --- a/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h +++ b/apps/xmlrpc2di/xmlrpc++/src/XmlRpcValue.h @@ -32,7 +32,7 @@ namespace XmlRpc { enum Type { TypeInvalid, TypeBoolean, - TypeInt, // really a long + TypeLong, TypeDouble, TypeString, TypeDateTime, @@ -55,7 +55,7 @@ namespace XmlRpc { XmlRpcValue(bool value) : _type(TypeBoolean) { _value = value; } //! Construct an XmlRpcValue with a long value - XmlRpcValue(long value) : _type(TypeInt) { _value = value; } + XmlRpcValue(long value) : _type(TypeLong) { _value = value; } //! Construct an XmlRpcValue with a double value XmlRpcValue(double value) : _type(TypeDouble) { _value = value; } @@ -125,8 +125,8 @@ namespace XmlRpc { //! Treat an XmlRpcValue as an int. //! Throws XmlRpcException if the value is initialized to - //! a type that is not TypeInt. - operator long&() { assertTypeOrInvalid(TypeInt); return std::get(_value); } + //! a type that is not TypeLong. + operator long&() { assertTypeOrInvalid(TypeLong); return std::get(_value); } //! Treat an XmlRpcValue as a double. //! Throws XmlRpcException if the value is initialized to @@ -219,7 +219,7 @@ namespace XmlRpc { // XML decoding bool boolFromXml(std::string const& valueXml, size_t* offset); - bool intFromXml(std::string const& valueXml, size_t* offset); + bool longFromXml(std::string const& valueXml, size_t* offset); bool doubleFromXml(std::string const& valueXml, size_t* offset); bool stringFromXml(std::string const& valueXml, size_t* offset); bool timeFromXml(std::string const& valueXml, size_t* offset); @@ -229,7 +229,7 @@ namespace XmlRpc { // XML encoding std::string boolToXml() const; - std::string intToXml() const; + std::string longToXml() const; std::string doubleToXml() const; std::string stringToXml() const; std::string timeToXml() const;