From 3b59d71a57150b7eef5141140cd8a4d3b8ebbd35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klemens=20Sch=C3=B6lhorn?=
 <klemens.schoelhorn@advantest.com>
Date: Wed, 21 Aug 2019 15:03:18 +0200
Subject: [PATCH 1/2] CachedDateFormat: Remove magic numbers from header

Instead define them as consts like all the other private constants.
Ideally, those should not be part of the header at all.
---
 src/main/cpp/cacheddateformat.cpp                  | 19 ++++++++++++--
 .../include/log4cxx/helpers/cacheddateformat.h     | 29 ++++++++++++----------
 2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/src/main/cpp/cacheddateformat.cpp b/src/main/cpp/cacheddateformat.cpp
index b6084eef..45b374ab 100644
--- a/src/main/cpp/cacheddateformat.cpp
+++ b/src/main/cpp/cacheddateformat.cpp
@@ -39,14 +39,29 @@ using namespace log4cxx::pattern;
 */
 const logchar CachedDateFormat::digits[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0 };
 
+
+/**
+ * First magic number (in microseconds) used to detect
+ * the millisecond position.
+ */
+const int CachedDateFormat::magic1 = 654000;
+
+
 /**
- *  Expected representation of first magic number.
+ *  Expected representation of first magic number in milliseconds.
  */
 const logchar CachedDateFormat::magicString1[] = { 0x36, 0x35, 0x34, 0 };
 
 
 /**
- *  Expected representation of second magic number.
+ * Second magic number (in microseconds) used to detect
+ * the millisecond position.
+ */
+const int CachedDateFormat::magic2 = 987000;
+
+
+/**
+ *  Expected representation of second magic number in milliseconds.
  */
 const logchar CachedDateFormat::magicString2[] = { 0x39, 0x38, 0x37, 0};
 
diff --git a/src/main/include/log4cxx/helpers/cacheddateformat.h b/src/main/include/log4cxx/helpers/cacheddateformat.h
index 5e94fdad..2f4cb7bf 100644
--- a/src/main/include/log4cxx/helpers/cacheddateformat.h
+++ b/src/main/include/log4cxx/helpers/cacheddateformat.h
@@ -50,26 +50,29 @@ class LOG4CXX_EXPORT CachedDateFormat : public log4cxx::helpers::DateFormat
 		 */
 		static const logchar digits[];
 
-		enum
-		{
-			/**
-			 *  First magic number used to detect the millisecond position.
-			 */
-			magic1 = 654000,
-			/**
-			 *  Second magic number used to detect the millisecond position.
-			 */
-			magic2 = 987000
-		};
 
 		/**
-		 *  Expected representation of first magic number.
+		 * First magic number (in microseconds) used to detect
+		 * the millisecond position.
+		 */
+		static const int magic1;
+
+
+		/**
+		 *  Expected representation of first magic number in milliseconds.
 		 */
 		static const logchar magicString1[];
 
 
 		/**
-		 *  Expected representation of second magic number.
+		 * Second magic number (in microseconds) used to detect
+		 * the millisecond position.
+		 */
+		static const int magic2;
+
+
+		/**
+		 *  Expected representation of second magic number in milliseconds.
 		 */
 		static const logchar magicString2[];
 
-- 
2.16.1.2.g9d582f143

