Start of STAmount issuer fixes.

This commit is contained in:
JoelKatz
2012-09-24 14:30:24 -07:00
parent 8f88575b8e
commit 3c5ea7020f
2 changed files with 25 additions and 11 deletions

View File

@@ -359,19 +359,16 @@ STAmount* STAmount::construct(SerializerIterator& sit, const char *name)
if ((value < cMinValue) || (value > cMaxValue) || (offset < cMinOffset) || (offset > cMaxOffset))
throw std::runtime_error("invalid currency value");
sapResult = new STAmount(name, uCurrencyID, value, offset, isNegative);
sapResult = new STAmount(name, uCurrencyID, uIssuerID, value, offset, isNegative);
}
else
{
if (offset != 512)
throw std::runtime_error("invalid currency value");
sapResult = new STAmount(name, uCurrencyID);
sapResult = new STAmount(name, uCurrencyID, uIssuerID);
}
if (sapResult)
sapResult->setIssuer(uIssuerID);
return sapResult;
}
@@ -522,7 +519,22 @@ STAmount& STAmount::operator-=(const STAmount& a)
STAmount STAmount::operator-(void) const
{
if (mValue == 0) return *this;
return STAmount(name, mCurrency, mValue, mOffset, mIsNative, !mIsNegative);
return STAmount(name, mCurrency, mIssuer, mValue, mOffset, mIsNative, !mIsNegative);
}
STAmount& STAmount::operator=(const STAmount &a)
{
if (name == NULL)
name = a.name;
mCurrency = a.mCurrency;
mIssuer = a.mIssuer;
mValue = a.mValue;
mOffset = a.mOffset;
mIsNative = a.mIsNative;
mIsNegative = a.mIsNegative;
return *this;
}
STAmount& STAmount::operator=(uint64 v)