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
dff21374
Commit
dff21374
authored
Dec 16, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't define/undefine macros without FMT_ prefix
parent
2523f3b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
format.cc
format.cc
+7
-9
No files found.
format.cc
View file @
dff21374
...
...
@@ -42,12 +42,10 @@
#include <cstdarg>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# ifdef __MINGW32__
# include <cstring>
# endif
# include <windows.h>
# undef ERROR
#endif
using
fmt
::
LongLong
;
...
...
@@ -175,14 +173,14 @@ void format_error_code(fmt::Writer &out, int error_code,
// bad_alloc.
out
.
clear
();
static
const
char
SEP
[]
=
": "
;
static
const
char
ERR
OR
[]
=
"error "
;
static
const
char
ERR
[]
=
"error "
;
fmt
::
internal
::
IntTraits
<
int
>::
MainType
ec_value
=
error_code
;
// Subtract 2 to account for terminating null characters in SEP and ERR
OR
.
// Subtract 2 to account for terminating null characters in SEP and ERR.
std
::
size_t
error_code_size
=
sizeof
(
SEP
)
+
sizeof
(
ERR
OR
)
+
fmt
::
internal
::
count_digits
(
ec_value
)
-
2
;
sizeof
(
SEP
)
+
sizeof
(
ERR
)
+
fmt
::
internal
::
count_digits
(
ec_value
)
-
2
;
if
(
message
.
size
()
<=
fmt
::
internal
::
INLINE_BUFFER_SIZE
-
error_code_size
)
out
<<
message
<<
SEP
;
out
<<
ERR
OR
<<
error_code
;
out
<<
ERR
<<
error_code
;
assert
(
out
.
size
()
<=
fmt
::
internal
::
INLINE_BUFFER_SIZE
);
}
...
...
@@ -447,14 +445,14 @@ FMT_FUNC void fmt::internal::report_unknown_type(char code, const char *type) {
FMT_FUNC
fmt
::
internal
::
UTF8ToUTF16
::
UTF8ToUTF16
(
fmt
::
StringRef
s
)
{
int
length
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
s
.
c_str
(),
-
1
,
0
,
0
);
static
const
char
ERROR
[]
=
"cannot convert string from UTF-8 to UTF-16"
;
static
const
char
ERROR
_MSG
[]
=
"cannot convert string from UTF-8 to UTF-16"
;
if
(
length
==
0
)
FMT_THROW
(
WindowsError
(
GetLastError
(),
ERROR
));
FMT_THROW
(
WindowsError
(
GetLastError
(),
ERROR
_MSG
));
buffer_
.
resize
(
length
);
length
=
MultiByteToWideChar
(
CP_UTF8
,
MB_ERR_INVALID_CHARS
,
s
.
c_str
(),
-
1
,
&
buffer_
[
0
],
length
);
if
(
length
==
0
)
FMT_THROW
(
WindowsError
(
GetLastError
(),
ERROR
));
FMT_THROW
(
WindowsError
(
GetLastError
(),
ERROR
_MSG
));
}
FMT_FUNC
fmt
::
internal
::
UTF16ToUTF8
::
UTF16ToUTF8
(
fmt
::
WStringRef
s
)
{
...
...
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