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 . --- .../fxge/fontdata/chromefontdata/FoxitDingbats.c | 2 ++ core/src/fxge/fontdata/chromefontdata/FoxitFixed.c | 2 ++ .../fxge/fontdata/chromefontdata/FoxitFixedBold.c | 2 ++ .../fontdata/chromefontdata/FoxitFixedBoldItalic.c | 2 ++ .../fontdata/chromefontdata/FoxitFixedItalic.c | 2 ++ core/src/fxge/fontdata/chromefontdata/FoxitSans.c | 2 ++ .../fxge/fontdata/chromefontdata/FoxitSansBold.c | 2 ++ .../fontdata/chromefontdata/FoxitSansBoldItalic.c | 2 ++ .../fxge/fontdata/chromefontdata/FoxitSansItalic.c | 2 ++ .../src/fxge/fontdata/chromefontdata/FoxitSansMM.c | 2 ++ core/src/fxge/fontdata/chromefontdata/FoxitSerif.c | 2 ++ .../fxge/fontdata/chromefontdata/FoxitSerifBold.c | 2 ++ .../fontdata/chromefontdata/FoxitSerifBoldItalic.c | 2 ++ .../fontdata/chromefontdata/FoxitSerifItalic.c | 2 ++ .../fxge/fontdata/chromefontdata/FoxitSerifMM.c | 2 ++ .../src/fxge/fontdata/chromefontdata/FoxitSymbol.c | 2 ++ .../fxge/fontdata/chromefontdata/chromefontdata.h | 35 ++++++++++++++++++++++ core/src/fxge/ge/fx_ge_fontmap.cpp | 19 +----------- 18 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 core/src/fxge/fontdata/chromefontdata/chromefontdata.h (limited to 'core/src/fxge') diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c b/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c index b4c2ac132f..a653a097fa 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitDingbatsFontData [29513] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x11, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x44, 0x69, 0x6e, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c index 8bae0fa82b..af224b448f 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitFixedFontData [17597] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xe, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x46, 0x69, 0x78, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c index eb4fb8f5d6..e4de5f59fa 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitFixedBoldFontData [18055] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x13, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x46, 0x69, 0x78, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c index 45847f671c..8a90043b40 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitFixedBoldItalicFontData [19151] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x19, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x46, 0x69, 0x78, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c index d8409bab29..87d7da09f6 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitFixedItalicFontData [18746] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x15, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x46, 0x69, 0x78, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSans.c b/core/src/fxge/fontdata/chromefontdata/FoxitSans.c index cd87d2b5ba..48465fc6c5 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSans.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSans.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSansFontData [15025] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xd, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x61, 0x6e, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c index 594b37fe93..81507983a5 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSansBoldFontData [16344] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x12, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x61, 0x6e, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c index 0555165be3..91200e1026 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSansBoldItalicFontData [16418] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x17, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x61, 0x6e, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c index 9ac2edec66..ce6454e885 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSansItalicFontData [16339] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x14, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x61, 0x6e, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c index 05b0a16372..dd138281c7 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSansMMFontData [66919] = { 0x80, 0x01, 0xD2, 0x29, 0x00, 0x00, 0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x46, 0x6F, 0x6E, 0x74, 0x2D, 0x31, 0x2E, 0x30, 0x3A, 0x20, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c index ccb12ed346..6f0c242351 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSerifFontData [19469] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xe, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c index ba879bdfea..5f8a3739ad 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSerifBoldFontData [19395] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x13, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c index 63f86960eb..162bf496c2 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSerifBoldItalicFontData [20733] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x19, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c index 26f7784c60..ff353f7a8c 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSerifItalicFontData [21227] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x15, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x65, 0x72, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c index 44062cd210..49478b65d7 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSerifMMFontData [113417] = { 0x80, 0x01, 0xD6, 0x29, 0x00, 0x00, 0x25, 0x21, 0x50, 0x53, 0x2D, 0x41, 0x64, 0x6F, 0x62, 0x65, 0x46, 0x6F, 0x6E, 0x74, 0x2D, 0x31, 0x2E, 0x30, 0x3A, 0x20, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c b/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c index 18cde34c66..465a2361ed 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c @@ -4,6 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "chromefontdata.h" + const unsigned char g_FoxitSymbolFontData [16729] = {0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xf, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x53, 0x79, 0x6d, diff --git a/core/src/fxge/fontdata/chromefontdata/chromefontdata.h b/core/src/fxge/fontdata/chromefontdata/chromefontdata.h new file mode 100644 index 0000000000..9b640568e5 --- /dev/null +++ b/core/src/fxge/fontdata/chromefontdata/chromefontdata.h @@ -0,0 +1,35 @@ +// 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_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_ +#define CORE_SRC_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +extern const unsigned char g_FoxitFixedItalicFontData[18746]; +extern const unsigned char g_FoxitFixedFontData[17597]; +extern const unsigned char g_FoxitSansItalicFontData[16339]; +extern const unsigned char g_FoxitSansFontData[15025]; +extern const unsigned char g_FoxitSerifItalicFontData[21227]; +extern const unsigned char g_FoxitSerifFontData[19469]; +extern const unsigned char g_FoxitFixedBoldItalicFontData[19151]; +extern const unsigned char g_FoxitFixedBoldFontData[18055]; +extern const unsigned char g_FoxitSansBoldItalicFontData[16418]; +extern const unsigned char g_FoxitSansBoldFontData[16344]; +extern const unsigned char g_FoxitSerifBoldItalicFontData[20733]; +extern const unsigned char g_FoxitSerifBoldFontData[19395]; +extern const unsigned char g_FoxitSymbolFontData[16729]; +extern const unsigned char g_FoxitDingbatsFontData[29513]; +extern const unsigned char g_FoxitSerifMMFontData[113417]; +extern const unsigned char g_FoxitSansMMFontData[66919]; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // CORE_SRC_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_ diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index f4091e0136..15f7bc34d0 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -8,6 +8,7 @@ #include "../../../include/fxge/fx_ge.h" #include "../../../include/fxge/fx_freetype.h" +#include "../fontdata/chromefontdata/chromefontdata.h" #include "text_int.h" #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) @@ -392,24 +393,6 @@ void CFX_FontMgr::ReleaseFace(FXFT_Face face) { } } } -extern "C" { -extern const unsigned char g_FoxitFixedItalicFontData[18746]; -extern const unsigned char g_FoxitFixedFontData[17597]; -extern const unsigned char g_FoxitSansItalicFontData[16339]; -extern const unsigned char g_FoxitSansFontData[15025]; -extern const unsigned char g_FoxitSerifItalicFontData[21227]; -extern const unsigned char g_FoxitSerifFontData[19469]; -extern const unsigned char g_FoxitFixedBoldItalicFontData[19151]; -extern const unsigned char g_FoxitFixedBoldFontData[18055]; -extern const unsigned char g_FoxitSansBoldItalicFontData[16418]; -extern const unsigned char g_FoxitSansBoldFontData[16344]; -extern const unsigned char g_FoxitSerifBoldItalicFontData[20733]; -extern const unsigned char g_FoxitSerifBoldFontData[19395]; -extern const unsigned char g_FoxitSymbolFontData[16729]; -extern const unsigned char g_FoxitDingbatsFontData[29513]; -extern const unsigned char g_FoxitSerifMMFontData[113417]; -extern const unsigned char g_FoxitSansMMFontData[66919]; -}; const FoxitFonts g_FoxitFonts[14] = { {g_FoxitFixedFontData, 17597}, {g_FoxitFixedBoldFontData, 18055}, -- cgit v1.2.3