浏览代码

libarchive: Rename cm_get_date wrapper to cm_parse_date

libarchive 3.8.0 renamed `__archive_get_date` to `archive_parse_date`.
Brad King 3 周之前
父节点
当前提交
4e5c2aadb1

+ 2 - 2
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

+ 2 - 2
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;

+ 3 - 3
Source/cmCTest.cxx

@@ -38,7 +38,7 @@
 #  include <unistd.h> // 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;

+ 0 - 11
Source/cm_get_date.c

@@ -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"

+ 11 - 0
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"

+ 1 - 1
Source/cm_get_date.h → 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" */

+ 1 - 1
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