Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
6bcc3fd2
Commit
6bcc3fd2
authored
Jul 19, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings
parent
6a497e1d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
include/fmt/safe-duration-cast.h
include/fmt/safe-duration-cast.h
+1
-1
test/scan.h
test/scan.h
+1
-1
test/std-format-test.cc
test/std-format-test.cc
+5
-2
No files found.
include/fmt/safe-duration-cast.h
View file @
6bcc3fd2
...
@@ -271,7 +271,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
...
@@ -271,7 +271,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
ec
=
1
;
ec
=
1
;
return
{};
return
{};
}
}
count
*=
Factor
::
num
;
count
*=
static_cast
<
IntermediateRep
>
(
Factor
::
num
)
;
}
}
// this can't go wrong, right? den>0 is checked earlier.
// this can't go wrong, right? den>0 is checked earlier.
...
...
test/scan.h
View file @
6bcc3fd2
...
@@ -167,7 +167,7 @@ struct scan_handler : error_handler {
...
@@ -167,7 +167,7 @@ struct scan_handler : error_handler {
}
}
void
on_arg_id
()
{
on_arg_id
(
next_arg_id_
++
);
}
void
on_arg_id
()
{
on_arg_id
(
next_arg_id_
++
);
}
void
on_arg_id
(
unsigned
id
)
{
void
on_arg_id
(
int
id
)
{
if
(
id
>=
args_
.
size
)
on_error
(
"argument index out of range"
);
if
(
id
>=
args_
.
size
)
on_error
(
"argument index out of range"
);
arg_
=
args_
.
data
[
id
];
arg_
=
args_
.
data
[
id
];
}
}
...
...
test/std-format-test.cc
View file @
6bcc3fd2
...
@@ -107,7 +107,8 @@ template <> struct std::formatter<S> {
...
@@ -107,7 +107,8 @@ template <> struct std::formatter<S> {
// Parses a width argument id in the format { <digit> }.
// Parses a width argument id in the format { <digit> }.
constexpr
auto
parse
(
format_parse_context
&
ctx
)
{
constexpr
auto
parse
(
format_parse_context
&
ctx
)
{
auto
iter
=
ctx
.
begin
();
auto
iter
=
ctx
.
begin
();
auto
get_char
=
[
&
]()
{
return
iter
!=
ctx
.
end
()
?
*
iter
:
0
;
};
// auto get_char = [&]() { return iter != ctx.end() ? *iter : 0; };
auto
get_char
=
[
&
]()
{
return
iter
!=
ctx
.
end
()
?
*
iter
:
'\0'
;
};
if
(
get_char
()
!=
'{'
)
return
iter
;
if
(
get_char
()
!=
'{'
)
return
iter
;
++
iter
;
++
iter
;
char
c
=
get_char
();
char
c
=
get_char
();
...
@@ -124,7 +125,9 @@ template <> struct std::formatter<S> {
...
@@ -124,7 +125,9 @@ template <> struct std::formatter<S> {
[](
auto
value
)
->
int
{
[](
auto
value
)
->
int
{
if
constexpr
(
!
is_integral_v
<
decltype
(
value
)
>
)
if
constexpr
(
!
is_integral_v
<
decltype
(
value
)
>
)
throw
format_error
(
"width is not integral"
);
throw
format_error
(
"width is not integral"
);
else
if
(
value
<
0
||
value
>
numeric_limits
<
int
>::
max
())
// else if (value < 0 || value > numeric_limits<int>::max())
else
if
(
fmt
::
internal
::
is_negative
(
value
)
<
0
||
value
>
numeric_limits
<
int
>::
max
())
throw
format_error
(
"invalid width"
);
throw
format_error
(
"invalid width"
);
else
else
return
value
;
return
value
;
...
...
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