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 . --- BUILD.gn | 2 ++ core/include/fpdfapi/fpdf_parser.h | 10 +++++++ core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 15 ++-------- core/src/fpdfapi/fpdf_font/font_int.h | 3 ++ core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 5 ---- core/src/fpdftext/unicodenormalization.cpp | 16 +++++----- core/src/fpdftext/unicodenormalizationdata.cpp | 16 ++++++---- core/src/fpdftext/unicodenormalizationdata.h | 18 +++++++++++ .../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 +----------- fpdfsdk/include/fsdk_define.h | 3 ++ fpdfsdk/src/fpdf_dataavail.cpp | 2 -- fpdfsdk/src/fpdftext.cpp | 3 -- fpdfsdk/src/fpdfview.cpp | 2 -- fpdfsdk/src/fsdk_mgr.cpp | 7 ----- fpdfsdk/src/javascript/global.cpp | 17 +++++------ pdfium.gyp | 2 ++ 33 files changed, 135 insertions(+), 72 deletions(-) create mode 100644 core/src/fpdftext/unicodenormalizationdata.h create mode 100644 core/src/fxge/fontdata/chromefontdata/chromefontdata.h diff --git a/BUILD.gn b/BUILD.gn index 4ba901eeee..4320ddf94d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -321,6 +321,7 @@ static_library("fpdftext") { "core/src/fpdftext/txtproc.h", "core/src/fpdftext/unicodenormalization.cpp", "core/src/fpdftext/unicodenormalizationdata.cpp", + "core/src/fpdftext/unicodenormalizationdata.h", ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ @@ -474,6 +475,7 @@ static_library("fxge") { "core/src/fxge/dib/fx_dib_engine.cpp", "core/src/fxge/dib/fx_dib_main.cpp", "core/src/fxge/dib/fx_dib_transform.cpp", + "core/src/fxge/fontdata/chromefontdata/chromefontdata.h", "core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c", "core/src/fxge/fontdata/chromefontdata/FoxitFixed.c", "core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c", diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h index a83cec194c..ab48a95255 100644 --- a/core/include/fpdfapi/fpdf_parser.h +++ b/core/include/fpdfapi/fpdf_parser.h @@ -801,6 +801,14 @@ void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +void FlateEncode(const uint8_t* src_buf, + FX_DWORD src_size, + int predictor, + int Colors, + int BitsPerComponent, + int Columns, + uint8_t*& dest_buf, + FX_DWORD& dest_size); FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, @@ -809,6 +817,8 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); +FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); + class CPDF_NumberTree { public: CPDF_NumberTree(CPDF_Dictionary* pRoot) { m_pRoot = pRoot; } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 668c70b243..4e6c72355d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -6,23 +6,12 @@ #include "../../../include/fxcrt/fx_ext.h" #include "../../../include/fpdfapi/fpdf_serial.h" +#include "../../../include/fpdfapi/fpdf_parser.h" #include "editint.h" #define PDF_OBJECTSTREAM_MAXLENGTH (256 * 1024) #define PDF_XREFSTREAM_MAXSIZE 10000 -extern void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_data, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -extern void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, - int predictor, - int Colors, - int BitsPerComponent, - int Columns, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -extern FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict); + int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, CFX_FileBufferArchive* pFile, FX_FILESIZE& offset) { diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 59acfcbd35..79c25219a0 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -19,6 +19,9 @@ class CPDF_Stream; typedef void* FXFT_Library; +short TT2PDF(int m, FXFT_Face face); +FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id); + class CPDF_CMapManager { public: CPDF_CMapManager(); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 4814e93e7b..acbb567834 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -12,11 +12,6 @@ #include "../fpdf_cmaps/cmap_int.h" #include "font_int.h" -extern short TT2PDF(int m, FXFT_Face face); -extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, - int platform_id, - int encoding_id); - CPDF_CMapManager::CPDF_CMapManager() { m_bPrompted = FALSE; FXSYS_memset(m_CID2UnicodeMaps, 0, sizeof m_CID2UnicodeMaps); 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_ 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}, diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index 2195d2d04a..987b00f6f0 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -72,4 +72,7 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, FX_BOOL bNeedToRestore, IFSDK_PAUSE_Adapter* pause); +void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code); +void CheckUnSupportAnnot(CPDF_Document* pDoc, CPDF_Annot* pPDFAnnot); + #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index cc0833bc98..dddf9afb08 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.cpp @@ -95,8 +95,6 @@ DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsDocAvail(&hints_wrap); } -extern void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code); - DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) { if (avail == NULL) diff --git a/fpdfsdk/src/fpdftext.cpp b/fpdfsdk/src/fpdftext.cpp index 4030b7172b..43edd525e8 100644 --- a/fpdfsdk/src/fpdftext.cpp +++ b/fpdfsdk/src/fpdftext.cpp @@ -12,9 +12,6 @@ #include #endif -// jabdelmalek: commented out to build on Linux. Not used. -// extern HANDLE g_hModule; - DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { if (!page) return NULL; diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index a1d5689c79..bed00d3172 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -182,8 +182,6 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, return pParser->GetDocument(); } -extern void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code); - class CMemFile final : public IFX_FileRead { public: CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 67dea80d0d..fa270cc289 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -916,16 +916,9 @@ FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { } FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { - // if(CPDFSDK_Annot* pAnnot = GetFocusAnnot()) - // { - // CFFL_IFormFiller* pIFormFiller = g_pFormFillApp->GetIFormFiller(); - // return pIFormFiller->OnKeyUp(pAnnot, nKeyCode, nFlag); - // } return FALSE; } -extern void CheckUnSupportAnnot(CPDF_Document* pDoc, CPDF_Annot* pPDFAnnot); - void CPDFSDK_PageView::LoadFXAnnots() { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index cbb04241ae..94148762e2 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -38,19 +38,18 @@ struct CHash { static const unsigned value = CHash::value, Ns...>::value; }; -extern const unsigned int JSCONST_nStringHash = +const unsigned int JSCONST_nStringHash = CHash<'s', 't', 'r', 'i', 'n', 'g'>::value; -extern const unsigned int JSCONST_nNumberHash = +const unsigned int JSCONST_nNumberHash = CHash<'n', 'u', 'm', 'b', 'e', 'r'>::value; -extern const unsigned int JSCONST_nBoolHash = +const unsigned int JSCONST_nBoolHash = CHash<'b', 'o', 'o', 'l', 'e', 'a', 'n'>::value; -extern const unsigned int JSCONST_nDateHash = CHash<'d', 'a', 't', 'e'>::value; -extern const unsigned int JSCONST_nObjectHash = +const unsigned int JSCONST_nDateHash = CHash<'d', 'a', 't', 'e'>::value; +const unsigned int JSCONST_nObjectHash = CHash<'o', 'b', 'j', 'e', 'c', 't'>::value; -extern const unsigned int JSCONST_nFXobjHash = - CHash<'f', 'x', 'o', 'b', 'j'>::value; -extern const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; -extern const unsigned int JSCONST_nUndefHash = +const unsigned int JSCONST_nFXobjHash = CHash<'f', 'x', 'o', 'b', 'j'>::value; +const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; +const unsigned int JSCONST_nUndefHash = CHash<'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd'>::value; #ifdef _DEBUG diff --git a/pdfium.gyp b/pdfium.gyp index 6f1e6d7e8c..c6bb5ee1b8 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -315,6 +315,7 @@ 'core/src/fpdftext/txtproc.h', 'core/src/fpdftext/unicodenormalization.cpp', 'core/src/fpdftext/unicodenormalizationdata.cpp', + 'core/src/fpdftext/unicodenormalizationdata.h', ], }, { @@ -469,6 +470,7 @@ 'core/src/fxge/dib/fx_dib_engine.cpp', 'core/src/fxge/dib/fx_dib_main.cpp', 'core/src/fxge/dib/fx_dib_transform.cpp', + 'core/src/fxge/fontdata/chromefontdata/chromefontdata.h', 'core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c', 'core/src/fxge/fontdata/chromefontdata/FoxitFixed.c', 'core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c', -- cgit v1.2.3