From 71c15a5e6652952a94ba3a3ef7ac0392e3a06962 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 19 Aug 2015 10:28:50 -0700 Subject: Extern in .cpp files is a code smell. Part 1. Move to headers so compiler can type check against the definitions. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1299963002 . --- core/src/fpdftext/unicodenormalization.cpp | 16 ++++++++-------- core/src/fpdftext/unicodenormalizationdata.cpp | 16 +++++++++++----- core/src/fpdftext/unicodenormalizationdata.h | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 core/src/fpdftext/unicodenormalizationdata.h (limited to 'core/src/fpdftext') diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp index 446c6940eb..a7732967eb 100644 --- a/core/src/fpdftext/unicodenormalization.cpp +++ b/core/src/fpdftext/unicodenormalization.cpp @@ -5,15 +5,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_string.h" +#include "unicodenormalizationdata.h" + +const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { + nullptr, + g_UnicodeData_Normalization_Map1, + g_UnicodeData_Normalization_Map2, + g_UnicodeData_Normalization_Map3, + g_UnicodeData_Normalization_Map4}; -extern const FX_WCHAR g_UnicodeData_Normalization[]; -extern const FX_WCHAR g_UnicodeData_Normalization_Map1[]; -extern const FX_WCHAR g_UnicodeData_Normalization_Map2[]; -extern const FX_WCHAR g_UnicodeData_Normalization_Map3[]; -extern const FX_WCHAR g_UnicodeData_Normalization_Map4[]; -const FX_WCHAR* g_UnicodeData_Normalization_Maps[5] = { - NULL, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, - g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4}; FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { wch = wch & 0xFFFF; FX_WCHAR wFind = g_UnicodeData_Normalization[wch]; diff --git a/core/src/fpdftext/unicodenormalizationdata.cpp b/core/src/fpdftext/unicodenormalizationdata.cpp index 8185a6467b..777d0404e6 100644 --- a/core/src/fpdftext/unicodenormalizationdata.cpp +++ b/core/src/fpdftext/unicodenormalizationdata.cpp @@ -5,7 +5,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fxcrt/fx_system.h" -extern const FX_WCHAR g_UnicodeData_Normalization[65536] = { +#include "unicodenormalizationdata.h" + +const FX_WCHAR g_UnicodeData_Normalization[65536] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -7288,7 +7290,8 @@ extern const FX_WCHAR g_UnicodeData_Normalization[65536] = { 0x0000, 0x94F9, 0x94FA, 0x94FB, 0x94FC, 0x94FD, 0x94FE, 0x94FF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; -extern const FX_WCHAR g_UnicodeData_Normalization_Map1[5376] = { + +const FX_WCHAR g_UnicodeData_Normalization_Map1[5376] = { 0x0066, 0x0053, 0x0053, 0x0059, 0x0020, 0x0308, 0x0061, 0x0052, 0x0304, 0x0032, 0x0033, 0x0301, 0x03BC, 0x0327, 0x0031, 0x006F, 0x0041, 0x0041, 0x0041, 0x0041, 0x0041, 0x0041, 0x0043, 0x0045, 0x0045, 0x0045, 0x0045, @@ -7887,7 +7890,8 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map1[5376] = { 0x315D, 0x315E, 0x315F, 0x3160, 0x3161, 0x3162, 0x3163, 0x00A2, 0x00A3, 0x00AC, 0x00AF, 0x00A6, 0x00A5, 0x20A9, 0x2502, 0x2190, 0x2191, 0x2192, 0x2193, 0x25A0, 0x25CB}; -extern const FX_WCHAR g_UnicodeData_Normalization_Map2[1724] = { + +const FX_WCHAR g_UnicodeData_Normalization_Map2[1724] = { 0x004F, 0x0045, 0x0054, 0x004D, 0x006F, 0x0065, 0x0049, 0x004A, 0x0069, 0x006A, 0x004F, 0x0045, 0x006F, 0x0065, 0x0044, 0x017D, 0x0044, 0x017E, 0x0064, 0x017E, 0x004C, 0x004A, 0x004C, 0x006A, 0x006C, 0x006A, 0x004E, @@ -8080,7 +8084,8 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map2[1724] = { 0x064F, 0x0640, 0x0650, 0x0640, 0x0651, 0x0640, 0x0652, 0x0644, 0x0622, 0x0644, 0x0622, 0x0644, 0x0623, 0x0644, 0x0623, 0x0644, 0x0625, 0x0644, 0x0625, 0x0644, 0x0627, 0x0644, 0x0627}; -extern const FX_WCHAR g_UnicodeData_Normalization_Map3[1164] = { + +const FX_WCHAR g_UnicodeData_Normalization_Map3[1164] = { 0x0031, 0x002F, 0x0034, 0x0031, 0x002F, 0x0032, 0x0033, 0x002F, 0x0034, 0x002E, 0x002E, 0x002E, 0x2032, 0x2032, 0x2032, 0x2035, 0x2035, 0x2035, 0x0061, 0x002F, 0x0063, 0x0061, 0x002F, 0x0073, 0x0063, 0x002F, 0x006F, @@ -8211,7 +8216,8 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map3[1164] = { 0x0639, 0x062C, 0x0645, 0x0635, 0x0645, 0x0645, 0x0633, 0x062E, 0x064A, 0x0646, 0x062C, 0x064A, 0x0635, 0x0644, 0x06D2, 0x0642, 0x0644, 0x06D2, 0x0635, 0x0644, 0x0649}; -extern const FX_WCHAR g_UnicodeData_Normalization_Map4[488] = { + +const FX_WCHAR g_UnicodeData_Normalization_Map4[488] = { 0x0004, 0x2032, 0x2032, 0x2032, 0x2032, 0x0004, 0x0031, 0x002F, 0x0031, 0x0030, 0x0004, 0x0056, 0x0049, 0x0049, 0x0049, 0x0004, 0x0076, 0x0069, 0x0069, 0x0069, 0x0004, 0x0028, 0x0031, 0x0030, 0x0029, 0x0004, 0x0028, diff --git a/core/src/fpdftext/unicodenormalizationdata.h b/core/src/fpdftext/unicodenormalizationdata.h new file mode 100644 index 0000000000..1970f87ab3 --- /dev/null +++ b/core/src/fpdftext/unicodenormalizationdata.h @@ -0,0 +1,18 @@ +// Copyright 2015 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_SRC_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ +#define CORE_SRC_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ + +#include "../../include/fxcrt/fx_system.h" + +extern const FX_WCHAR g_UnicodeData_Normalization[]; +extern const FX_WCHAR g_UnicodeData_Normalization_Map1[]; +extern const FX_WCHAR g_UnicodeData_Normalization_Map2[]; +extern const FX_WCHAR g_UnicodeData_Normalization_Map3[]; +extern const FX_WCHAR g_UnicodeData_Normalization_Map4[]; + +#endif // CORE_SRC_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ -- cgit v1.2.3