Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
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
spdlog
Commits
9ebb9ff3
Commit
9ebb9ff3
authored
Feb 25, 2018
by
Daniel Chabrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readability-implicit-bool-cast
parent
fb6df051
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
include/spdlog/details/file_helper.h
include/spdlog/details/file_helper.h
+3
-3
include/spdlog/details/os.h
include/spdlog/details/os.h
+3
-3
include/spdlog/sinks/file_sinks.h
include/spdlog/sinks/file_sinks.h
+2
-2
No files found.
include/spdlog/details/file_helper.h
View file @
9ebb9ff3
...
@@ -46,7 +46,6 @@ public:
...
@@ -46,7 +46,6 @@ public:
void
open
(
const
filename_t
&
fname
,
bool
truncate
=
false
)
void
open
(
const
filename_t
&
fname
,
bool
truncate
=
false
)
{
{
close
();
close
();
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
auto
*
mode
=
truncate
?
SPDLOG_FILENAME_T
(
"wb"
)
:
SPDLOG_FILENAME_T
(
"ab"
);
_filename
=
fname
;
_filename
=
fname
;
...
@@ -76,7 +75,7 @@ public:
...
@@ -76,7 +75,7 @@ public:
void
close
()
void
close
()
{
{
if
(
_fd
)
if
(
_fd
!=
nullptr
)
{
{
std
::
fclose
(
_fd
);
std
::
fclose
(
_fd
);
_fd
=
nullptr
;
_fd
=
nullptr
;
...
@@ -93,8 +92,9 @@ public:
...
@@ -93,8 +92,9 @@ public:
size_t
size
()
const
size_t
size
()
const
{
{
if
(
!
_fd
)
if
(
_fd
==
nullptr
)
{
throw
spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
_filename
));
throw
spdlog_ex
(
"Cannot use size() on closed file "
+
os
::
filename_to_str
(
_filename
));
}
return
os
::
filesize
(
_fd
);
return
os
::
filesize
(
_fd
);
}
}
...
...
include/spdlog/details/os.h
View file @
9ebb9ff3
...
@@ -170,7 +170,7 @@ inline void prevent_child_fd(FILE *f)
...
@@ -170,7 +170,7 @@ inline void prevent_child_fd(FILE *f)
//fopen_s on non windows for writing
//fopen_s on non windows for writing
inline
int
fopen_s
(
FILE
**
fp
,
const
filename_t
&
filename
,
const
filename_t
&
mode
)
inline
bool
fopen_s
(
FILE
**
fp
,
const
filename_t
&
filename
,
const
filename_t
&
mode
)
{
{
#ifdef _WIN32
#ifdef _WIN32
#ifdef SPDLOG_WCHAR_FILENAMES
#ifdef SPDLOG_WCHAR_FILENAMES
...
@@ -482,9 +482,9 @@ inline bool in_terminal(FILE* file)
...
@@ -482,9 +482,9 @@ inline bool in_terminal(FILE* file)
{
{
#ifdef _WIN32
#ifdef _WIN32
return
_isatty
(
_fileno
(
file
))
?
true
:
false
;
return
_isatty
(
_fileno
(
file
))
!=
0
;
#else
#else
return
isatty
(
fileno
(
file
))
?
true
:
false
;
return
isatty
(
fileno
(
file
))
!=
0
;
#endif
#endif
}
}
}
//os
}
//os
...
...
include/spdlog/sinks/file_sinks.h
View file @
9ebb9ff3
...
@@ -84,7 +84,7 @@ public:
...
@@ -84,7 +84,7 @@ public:
static
filename_t
calc_filename
(
const
filename_t
&
filename
,
std
::
size_t
index
)
static
filename_t
calc_filename
(
const
filename_t
&
filename
,
std
::
size_t
index
)
{
{
typename
std
::
conditional
<
std
::
is_same
<
filename_t
::
value_type
,
char
>::
value
,
fmt
::
MemoryWriter
,
fmt
::
WMemoryWriter
>::
type
w
;
typename
std
::
conditional
<
std
::
is_same
<
filename_t
::
value_type
,
char
>::
value
,
fmt
::
MemoryWriter
,
fmt
::
WMemoryWriter
>::
type
w
;
if
(
index
)
if
(
index
!=
0u
)
{
{
filename_t
basename
,
ext
;
filename_t
basename
,
ext
;
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extenstion
(
filename
);
std
::
tie
(
basename
,
ext
)
=
details
::
file_helper
::
split_by_extenstion
(
filename
);
...
@@ -136,7 +136,7 @@ private:
...
@@ -136,7 +136,7 @@ private:
throw
spdlog_ex
(
"rotating_file_sink: failed removing "
+
filename_to_str
(
target
),
errno
);
throw
spdlog_ex
(
"rotating_file_sink: failed removing "
+
filename_to_str
(
target
),
errno
);
}
}
}
}
if
(
details
::
file_helper
::
file_exists
(
src
)
&&
details
::
os
::
rename
(
src
,
target
))
if
(
details
::
file_helper
::
file_exists
(
src
)
&&
details
::
os
::
rename
(
src
,
target
)
!=
0
)
{
{
throw
spdlog_ex
(
"rotating_file_sink: failed renaming "
+
filename_to_str
(
src
)
+
" to "
+
filename_to_str
(
target
),
errno
);
throw
spdlog_ex
(
"rotating_file_sink: failed renaming "
+
filename_to_str
(
src
)
+
" to "
+
filename_to_str
(
target
),
errno
);
}
}
...
...
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