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
25f8ad13
Commit
25f8ad13
authored
Nov 11, 2016
by
alabuzhev
Committed by
Jonathan Müller
Nov 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correction of 418 (#420)
parent
1d2049b5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
26 deletions
+22
-26
fmt/format.cc
fmt/format.cc
+20
-0
fmt/printf.cc
fmt/printf.cc
+0
-24
test/add-subdirectory-test/main.cc
test/add-subdirectory-test/main.cc
+1
-1
test/find-package-test/main.cc
test/find-package-test/main.cc
+1
-1
No files found.
fmt/format.cc
View file @
25f8ad13
...
...
@@ -105,6 +105,8 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) {
# define FMT_SWPRINTF swprintf
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
typedef
void
(
*
FormatFunc
)(
Writer
&
,
int
,
StringRef
);
// Portable thread-safe version of strerror.
...
...
@@ -483,6 +485,24 @@ FMT_FUNC void report_windows_error(
}
#endif
FMT_FUNC
void
print
(
std
::
FILE
*
f
,
CStringRef
format_str
,
ArgList
args
)
{
MemoryWriter
w
;
w
.
write
(
format_str
,
args
);
std
::
fwrite
(
w
.
data
(),
1
,
w
.
size
(),
f
);
}
FMT_FUNC
void
print
(
CStringRef
format_str
,
ArgList
args
)
{
print
(
stdout
,
format_str
,
args
);
}
FMT_FUNC
void
print_colored
(
Color
c
,
CStringRef
format
,
ArgList
args
)
{
char
escape
[]
=
"
\x1b
[30m"
;
escape
[
3
]
=
static_cast
<
char
>
(
'0'
+
c
);
std
::
fputs
(
escape
,
stdout
);
print
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
}
#ifndef FMT_HEADER_ONLY
template
struct
internal
::
BasicData
<
void
>;
...
...
fmt/printf.cc
View file @
25f8ad13
...
...
@@ -12,30 +12,6 @@
namespace
fmt
{
namespace
{
const
char
RESET_COLOR
[]
=
"
\x1b
[0m"
;
}
// namespace
FMT_FUNC
void
print
(
std
::
FILE
*
f
,
CStringRef
format_str
,
ArgList
args
)
{
MemoryWriter
w
;
w
.
write
(
format_str
,
args
);
std
::
fwrite
(
w
.
data
(),
1
,
w
.
size
(),
f
);
}
FMT_FUNC
void
print
(
CStringRef
format_str
,
ArgList
args
)
{
print
(
stdout
,
format_str
,
args
);
}
FMT_FUNC
void
print_colored
(
Color
c
,
CStringRef
format
,
ArgList
args
)
{
char
escape
[]
=
"
\x1b
[30m"
;
escape
[
3
]
=
static_cast
<
char
>
(
'0'
+
c
);
std
::
fputs
(
escape
,
stdout
);
print
(
format
,
args
);
std
::
fputs
(
RESET_COLOR
,
stdout
);
}
template
<
typename
Char
>
void
printf
(
BasicWriter
<
Char
>
&
w
,
BasicCStringRef
<
Char
>
format
,
ArgList
args
);
...
...
test/add-subdirectory-test/main.cc
View file @
25f8ad13
#include "fmt/
printf
.h"
#include "fmt/
format
.h"
int
main
(
int
argc
,
char
**
argv
)
{
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
...
...
test/find-package-test/main.cc
View file @
25f8ad13
#include "fmt/
printf
.h"
#include "fmt/
format
.h"
int
main
(
int
argc
,
char
**
argv
)
{
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
...
...
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