diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-03-18 09:32:06 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-03-18 09:32:06 -0700 |
commit | 314743a4a752716b8e977482ad6c757c70d019db (patch) | |
tree | 3bb2332e5232c1b37e9da0ccb02aec2e87de1a00 /core/fpdftext | |
parent | 3420909bbb47d6e47d6c561cbcce06d056fdf0a3 (diff) | |
download | pdfium-314743a4a752716b8e977482ad6c757c70d019db.tar.xz |
Reduce size of several PDFium constant tables.
Either by using the smallest possible data type, or
By accurately calcuating the bounds, or
Moving to array of pointers for varying length rows.
Notes:
The 929 is reassuring since PDF417 barcode uses GF(929).
FX_WCHAR is 4 bytes on unix (2 on windows).
Binary looks to be about 240k smaller on linux/64
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1807373002 .
Diffstat (limited to 'core/fpdftext')
-rw-r--r-- | core/fpdftext/unicodenormalization.cpp | 4 | ||||
-rw-r--r-- | core/fpdftext/unicodenormalizationdata.cpp | 10 | ||||
-rw-r--r-- | core/fpdftext/unicodenormalizationdata.h | 12 |
3 files changed, 13 insertions, 13 deletions
diff --git a/core/fpdftext/unicodenormalization.cpp b/core/fpdftext/unicodenormalization.cpp index b8e8eb98d3..dd563e5ee3 100644 --- a/core/fpdftext/unicodenormalization.cpp +++ b/core/fpdftext/unicodenormalization.cpp @@ -11,7 +11,7 @@ namespace { -const FX_WCHAR* const g_UnicodeData_Normalization_Maps[5] = { +const uint16_t* const g_UnicodeData_Normalization_Maps[5] = { nullptr, g_UnicodeData_Normalization_Map1, g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3, g_UnicodeData_Normalization_Map4}; @@ -33,7 +33,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) { wch = wFind & 0x0FFF; wFind >>= 12; } - const FX_WCHAR* pMap = g_UnicodeData_Normalization_Maps[wFind]; + const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind]; if (pMap == g_UnicodeData_Normalization_Map4) { pMap = g_UnicodeData_Normalization_Map4 + wch; wFind = (FX_WCHAR)(*pMap++); diff --git a/core/fpdftext/unicodenormalizationdata.cpp b/core/fpdftext/unicodenormalizationdata.cpp index e9f3fbf2e9..b22625cf9e 100644 --- a/core/fpdftext/unicodenormalizationdata.cpp +++ b/core/fpdftext/unicodenormalizationdata.cpp @@ -7,7 +7,7 @@ #include "core/fpdftext/unicodenormalizationdata.h" #include "core/include/fxcrt/fx_system.h" -const FX_WCHAR g_UnicodeData_Normalization[65536] = { +const uint16_t 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, @@ -7291,7 +7291,7 @@ const FX_WCHAR g_UnicodeData_Normalization[65536] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; -const FX_WCHAR g_UnicodeData_Normalization_Map1[5376] = { +const uint16_t 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, @@ -7891,7 +7891,7 @@ const FX_WCHAR g_UnicodeData_Normalization_Map1[5376] = { 0x00AC, 0x00AF, 0x00A6, 0x00A5, 0x20A9, 0x2502, 0x2190, 0x2191, 0x2192, 0x2193, 0x25A0, 0x25CB}; -const FX_WCHAR g_UnicodeData_Normalization_Map2[1724] = { +const uint16_t 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, @@ -8085,7 +8085,7 @@ const FX_WCHAR g_UnicodeData_Normalization_Map2[1724] = { 0x0644, 0x0622, 0x0644, 0x0623, 0x0644, 0x0623, 0x0644, 0x0625, 0x0644, 0x0625, 0x0644, 0x0627, 0x0644, 0x0627}; -const FX_WCHAR g_UnicodeData_Normalization_Map3[1164] = { +const uint16_t 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, @@ -8217,7 +8217,7 @@ const FX_WCHAR g_UnicodeData_Normalization_Map3[1164] = { 0x0646, 0x062C, 0x064A, 0x0635, 0x0644, 0x06D2, 0x0642, 0x0644, 0x06D2, 0x0635, 0x0644, 0x0649}; -const FX_WCHAR g_UnicodeData_Normalization_Map4[488] = { +const uint16_t 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/fpdftext/unicodenormalizationdata.h b/core/fpdftext/unicodenormalizationdata.h index d586aa3781..39ee552ec4 100644 --- a/core/fpdftext/unicodenormalizationdata.h +++ b/core/fpdftext/unicodenormalizationdata.h @@ -7,12 +7,12 @@ #ifndef CORE_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ #define CORE_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ -#include "core/include/fxcrt/fx_system.h" +#include <stdint.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[]; +extern const uint16_t g_UnicodeData_Normalization[]; +extern const uint16_t g_UnicodeData_Normalization_Map1[]; +extern const uint16_t g_UnicodeData_Normalization_Map2[]; +extern const uint16_t g_UnicodeData_Normalization_Map3[]; +extern const uint16_t g_UnicodeData_Normalization_Map4[]; #endif // CORE_FPDFTEXT_UNICODENORMALIZATIONDATA_H_ |