mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +08:00
astyle
This commit is contained in:
parent
fec467da7b
commit
2d873785a5
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#else // unix
|
#else // unix
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#elif __FreeBSD__
|
#elif __FreeBSD__
|
||||||
#include <sys/thr.h> //Use thr_self() syscall under FreeBSD to get thread id
|
#include <sys/thr.h> //Use thr_self() syscall under FreeBSD to get thread id
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //unix
|
#endif //unix
|
||||||
|
|
||||||
@ -145,14 +145,14 @@ SPDLOG_CONSTEXPR static int eol_size = sizeof(SPDLOG_EOL) - 1;
|
|||||||
inline void prevent_child_fd(FILE *f)
|
inline void prevent_child_fd(FILE *f)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
auto file_handle = (HANDLE)_get_osfhandle(_fileno(f));
|
auto file_handle = (HANDLE)_get_osfhandle(_fileno(f));
|
||||||
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0))
|
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0))
|
||||||
throw spdlog_ex("SetHandleInformation failed", errno);
|
throw spdlog_ex("SetHandleInformation failed", errno);
|
||||||
#else
|
#else
|
||||||
auto fd = fileno(f);
|
auto fd = fileno(f);
|
||||||
if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||||
throw spdlog_ex("fcntl with FD_CLOEXEC failed", errno);
|
throw spdlog_ex("fcntl with FD_CLOEXEC failed", errno);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -164,16 +164,16 @@ inline int fopen_s(FILE** fp, const filename_t& filename, const filename_t& mode
|
|||||||
*fp = _wfsopen((filename.c_str()), mode.c_str(), _SH_DENYWR);
|
*fp = _wfsopen((filename.c_str()), mode.c_str(), _SH_DENYWR);
|
||||||
#else
|
#else
|
||||||
*fp = _fsopen((filename.c_str()), mode.c_str(), _SH_DENYWR);
|
*fp = _fsopen((filename.c_str()), mode.c_str(), _SH_DENYWR);
|
||||||
#endif
|
#endif
|
||||||
#else //unix
|
#else //unix
|
||||||
*fp = fopen((filename.c_str()), mode.c_str());
|
*fp = fopen((filename.c_str()), mode.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SPDLOG_PREVENT_CHILD_FD
|
#ifdef SPDLOG_PREVENT_CHILD_FD
|
||||||
if(*fp != nullptr)
|
if(*fp != nullptr)
|
||||||
prevent_child_fd(*fp);
|
prevent_child_fd(*fp);
|
||||||
#endif
|
#endif
|
||||||
return *fp == nullptr;
|
return *fp == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
|
|||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
// logger name
|
// logger name
|
||||||
case 'n':
|
case 'n':
|
||||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
|
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
|
||||||
break;
|
break;
|
||||||
|
@ -475,7 +475,7 @@ template <typename Impl, typename Char>
|
|||||||
class BasicPrintfArgFormatter;
|
class BasicPrintfArgFormatter;
|
||||||
|
|
||||||
template <typename CharType,
|
template <typename CharType,
|
||||||
typename ArgFormatter = fmt::ArgFormatter<CharType> >
|
typename ArgFormatter = fmt::ArgFormatter<CharType> >
|
||||||
class BasicFormatter;
|
class BasicFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2647,15 +2647,15 @@ inline uint64_t make_type(const T &arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <unsigned N, bool/*IsPacked*/ = (N < ArgList::MAX_PACKED_ARGS)>
|
template <unsigned N, bool/*IsPacked*/ = (N < ArgList::MAX_PACKED_ARGS)>
|
||||||
struct ArgArray;
|
struct ArgArray;
|
||||||
|
|
||||||
template <unsigned N>
|
template <unsigned N>
|
||||||
struct ArgArray<N, true/*IsPacked*/>
|
struct ArgArray<N, true/*IsPacked*/>
|
||||||
{
|
{
|
||||||
typedef Value Type[N > 0 ? N : 1];
|
typedef Value Type[N > 0 ? N : 1];
|
||||||
|
|
||||||
template <typename Formatter, typename T>
|
template <typename Formatter, typename T>
|
||||||
static Value make(const T &value)
|
static Value make(const T &value)
|
||||||
{
|
{
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
Value result = MakeValue<Formatter>(value);
|
Value result = MakeValue<Formatter>(value);
|
||||||
@ -2667,7 +2667,7 @@ struct ArgArray<N, true/*IsPacked*/>
|
|||||||
return MakeValue<Formatter>(value);
|
return MakeValue<Formatter>(value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <unsigned N>
|
template <unsigned N>
|
||||||
struct ArgArray<N, false/*IsPacked*/>
|
struct ArgArray<N, false/*IsPacked*/>
|
||||||
@ -3513,7 +3513,7 @@ void BasicWriter<Char>::write_double(T value, const FormatSpec &spec)
|
|||||||
// MSVC's printf doesn't support 'F'.
|
// MSVC's printf doesn't support 'F'.
|
||||||
type = 'f';
|
type = 'f';
|
||||||
#endif
|
#endif
|
||||||
// Fall through.
|
// Fall through.
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'A':
|
case 'A':
|
||||||
|
Loading…
Reference in New Issue
Block a user