mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Fixed signed/unsigned mismatch with the new precision code
This commit is contained in:
@@ -143,15 +143,15 @@ namespace YAML
|
||||
int doublePrecision;
|
||||
};
|
||||
|
||||
inline _Precision FloatPrecision(unsigned n) {
|
||||
inline _Precision FloatPrecision(int n) {
|
||||
return _Precision(n, -1);
|
||||
}
|
||||
|
||||
inline _Precision DoublePrecision(unsigned n) {
|
||||
inline _Precision DoublePrecision(int n) {
|
||||
return _Precision(-1, n);
|
||||
}
|
||||
|
||||
inline _Precision Precision(unsigned n) {
|
||||
inline _Precision Precision(int n) {
|
||||
return _Precision(n, n);
|
||||
}
|
||||
}
|
||||
|
@@ -265,17 +265,17 @@ namespace YAML
|
||||
}
|
||||
}
|
||||
|
||||
bool EmitterState::SetFloatPrecision(unsigned value, FMT_SCOPE scope)
|
||||
bool EmitterState::SetFloatPrecision(int value, FMT_SCOPE scope)
|
||||
{
|
||||
if(value > std::numeric_limits<float>::digits10)
|
||||
if(value < 0 || value > std::numeric_limits<float>::digits10)
|
||||
return false;
|
||||
_Set(m_floatPrecision, value, scope);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EmitterState::SetDoublePrecision(unsigned value, FMT_SCOPE scope)
|
||||
bool EmitterState::SetDoublePrecision(int value, FMT_SCOPE scope)
|
||||
{
|
||||
if(value > std::numeric_limits<double>::digits10)
|
||||
if(value < 0 || value > std::numeric_limits<double>::digits10)
|
||||
return false;
|
||||
_Set(m_doublePrecision, value, scope);
|
||||
return true;
|
||||
|
@@ -146,9 +146,9 @@ namespace YAML
|
||||
bool SetMapKeyFormat(EMITTER_MANIP value, FMT_SCOPE scope);
|
||||
EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
|
||||
|
||||
bool SetFloatPrecision(unsigned value, FMT_SCOPE scope);
|
||||
bool SetFloatPrecision(int value, FMT_SCOPE scope);
|
||||
unsigned GetFloatPrecision() const { return m_floatPrecision.get(); }
|
||||
bool SetDoublePrecision(unsigned value, FMT_SCOPE scope);
|
||||
bool SetDoublePrecision(int value, FMT_SCOPE scope);
|
||||
unsigned GetDoublePrecision() const { return m_doublePrecision.get(); }
|
||||
|
||||
private:
|
||||
@@ -174,8 +174,8 @@ namespace YAML
|
||||
Setting<EMITTER_MANIP> m_seqFmt;
|
||||
Setting<EMITTER_MANIP> m_mapFmt;
|
||||
Setting<EMITTER_MANIP> m_mapKeyFmt;
|
||||
Setting<unsigned> m_floatPrecision;
|
||||
Setting<unsigned> m_doublePrecision;
|
||||
Setting<int> m_floatPrecision;
|
||||
Setting<int> m_doublePrecision;
|
||||
|
||||
SettingChanges m_modifiedSettings;
|
||||
SettingChanges m_globalModifiedSettings;
|
||||
|
Reference in New Issue
Block a user