Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
e4838f09
"megatron/inference/vscode:/vscode.git/clone" did not exist on "688448db7547be90203440cfd105703d8a853f39"
Commit
e4838f09
authored
Jan 11, 2012
by
beder
Browse files
Fixed signed/unsigned mismatch with the new precision code
parent
8123b27c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
include/yaml-cpp/emittermanip.h
include/yaml-cpp/emittermanip.h
+3
-3
src/emitterstate.cpp
src/emitterstate.cpp
+4
-4
src/emitterstate.h
src/emitterstate.h
+4
-4
No files found.
include/yaml-cpp/emittermanip.h
View file @
e4838f09
...
...
@@ -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
);
}
}
...
...
src/emitterstate.cpp
View file @
e4838f09
...
...
@@ -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
;
...
...
src/emitterstate.h
View file @
e4838f09
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment