From 6ceb4a804e5ea07cf84c15e26df1f3390ea63378 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 18 Mar 2016 13:06:18 -0700 Subject: Replace additional FX_WCHAR tables with uint16_t. Saves a few bytes here and there because the tables need only 16 bits but wchar is 32 bits (except on windows). R=ochang@chromium.org Review URL: https://codereview.chromium.org/1815313003 . --- core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 24 ++++++++++++------------ core/fxcrt/fx_ucddata.cpp | 4 ++-- core/include/fxcrt/fx_ucd.h | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 46d6d1feeb..fde9c693e6 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -37,7 +37,7 @@ void CPDF_Document::CreateNewDoc() { m_pInfoDict = new CPDF_Dictionary; AddIndirectObject(m_pInfoDict); } -static const FX_WCHAR g_FX_CP874Unicodes[128] = { +static const uint16_t g_FX_CP874Unicodes[128] = { 0x20AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x2026, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x0000, 0x0000, @@ -54,7 +54,7 @@ static const FX_WCHAR g_FX_CP874Unicodes[128] = { 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000, }; -static const FX_WCHAR g_FX_CP1250Unicodes[128] = { +static const uint16_t g_FX_CP1250Unicodes[128] = { 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, @@ -71,7 +71,7 @@ static const FX_WCHAR g_FX_CP1250Unicodes[128] = { 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, }; -static const FX_WCHAR g_FX_CP1251Unicodes[128] = { +static const uint16_t g_FX_CP1251Unicodes[128] = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0459, @@ -88,7 +88,7 @@ static const FX_WCHAR g_FX_CP1251Unicodes[128] = { 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, }; -static const FX_WCHAR g_FX_CP1253Unicodes[128] = { +static const uint16_t g_FX_CP1253Unicodes[128] = { 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, @@ -105,7 +105,7 @@ static const FX_WCHAR g_FX_CP1253Unicodes[128] = { 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000, }; -static const FX_WCHAR g_FX_CP1254Unicodes[128] = { +static const uint16_t g_FX_CP1254Unicodes[128] = { 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, @@ -122,7 +122,7 @@ static const FX_WCHAR g_FX_CP1254Unicodes[128] = { 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF, }; -static const FX_WCHAR g_FX_CP1255Unicodes[128] = { +static const uint16_t g_FX_CP1255Unicodes[128] = { 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0000, @@ -139,7 +139,7 @@ static const FX_WCHAR g_FX_CP1255Unicodes[128] = { 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000, }; -static const FX_WCHAR g_FX_CP1256Unicodes[128] = { +static const uint16_t g_FX_CP1256Unicodes[128] = { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, @@ -156,7 +156,7 @@ static const FX_WCHAR g_FX_CP1256Unicodes[128] = { 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2, }; -static const FX_WCHAR g_FX_CP1257Unicodes[128] = { +static const uint16_t g_FX_CP1257Unicodes[128] = { 0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8, 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0000, @@ -175,7 +175,7 @@ static const FX_WCHAR g_FX_CP1257Unicodes[128] = { }; typedef struct { uint8_t m_Charset; - const FX_WCHAR* m_pUnicodes; + const uint16_t* m_pUnicodes; } FX_CharsetUnicodes; const FX_CharsetUnicodes g_FX_CharsetUnicodes[] = { {FXFONT_THAI_CHARSET, g_FX_CP874Unicodes}, @@ -314,7 +314,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding"); CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); - const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; + const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j++) { CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]); if (name.IsEmpty()) { @@ -654,7 +654,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding"); CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); - const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; + const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j++) { CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]); if (name.IsEmpty()) { @@ -889,7 +889,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { pEncodingDict->SetAtName("BaseEncoding", "WinAnsiEncoding"); CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); - const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; + const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j++) { CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]); if (name.IsEmpty()) { diff --git a/core/fxcrt/fx_ucddata.cpp b/core/fxcrt/fx_ucddata.cpp index c373d6e9d6..60ac01d5fe 100644 --- a/core/fxcrt/fx_ucddata.cpp +++ b/core/fxcrt/fx_ucddata.cpp @@ -10936,7 +10936,7 @@ const FX_DWORD kTextLayoutCodeProperties[] = { const size_t kTextLayoutCodePropertiesSize = FX_ArraySize(kTextLayoutCodeProperties); -const FX_WCHAR kFXTextLayoutVerticalMirror[] = { +const uint16_t kFXTextLayoutVerticalMirror[] = { 0xFE33, 0xFE32, 0xFE31, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE3F, 0xFE40, 0xFE3D, 0xFE3E, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE3B, 0xFE3C, 0xFE39, 0xFE3A, 0xFE34, 0xFE35, 0xFE36, 0xFE37, 0xFE38, @@ -10949,7 +10949,7 @@ const FX_WCHAR kFXTextLayoutVerticalMirror[] = { const size_t kFXTextLayoutVerticalMirrorSize = FX_ArraySize(kFXTextLayoutVerticalMirror); -const FX_WCHAR kFXTextLayoutBidiMirror[] = { +const uint16_t kFXTextLayoutBidiMirror[] = { 0x0029, 0x0028, 0x003E, 0x003C, 0x005D, 0x005B, 0x007D, 0x007B, 0x00BB, 0x00AB, 0x0F3B, 0x0F3A, 0x0F3D, 0x0F3C, 0x169C, 0x169B, 0x2019, 0x2018, 0x201D, 0x201C, 0x203A, 0x2039, 0x2046, 0x2045, 0x207E, 0x207D, 0x208E, diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index a670640306..969f116d60 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -38,10 +38,10 @@ enum FX_BIDICLASS { extern const FX_DWORD kTextLayoutCodeProperties[]; extern const size_t kTextLayoutCodePropertiesSize; -extern const FX_WCHAR kFXTextLayoutVerticalMirror[]; +extern const uint16_t kFXTextLayoutVerticalMirror[]; extern const size_t kFXTextLayoutVerticalMirrorSize; -extern const FX_WCHAR kFXTextLayoutBidiMirror[]; +extern const uint16_t kFXTextLayoutBidiMirror[]; extern const size_t kFXTextLayoutBidiMirrorSize; FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); -- cgit v1.2.3