refactor HAS_FORMAT => HAVE_FORMAT

This commit is contained in:
sithlord48
2025-10-30 21:53:38 -04:00
committed by Nick Bolton
parent 135fe27007
commit 550f7c3e06
3 changed files with 11 additions and 11 deletions

View File

@ -57,10 +57,10 @@ macro(configure_libs)
std::format_to_n(buffer, 100, \"test {}\", 42);
return 0;
}
" HAS_FORMAT)
" HAVE_FORMAT)
if(HAS_FORMAT)
add_definitions(-DHAS_FORMAT)
if(HAVE_FORMAT)
add_definitions(-DHAVE_FORMAT)
endif()
option(ENABLE_COVERAGE "Enable test coverage" OFF)

View File

@ -18,7 +18,7 @@
#include <cstring>
#include <ctime>
#if HAS_FORMAT
#if HAVE_FORMAT
#include <format>
#endif
@ -73,7 +73,7 @@ void makeTimeString(std::vector<char> &buffer)
localtime_r(&t, &tm);
#endif
#if HAS_FORMAT
#if HAVE_FORMAT
std::format_to_n(
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
@ -117,7 +117,7 @@ std::vector<char> makeMessage(const char *filename, int lineNumber, const char *
bufferSize += filenameLength + lineNumberLength;
std::vector<char> buffer(bufferSize);
#if HAS_FORMAT
#if HAVE_FORMAT
std::format_to_n(
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;
} else {
std::vector<char> buffer(bufferSize);
#if HAS_FORMAT
#if HAVE_FORMAT
std::format_to_n(buffer.data(), bufferSize, "[{}] {}: {}", timeBuffer.data(), sectionName, message);
#else
snprintf(buffer.data(), bufferSize, "[%s] %s: %s", timeBuffer.data(), sectionName, message);

View File

@ -22,7 +22,7 @@
#include <cstdio>
#include <cstring>
#if HAS_FORMAT
#if HAVE_FORMAT
#include <format>
#endif
@ -641,7 +641,7 @@ void XWindowsClipboard::motifFillCache()
// get the Motif item property from the root window
static const int buffer_size = 18 + 20;
char name[buffer_size];
#if HAS_FORMAT
#if HAVE_FORMAT
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", header.m_item);
#else
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", header.m_item);
@ -670,7 +670,7 @@ void XWindowsClipboard::motifFillCache()
MotifFormatMap motifFormats;
for (int32_t i = 0; i < numFormats; ++i) {
// 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]);
#else
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.
static const int buffer_size = 18 + 20;
char name[buffer_size];
#if HAS_FORMAT
#if HAVE_FORMAT
std::format_to_n(name, buffer_size, "_MOTIF_CLIP_ITEM_{}", format->m_data);
#else
snprintf(name, buffer_size, "_MOTIF_CLIP_ITEM_%d", format->m_data);