From 929f76de69e1e14f5f52925da9f05c577acaea7b Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Fri, 28 Oct 2022 15:34:01 +0800
Subject: [PATCH] feature(timedate): Delete timedate_i.h file.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- 删除timedate_i.h文件，因为文件命名格式错误。

Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
 include/timedate-i.h                  | 32 +++++++++++++++--
 include/timedate_i.h                  | 51 ---------------------------
 plugins/timedate/timedate-format.h    |  3 +-
 plugins/timedate/timedate-manager.cpp |  8 ++---
 4 files changed, 34 insertions(+), 60 deletions(-)
 delete mode 100644 include/timedate_i.h

diff --git a/include/timedate-i.h b/include/timedate-i.h
index d80caf9..6091b6c 100644
--- a/include/timedate-i.h
+++ b/include/timedate-i.h
@@ -14,5 +14,33 @@
 
 #pragma once
 
-#define TIMEDATE_NEW_INTERFACE
-#include <kiran-system-daemon/timedate_i.h>
\ No newline at end of file
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define TIMEDATE_DBUS_NAME "com.kylinsec.Kiran.SystemDaemon.TimeDate"
+#define TIMEDATE_OBJECT_PATH "/com/kylinsec/Kiran/SystemDaemon/TimeDate"
+#define TIMEDATE_DBUS_INTERFACE_NAME "com.kylinsec.Kiran.SystemDaemon.TimeDate"
+
+    enum TimedateDateFormatType
+    {
+        // 时间日期的长格式
+        TIMEDATE_FORMAT_TYPE_LONG = 0,
+        // 时间日期的短格式
+        TIMEDATE_FORMAT_TYPE_SHORT,
+        TIMEDATE_FORMAT_TYPE_LAST,
+    };
+
+    enum TimedateHourFormat
+    {
+        // 12小时制
+        TIMEDATE_HOUSR_FORMAT_12_HOURS = 0,
+        // 24小时制
+        TIMEDATE_HOUSR_FORMAT_24_HOURS,
+        TIMEDATE_HOUSR_FORMAT_LAST
+    };
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/include/timedate_i.h b/include/timedate_i.h
deleted file mode 100644
index 4607553..0000000
--- a/include/timedate_i.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd. 
- * kiran-cc-daemon is licensed under Mulan PSL v2.
- * You can use this software according to the terms and conditions of the Mulan PSL v2. 
- * You may obtain a copy of Mulan PSL v2 at:
- *          http://license.coscl.org.cn/MulanPSL2 
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.  
- * See the Mulan PSL v2 for more details.  
- * 
- * Author:     tangjie02 <tangjie02@kylinos.com.cn>
- */
-
-
-#pragma once
-
-#ifndef TIMEDATE_NEW_INTERFACE
-#warning This file will be deprecated. please use timedate-i.h file
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define TIMEDATE_DBUS_NAME "com.kylinsec.Kiran.SystemDaemon.TimeDate"
-#define TIMEDATE_OBJECT_PATH "/com/kylinsec/Kiran/SystemDaemon/TimeDate"
-#define TIMEDATE_DBUS_INTERFACE_NAME "com.kylinsec.Kiran.SystemDaemon.TimeDate"
-
-    enum TimedateDateFormatType
-    {
-        // 时间日期的长格式
-        TIMEDATE_FORMAT_TYPE_LONG = 0,
-        // 时间日期的短格式
-        TIMEDATE_FORMAT_TYPE_SHORT,
-        TIMEDATE_FORMAT_TYPE_LAST,
-    };
-
-    enum TimedateHourFormat
-    {
-        // 12小时制
-        TIMEDATE_HOUSR_FORMAT_12_HOURS = 0,
-        // 24小时制
-        TIMEDATE_HOUSR_FORMAT_24_HOURS,
-        TIMEDATE_HOUSR_FORMAT_LAST
-    };
-
-#ifdef __cplusplus
-}
-#endif
\ No newline at end of file
diff --git a/plugins/timedate/timedate-format.h b/plugins/timedate/timedate-format.h
index 764b7d8..f938bba 100644
--- a/plugins/timedate/timedate-format.h
+++ b/plugins/timedate/timedate-format.h
@@ -16,8 +16,7 @@
 
 #include "lib/base/base.h"
 
-#define TIMEDATE_NEW_INTERFACE
-#include "timedate_i.h"
+#include "timedate-i.h"
 
 namespace Kiran
 {
diff --git a/plugins/timedate/timedate-manager.cpp b/plugins/timedate/timedate-manager.cpp
index 6978874..92a4147 100644
--- a/plugins/timedate/timedate-manager.cpp
+++ b/plugins/timedate/timedate-manager.cpp
@@ -33,8 +33,7 @@
 #include "plugins/timedate/timedate-def.h"
 #include "plugins/timedate/timedate-util.h"
 
-#define TIMEDATE_NEW_INTERFACE
-#include "timedate_i.h"
+#include "timedate-i.h"
 
 #ifdef HAVE_SELINUX
 #include <selinux/selinux.h>
@@ -899,9 +898,8 @@ bool TimedateManager::check_timezone_name(const std::string &name)
         name.length() > MAX_TIMEZONE_LENGTH)
         return false;
 
-    auto iter = std::find_if(name.begin(), name.end(), [](char c) -> bool {
-        return !g_ascii_isalnum(c) && !strchr("+-_/", c);
-    });
+    auto iter = std::find_if(name.begin(), name.end(), [](char c) -> bool
+                             { return !g_ascii_isalnum(c) && !strchr("+-_/", c); });
 
     if (iter != name.end())
     {
-- 
2.33.0

