mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-29 10:00:30 +00:00
Merge branch 'tapanito/lending-fix-amendment' into ximinez/assetsmaximum-wip
This commit is contained in:
@@ -46,7 +46,7 @@ STObject::STObject(STObject&& other)
|
||||
{
|
||||
}
|
||||
|
||||
STObject::STObject(SField const& name) : STBase(name), mType(nullptr)
|
||||
STObject::STObject(SField const& name) : STBase(name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -62,8 +62,7 @@ STObject::STObject(SOTemplate const& type, SerialIter& sit, SField const& name)
|
||||
applyTemplate(type); // May throw
|
||||
}
|
||||
|
||||
STObject::STObject(SerialIter& sit, SField const& name, int depth) noexcept(false)
|
||||
: STBase(name), mType(nullptr)
|
||||
STObject::STObject(SerialIter& sit, SField const& name, int depth) noexcept(false) : STBase(name)
|
||||
{
|
||||
if (depth > 10)
|
||||
Throw<std::runtime_error>("Maximum nesting depth of STObject exceeded");
|
||||
@@ -141,9 +140,13 @@ STObject::set(SOTemplate const& type)
|
||||
for (auto const& elem : type)
|
||||
{
|
||||
if (elem.style() != soeREQUIRED)
|
||||
{
|
||||
v_.emplace_back(detail::nonPresentObject, elem.sField());
|
||||
}
|
||||
else
|
||||
{
|
||||
v_.emplace_back(detail::defaultObject, elem.sField());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +204,7 @@ void
|
||||
STObject::applyTemplateFromSField(SField const& sField)
|
||||
{
|
||||
SOTemplate const* elements = InnerObjectFormats::getInstance().findSOTemplateBySField(sField);
|
||||
if (elements)
|
||||
if (elements != nullptr)
|
||||
applyTemplate(*elements); // May throw
|
||||
}
|
||||
|
||||
@@ -216,8 +219,8 @@ STObject::set(SerialIter& sit, int depth)
|
||||
// Consume data in the pipe until we run out or reach the end
|
||||
while (!sit.empty())
|
||||
{
|
||||
int type;
|
||||
int field;
|
||||
int type = 0;
|
||||
int field = 0;
|
||||
|
||||
// Get the metadata for the next field
|
||||
sit.getFieldID(type, field);
|
||||
@@ -269,11 +272,11 @@ STObject::set(SerialIter& sit, int depth)
|
||||
}
|
||||
|
||||
bool
|
||||
STObject::hasMatchingEntry(STBase const& t)
|
||||
STObject::hasMatchingEntry(STBase const& t) const
|
||||
{
|
||||
STBase const* o = peekAtPField(t.getFName());
|
||||
|
||||
if (!o)
|
||||
if (o == nullptr)
|
||||
return false;
|
||||
|
||||
return t == *o;
|
||||
@@ -291,16 +294,22 @@ STObject::getFullText() const
|
||||
ret += " = {";
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = "{";
|
||||
}
|
||||
|
||||
for (auto const& elem : v_)
|
||||
{
|
||||
if (elem->getSType() != STI_NOTPRESENT)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
ret += ", ";
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
|
||||
ret += elem->getFullText();
|
||||
}
|
||||
@@ -334,7 +343,7 @@ STObject::isEquivalent(STBase const& t) const
|
||||
{
|
||||
STObject const* v = dynamic_cast<STObject const*>(&t);
|
||||
|
||||
if (!v)
|
||||
if (v == nullptr)
|
||||
return false;
|
||||
|
||||
if (mType != nullptr && v->mType == mType)
|
||||
@@ -471,7 +480,7 @@ STObject::setFlag(std::uint32_t f)
|
||||
{
|
||||
STUInt32* t = dynamic_cast<STUInt32*>(getPField(sfFlags, true));
|
||||
|
||||
if (!t)
|
||||
if (t == nullptr)
|
||||
return false;
|
||||
|
||||
t->setValue(t->value() | f);
|
||||
@@ -483,7 +492,7 @@ STObject::clearFlag(std::uint32_t f)
|
||||
{
|
||||
STUInt32* t = dynamic_cast<STUInt32*>(getPField(sfFlags));
|
||||
|
||||
if (!t)
|
||||
if (t == nullptr)
|
||||
return false;
|
||||
|
||||
t->setValue(t->value() & ~f);
|
||||
@@ -501,7 +510,7 @@ STObject::getFlags(void) const
|
||||
{
|
||||
STUInt32 const* t = dynamic_cast<STUInt32 const*>(peekAtPField(sfFlags));
|
||||
|
||||
if (!t)
|
||||
if (t == nullptr)
|
||||
return 0;
|
||||
|
||||
return t->value();
|
||||
@@ -565,7 +574,7 @@ STObject::delField(int index)
|
||||
SOEStyle
|
||||
STObject::getStyle(SField const& field) const
|
||||
{
|
||||
return mType ? mType->style(field) : soeINVALID;
|
||||
return (mType != nullptr) ? mType->style(field) : soeINVALID;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
@@ -868,10 +877,7 @@ STObject::operator==(STObject const& obj) const
|
||||
++fields;
|
||||
}
|
||||
|
||||
if (fields != matches)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return fields == matches;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -913,7 +919,8 @@ STObject::getSortedFields(STObject const& objToSort, WhichFields whichFields)
|
||||
for (detail::STVar const& elem : objToSort.v_)
|
||||
{
|
||||
STBase const& base = elem.get();
|
||||
if ((base.getSType() != STI_NOTPRESENT) && base.getFName().shouldInclude(whichFields))
|
||||
if ((base.getSType() != STI_NOTPRESENT) &&
|
||||
base.getFName().shouldInclude(static_cast<bool>(whichFields)))
|
||||
{
|
||||
sf.push_back(&base);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user