From 4e5c2aadb18d4c879263e764d7ec627a933b7df2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 26 Sep 2025 16:39:05 -0400 Subject: [PATCH] libarchive: Rename cm_get_date wrapper to cm_parse_date libarchive 3.8.0 renamed `__archive_get_date` to `archive_parse_date`. --- Source/CMakeLists.txt | 4 ++-- Source/cmArchiveWrite.cxx | 4 ++-- Source/cmCTest.cxx | 6 +++--- Source/cm_get_date.c | 11 ----------- Source/cm_parse_date.c | 11 +++++++++++ Source/{cm_get_date.h => cm_parse_date.h} | 2 +- .../cmlibarchive/libarchive/archive_parse_date.c | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 Source/cm_get_date.c create mode 100644 Source/cm_parse_date.c rename Source/{cm_get_date.h => cm_parse_date.h} (88%) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 1e7c45cbcb..44f87dba80 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -797,8 +797,8 @@ add_library( cmFastbuildUtilityTargetGenerator.cxx cmFastbuildUtilityTargetGenerator.h - cm_get_date.h - cm_get_date.c + cm_parse_date.h + cm_parse_date.c cm_utf8.h cm_utf8.c cm_codecvt.hxx diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 321cddfdb4..3a8c8907c6 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -20,7 +20,7 @@ #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" -#include "cm_get_date.h" +#include "cm_parse_date.h" #include "cmLocale.h" #include "cmStringAlgorithms.h" @@ -345,7 +345,7 @@ bool cmArchiveWrite::AddFile(char const* file, size_t skip, char const* prefix) if (!this->MTime.empty()) { time_t now; time(&now); - time_t t = cm_get_date(now, this->MTime.c_str()); + time_t t = cm_parse_date(now, this->MTime.c_str()); if (t == -1) { this->Error = cmStrCat("unable to parse mtime '", this->MTime, '\''); return false; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 29ff3053ba..fa94409156 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -38,7 +38,7 @@ # include // IWYU pragma: keep #endif -#include "cm_get_date.h" +#include "cm_parse_date.h" #include "cmCMakePresetsGraph.h" #include "cmCTestBuildAndTest.h" @@ -214,7 +214,7 @@ struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag) char buf[1024]; std::snprintf(buf, sizeof(buf), "%d%02d%02d %s", lctime->tm_year + 1900, lctime->tm_mon + 1, lctime->tm_mday, str.c_str()); - time_t ntime = cm_get_date(tctime, buf); + time_t ntime = cm_parse_date(tctime, buf); cmCTestLog(this, DEBUG, " Get the nightly start time: " << ntime << std::endl); tctime = time(nullptr); @@ -2742,7 +2742,7 @@ void cmCTest::SetStopTime(std::string const& time_str) lctime->tm_mon + 1, lctime->tm_mday, time_str.c_str(), tzone_offset); - time_t stop_time = cm_get_date(current_time, buf); + time_t stop_time = cm_parse_date(current_time, buf); if (stop_time == -1) { this->Impl->StopTime = std::chrono::system_clock::time_point(); return; diff --git a/Source/cm_get_date.c b/Source/cm_get_date.c deleted file mode 100644 index 700b3e3e94..0000000000 --- a/Source/cm_get_date.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file LICENSE.rst or https://cmake.org/licensing for details. */ -#include "cm_get_date.h" - -// FIXME: This suppresses use of localtime_r because archive_getdate.c -// depends the rest of libarchive's checks for that. -#define CM_GET_DATE - -#define __archive_get_date cm_get_date - -#include "../Utilities/cmlibarchive/libarchive/archive_getdate.c" diff --git a/Source/cm_parse_date.c b/Source/cm_parse_date.c new file mode 100644 index 0000000000..daf6677e1a --- /dev/null +++ b/Source/cm_parse_date.c @@ -0,0 +1,11 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file LICENSE.rst or https://cmake.org/licensing for details. */ +#include "cm_parse_date.h" + +// FIXME: This suppresses use of localtime_r because archive_parse_date.c +// depends the rest of libarchive's checks for that. +#define CM_PARSE_DATE + +#define archive_parse_date cm_parse_date + +#include "../Utilities/cmlibarchive/libarchive/archive_parse_date.c" diff --git a/Source/cm_get_date.h b/Source/cm_parse_date.h similarity index 88% rename from Source/cm_get_date.h rename to Source/cm_parse_date.h index 9984ede6ca..43cfc98355 100644 --- a/Source/cm_get_date.h +++ b/Source/cm_parse_date.h @@ -9,7 +9,7 @@ extern "C" { #endif /** Parse a date/time string. Treat relative times with respect to 'now'. */ -time_t cm_get_date(time_t now, char const* str); +time_t cm_parse_date(time_t now, char const* str); #ifdef __cplusplus } /* extern "C" */ diff --git a/Utilities/cmlibarchive/libarchive/archive_parse_date.c b/Utilities/cmlibarchive/libarchive/archive_parse_date.c index 7c01033540..05540784b9 100644 --- a/Utilities/cmlibarchive/libarchive/archive_parse_date.c +++ b/Utilities/cmlibarchive/libarchive/archive_parse_date.c @@ -27,7 +27,7 @@ ** This code is in the public domain and has no copyright. */ -#ifndef CM_GET_DATE +#ifndef CM_PARSE_DATE #include "archive_platform.h" #endif