mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Disable usage of wchar_t in tests.
This commit is contained in:
parent
5508607dfa
commit
787aa46693
@ -36,7 +36,11 @@
|
|||||||
#define SPDLOG_NOEXCEPT throw()
|
#define SPDLOG_NOEXCEPT throw()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#if !defined(SPDLOG_NO_WCHAR) && defined(WIN32)
|
||||||
|
#define SPDLOG_USE_WCHAR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(SPDLOG_USE_WCHAR)
|
||||||
typedef std::wstring tstring;
|
typedef std::wstring tstring;
|
||||||
typedef wchar_t tchar;
|
typedef wchar_t tchar;
|
||||||
#define S(s) L ## s
|
#define S(s) L ## s
|
||||||
|
@ -2638,7 +2638,7 @@ public:
|
|||||||
typedef BasicMemoryWriter<char> MemoryWriter;
|
typedef BasicMemoryWriter<char> MemoryWriter;
|
||||||
typedef BasicMemoryWriter<wchar_t> WMemoryWriter;
|
typedef BasicMemoryWriter<wchar_t> WMemoryWriter;
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32) && defined(SPDLOG_USE_WCHAR)
|
||||||
#define TMemoryWriter WMemoryWriter
|
#define TMemoryWriter WMemoryWriter
|
||||||
#else
|
#else
|
||||||
#define TMemoryWriter MemoryWriter
|
#define TMemoryWriter MemoryWriter
|
||||||
|
@ -149,8 +149,12 @@ constexpr inline unsigned short eol_size()
|
|||||||
//fopen_s on non windows for writing
|
//fopen_s on non windows for writing
|
||||||
inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode)
|
inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#if defined(WIN32)
|
||||||
|
#if defined(SPDLOG_USE_WCHAR)
|
||||||
*fp = _wfsopen((filename.c_str()), mode, _SH_DENYWR);
|
*fp = _wfsopen((filename.c_str()), mode, _SH_DENYWR);
|
||||||
|
#else
|
||||||
|
*fp = _fsopen((filename.c_str()), mode, _SH_DENYWR);
|
||||||
|
#endif
|
||||||
return *fp == nullptr;
|
return *fp == nullptr;
|
||||||
#else
|
#else
|
||||||
*fp = fopen((filename.c_str()), mode);
|
*fp = fopen((filename.c_str()), mode);
|
||||||
@ -160,7 +164,7 @@ inline int fopen_s(FILE** fp, const tstring& filename, const tchar* mode)
|
|||||||
|
|
||||||
inline int remove(const tchar* filename)
|
inline int remove(const tchar* filename)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#if defined(WIN32) && defined(SPDLOG_USE_WCHAR)
|
||||||
return _wremove(filename);
|
return _wremove(filename);
|
||||||
#else
|
#else
|
||||||
return std::remove(filename);
|
return std::remove(filename);
|
||||||
@ -169,10 +173,10 @@ inline int remove(const tchar* filename)
|
|||||||
|
|
||||||
inline int rename(const tchar* filename1, const tchar* filename2)
|
inline int rename(const tchar* filename1, const tchar* filename2)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#if defined(WIN32) && defined(SPDLOG_USE_WCHAR)
|
||||||
return _wrename(filename1, filename2);
|
return _wrename(filename1, filename2);
|
||||||
#else
|
#else
|
||||||
return std::remove(filename1);
|
return std::rename(filename1, filename2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,3 +72,9 @@
|
|||||||
// Note that upon creating a logger the registry is modified by spdlog..
|
// Note that upon creating a logger the registry is modified by spdlog..
|
||||||
// #define SPDLOG_NO_REGISTRY_MUTEX
|
// #define SPDLOG_NO_REGISTRY_MUTEX
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Uncomment to disable usage of wchar_t for file names on Windows.
|
||||||
|
// #define SPDLOG_NO_WCHAR
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
|
#define SPDLOG_NO_WCHAR
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "../include/spdlog/spdlog.h"
|
#include "../include/spdlog/spdlog.h"
|
||||||
#include "../include/spdlog/sinks/null_sink.h"
|
#include "../include/spdlog/sinks/null_sink.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user