refactor HAS_FORMAT => HAVE_FORMAT
This commit is contained in:
parent
135fe27007
commit
550f7c3e06
3 changed files with 11 additions and 11 deletions
|
|
@ -57,10 +57,10 @@ macro(configure_libs)
|
||||||
std::format_to_n(buffer, 100, \"test {}\", 42);
|
std::format_to_n(buffer, 100, \"test {}\", 42);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
" HAS_FORMAT)
|
" HAVE_FORMAT)
|
||||||
|
|
||||||
if(HAS_FORMAT)
|
if(HAVE_FORMAT)
|
||||||
add_definitions(-DHAS_FORMAT)
|
add_definitions(-DHAVE_FORMAT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
#include <format>
|
#include <format>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ void makeTimeString(std::vector<char> &buffer)
|
||||||
localtime_r(&t, &tm);
|
localtime_r(&t, &tm);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(
|
std::format_to_n(
|
||||||
buffer.data(), buffer.size(), "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}", tm.tm_year + yearOffset,
|
buffer.data(), buffer.size(), "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}", tm.tm_year + yearOffset,
|
||||||
tm.tm_mon + monthOffset, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec
|
tm.tm_mon + monthOffset, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec
|
||||||
|
|
@ -117,7 +117,7 @@ std::vector<char> makeMessage(const char *filename, int lineNumber, const char *
|
||||||
bufferSize += filenameLength + lineNumberLength;
|
bufferSize += filenameLength + lineNumberLength;
|
||||||
|
|
||||||
std::vector<char> buffer(bufferSize);
|
std::vector<char> buffer(bufferSize);
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(
|
std::format_to_n(
|
||||||
buffer.data(), bufferSize, "[{}] {}: {}\n\t{}:{}", timeBuffer.data(), sectionName, message, filename, lineNumber
|
buffer.data(), bufferSize, "[{}] {}: {}\n\t{}:{}", timeBuffer.data(), sectionName, message, filename, lineNumber
|
||||||
);
|
);
|
||||||
|
|
@ -129,7 +129,7 @@ std::vector<char> makeMessage(const char *filename, int lineNumber, const char *
|
||||||
return buffer;
|
return buffer;
|
||||||
} else {
|
} else {
|
||||||
std::vector<char> buffer(bufferSize);
|
std::vector<char> buffer(bufferSize);
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(buffer.data(), bufferSize, "[{}] {}: {}", timeBuffer.data(), sectionName, message);
|
std::format_to_n(buffer.data(), bufferSize, "[{}] {}: {}", timeBuffer.data(), sectionName, message);
|
||||||
#else
|
#else
|
||||||
snprintf(buffer.data(), bufferSize, "[%s] %s: %s", timeBuffer.data(), sectionName, message);
|
snprintf(buffer.data(), bufferSize, "[%s] %s: %s", timeBuffer.data(), sectionName, message);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
#include <format>
|
#include <format>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -641,7 +641,7 @@ void XWindowsClipboard::motifFillCache()
|
||||||
// get the Motif item property from the root window
|
// get the Motif item property from the root window
|
||||||
static const int buffer_size = 18 + 20;
|
static const int buffer_size = 18 + 20;
|
||||||
char name[buffer_size];
|
char name[buffer_size];
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", header.m_item);
|
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", header.m_item);
|
||||||
#else
|
#else
|
||||||
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", header.m_item);
|
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", header.m_item);
|
||||||
|
|
@ -670,7 +670,7 @@ void XWindowsClipboard::motifFillCache()
|
||||||
MotifFormatMap motifFormats;
|
MotifFormatMap motifFormats;
|
||||||
for (int32_t i = 0; i < numFormats; ++i) {
|
for (int32_t i = 0; i < numFormats; ++i) {
|
||||||
// get Motif format property from the root window
|
// get Motif format property from the root window
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", formats[i]);
|
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", formats[i]);
|
||||||
#else
|
#else
|
||||||
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", formats[i]);
|
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", formats[i]);
|
||||||
|
|
@ -749,7 +749,7 @@ bool XWindowsClipboard::motifGetSelection(const MotifClipFormat *format, Atom *a
|
||||||
// part that i don't know.
|
// part that i don't know.
|
||||||
static const int buffer_size = 18 + 20;
|
static const int buffer_size = 18 + 20;
|
||||||
char name[buffer_size];
|
char name[buffer_size];
|
||||||
#if HAS_FORMAT
|
#if HAVE_FORMAT
|
||||||
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", format->m_data);
|
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", format->m_data);
|
||||||
#else
|
#else
|
||||||
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", format->m_data);
|
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", format->m_data);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue