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
5390e29d
Commit
5390e29d
authored
Dec 24, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable mojibake
parent
9f6434dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
include/fmt/core.h
include/fmt/core.h
+10
-6
include/fmt/format-inl.h
include/fmt/format-inl.h
+3
-2
No files found.
include/fmt/core.h
View file @
5390e29d
...
...
@@ -1507,15 +1507,14 @@ inline std::basic_string<Char> format(const S& format_str, Args&&... args) {
{
internal
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...)});
}
FMT_API
void
vprint
(
string_view
format_str
,
format_args
args
);
FMT_API
void
vprint
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
);
FMT_API
void
vprint_mojibake
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
);
FMT_API
void
vprint
(
string_view
,
format_args
);
FMT_API
void
vprint
(
std
::
FILE
*
,
string_view
,
format_args
);
FMT_API
void
vprint_mojibake
(
std
::
FILE
*
,
string_view
,
format_args
);
/**
\rst
Prints formatted data to the file *f*. For wide format strings
,
*f* should be
in wide-oriented mode set via ``fwide(f, 1)``.
Prints formatted data to the file *f*. For wide format strings
*f* should be
in wide-oriented mode set via ``fwide(f, 1)``.
**Example**::
...
...
@@ -1525,8 +1524,13 @@ FMT_API void vprint_mojibake(std::FILE* f, string_view format_str,
template
<
typename
S
,
typename
...
Args
,
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
inline
void
print
(
std
::
FILE
*
f
,
const
S
&
format_str
,
Args
&&
...
args
)
{
#if !defined(_WIN32) || FMT_UNICODE
vprint
(
f
,
to_string_view
(
format_str
),
internal
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...));
#else
vprint_mojibake
(
f
,
to_string_view
(
format_str
),
internal
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...));
#endif
}
/**
...
...
include/fmt/format-inl.h
View file @
5390e29d
...
...
@@ -21,7 +21,7 @@
# include <locale>
#endif
#if
FMT_UNICODE
#if
def _WIN32
# include <io.h>
# include <windows.h>
#endif
...
...
@@ -1345,7 +1345,7 @@ FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
memory_buffer
buffer
;
internal
::
vformat_to
(
buffer
,
format_str
,
basic_format_args
<
buffer_context
<
char
>>
(
args
));
#if
defined(_WIN32) && FMT_UNICODE
#if
def _WIN32
auto
fd
=
_fileno
(
f
);
if
(
_isatty
(
fd
))
{
internal
::
utf8_to_utf16
u16
(
string_view
(
buffer
.
data
(),
buffer
.
size
()));
...
...
@@ -1361,6 +1361,7 @@ FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
}
#ifdef _WIN32
// Print assuming legacy (non-Unicode) encoding.
FMT_FUNC
void
vprint_mojibake
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
)
{
memory_buffer
buffer
;
...
...
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