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
mr13.4
Donat Zenichev 1 year ago
parent 684786978b
commit a9e8578eb1

@ -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<long>(v); } break;
case XmlRpcValue::TypeLong: { /* DBG("X->A INT\n"); */ a = static_cast<long>(v); } break;
case XmlRpcValue::TypeDouble:{ /* DBG("X->A DBL\n"); */ a = static_cast<double>(v); } break;
case XmlRpcValue::TypeString:{ /* DBG("X->A STR\n"); */ a = (static_cast<string>(v)).c_str(); } break;
case XmlRpcValue::TypeBoolean : { /* DBG("X->A BOL\n"); */ a = static_cast<bool>(v); }

@ -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<long>(_value));
@ -473,7 +473,7 @@ namespace XmlRpc {
switch (_type) {
default: break;
case TypeBoolean: os << std::get<bool>(_value); break;
case TypeInt: os << std::get<long>(_value); break;
case TypeLong: os << std::get<long>(_value); break;
case TypeDouble: os << std::get<double>(_value); break;
case TypeString: os << std::get<std::string>(_value); break;
case TypeDateTime:

@ -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<long>(_value); }
//! a type that is not TypeLong.
operator long&() { assertTypeOrInvalid(TypeLong); return std::get<long>(_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;

Loading…
Cancel
Save