Mark kFoo variables const, or rename them if they are not.

Change-Id: If83d39d8557a938b8c22a9bc647fbbb923f28e6e
Reviewed-on: https://pdfium-review.googlesource.com/c/46211
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 38deef7..3b47ec0 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -225,7 +225,8 @@
     return true;
 
   if (FontStyleIsAllCaps(m_Flags)) {
-    unsigned char kLowercases[][2] = {{'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}};
+    static const unsigned char kLowercases[][2] = {
+        {'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}};
     for (size_t range = 0; range < FX_ArraySize(kLowercases); ++range) {
       const auto& lower = kLowercases[range];
       for (int i = lower[0]; i <= lower[1]; ++i) {
diff --git a/core/fxcrt/cfx_bitstream_unittest.cpp b/core/fxcrt/cfx_bitstream_unittest.cpp
index e70455b..2ba3663 100644
--- a/core/fxcrt/cfx_bitstream_unittest.cpp
+++ b/core/fxcrt/cfx_bitstream_unittest.cpp
@@ -119,7 +119,8 @@
 }
 
 TEST(fxcrt, BitStreamSameAsReferenceGetBits32) {
-  unsigned char kData[] = {0xDE, 0x3F, 0xB1, 0x7C, 0x12, 0x9A, 0x04, 0x56};
+  static const unsigned char kData[] = {0xDE, 0x3F, 0xB1, 0x7C,
+                                        0x12, 0x9A, 0x04, 0x56};
   CFX_BitStream bitstream(kData);
   for (int nbits = 1; nbits <= 32; ++nbits) {
     for (size_t bitpos = 0; bitpos < sizeof(kData) * 8 - nbits; ++bitpos) {
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index ae6e444..1d1b21d 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -2607,15 +2607,15 @@
   // - string "StringKey": "StringValue"
   // - blob "BlobKey": "\x01\x02\x03\0BlobValue1\0\0\0BlobValue2\0"
   constexpr const size_t kBlobLen = 28;
-  char kBlobValue[kBlobLen];
-  memcpy(kBlobValue, "\x01\x02\x03\0BlobValue1\0\0\0BlobValue2\0", kBlobLen);
+  char block_value[kBlobLen];
+  memcpy(block_value, "\x01\x02\x03\0BlobValue1\0\0\0BlobValue2\0", kBlobLen);
   EXPECT_EQ(0, FPDFPageObjMark_CountParams(mark));
   EXPECT_TRUE(
       FPDFPageObjMark_SetIntParam(document(), text_object, mark, "IntKey", 42));
   EXPECT_TRUE(FPDFPageObjMark_SetStringParam(document(), text_object, mark,
                                              "StringKey", "StringValue"));
   EXPECT_TRUE(FPDFPageObjMark_SetBlobParam(document(), text_object, mark,
-                                           "BlobKey", kBlobValue, kBlobLen));
+                                           "BlobKey", block_value, kBlobLen));
   EXPECT_EQ(3, FPDFPageObjMark_CountParams(mark));
 
   // Check the two parameters can be retrieved.
@@ -2641,7 +2641,7 @@
   EXPECT_TRUE(FPDFPageObjMark_GetParamBlobValue(
       mark, "BlobKey", buffer, sizeof(buffer), &out_buffer_len));
   EXPECT_EQ(kBlobLen, out_buffer_len);
-  EXPECT_EQ(0, memcmp(kBlobValue, buffer, kBlobLen));
+  EXPECT_EQ(0, memcmp(block_value, buffer, kBlobLen));
 
 // Render and check the bitmap is the expected one.
 #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
diff --git a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
index fbff804..b759456 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer_unittest.cpp
@@ -16,7 +16,7 @@
 
 TEST(OnedCode128WriterTest, Encode128B) {
   char buf[100];
-  TestCase kTestCases[] = {
+  static const TestCase kTestCases[] = {
       {"", 104, {104}, 1},
       {"a", 169, {104, 65}, 2},
       {"1", 121, {104, 17}, 2},
@@ -49,7 +49,7 @@
 
 TEST(OnedCode128WriterTest, Encode128C) {
   char buf[100];
-  TestCase kTestCases[] = {
+  static const TestCase kTestCases[] = {
       {"", 105, {105}, 1},
       {"a", 202, {105, 97}, 2},
       {"1", 106, {105, 1}, 2},
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index d329e13..e7ef7ee 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -19,12 +19,20 @@
 
 class CFXJS_PerObjectData;
 
-static unsigned int g_embedderDataSlot = 1u;
-static v8::Isolate* g_isolate = nullptr;
-static size_t g_isolate_ref_count = 0;
-static CFX_V8ArrayBufferAllocator* g_arrayBufferAllocator = nullptr;
-static v8::Global<v8::ObjectTemplate>* g_DefaultGlobalObjectTemplate = nullptr;
-static wchar_t kPerObjectDataTag[] = L"CFXJS_PerObjectData";
+namespace {
+
+unsigned int g_embedderDataSlot = 1u;
+v8::Isolate* g_isolate = nullptr;
+size_t g_isolate_ref_count = 0;
+CFX_V8ArrayBufferAllocator* g_arrayBufferAllocator = nullptr;
+v8::Global<v8::ObjectTemplate>* g_DefaultGlobalObjectTemplate = nullptr;
+const wchar_t kPerObjectDataTag[] = L"CFXJS_PerObjectData";
+
+void* GetAlignedPointerForPerObjectDataTag() {
+  return const_cast<void*>(static_cast<const void*>(kPerObjectDataTag));
+}
+
+}  // namespace
 
 // Global weak map to save dynamic objects.
 class V8TemplateMapTraits final
@@ -93,7 +101,7 @@
                           v8::Local<v8::Object> pObj) {
     if (pObj->InternalFieldCount() == 2) {
       pObj->SetAlignedPointerInInternalField(
-          0, static_cast<void*>(kPerObjectDataTag));
+          0, GetAlignedPointerForPerObjectDataTag());
       pObj->SetAlignedPointerInInternalField(1, pData);
     }
   }
@@ -101,7 +109,7 @@
   static CFXJS_PerObjectData* GetFromObject(v8::Local<v8::Object> pObj) {
     if (pObj.IsEmpty() || pObj->InternalFieldCount() != 2 ||
         pObj->GetAlignedPointerFromInternalField(0) !=
-            static_cast<void*>(kPerObjectDataTag)) {
+            GetAlignedPointerForPerObjectDataTag()) {
       return nullptr;
     }
     return static_cast<CFXJS_PerObjectData*>(