diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-03-21 15:52:56 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-03-21 15:52:56 -0700 |
commit | d074e9787fe5f21d49269a504969cfcf4eec016b (patch) | |
tree | 8384a35e7cb251df4018c66c98716f41c97002fd /xfa | |
parent | 62a70f90c49cf7714c960186eb063ad55333e6f3 (diff) | |
download | pdfium-d074e9787fe5f21d49269a504969cfcf4eec016b.tar.xz |
Make predefined character table slightly smaller.
Add a few missing consts and remove a few extra externs.
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1817283002 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.cpp | 196 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fwltheme.cpp | 11 |
3 files changed, 108 insertions, 100 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 2062ca1e35..2ae7c0f1a6 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -15,8 +15,106 @@ #include "xfa/include/fwl/core/fwl_app.h" #include "xfa/include/fwl/lightwidget/barcode.h" -static XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( - const CFX_WideStringC& wsName); +namespace { + +const XFA_BARCODETYPEENUMINFO g_XFABarCodeTypeEnumData[] = { + {0x7fb4a18, L"ean13", XFA_BARCODETYPE_ean13, BC_EAN13}, + {0x8d13a3d, L"code11", XFA_BARCODETYPE_code11, BC_UNKNOWN}, + {0x8d149a8, L"code49", XFA_BARCODETYPE_code49, BC_UNKNOWN}, + {0x8d16347, L"code93", XFA_BARCODETYPE_code93, BC_UNKNOWN}, + {0x91a92e2, L"upsMaxicode", XFA_BARCODETYPE_upsMaxicode, BC_UNKNOWN}, + {0xa7d48dc, L"fim", XFA_BARCODETYPE_fim, BC_UNKNOWN}, + {0xb359fe9, L"msi", XFA_BARCODETYPE_msi, BC_UNKNOWN}, + {0x121f738c, L"code2Of5Matrix", XFA_BARCODETYPE_code2Of5Matrix, BC_UNKNOWN}, + {0x15358616, L"ucc128", XFA_BARCODETYPE_ucc128, BC_UNKNOWN}, + {0x1f4bfa05, L"rfid", XFA_BARCODETYPE_rfid, BC_UNKNOWN}, + {0x1fda71bc, L"rss14Stacked", XFA_BARCODETYPE_rss14Stacked, BC_UNKNOWN}, + {0x22065087, L"ean8add2", XFA_BARCODETYPE_ean8add2, BC_UNKNOWN}, + {0x2206508a, L"ean8add5", XFA_BARCODETYPE_ean8add5, BC_UNKNOWN}, + {0x2278366c, L"codabar", XFA_BARCODETYPE_codabar, BC_CODABAR}, + {0x2a039a8d, L"telepen", XFA_BARCODETYPE_telepen, BC_UNKNOWN}, + {0x323ed337, L"upcApwcd", XFA_BARCODETYPE_upcApwcd, BC_UNKNOWN}, + {0x347a1846, L"postUSIMB", XFA_BARCODETYPE_postUSIMB, BC_UNKNOWN}, + {0x391bb836, L"code128", XFA_BARCODETYPE_code128, BC_CODE128}, + {0x398eddaf, L"dataMatrix", XFA_BARCODETYPE_dataMatrix, BC_DATAMATRIX}, + {0x3cff60a8, L"upcEadd2", XFA_BARCODETYPE_upcEadd2, BC_UNKNOWN}, + {0x3cff60ab, L"upcEadd5", XFA_BARCODETYPE_upcEadd5, BC_UNKNOWN}, + {0x402cb188, L"code2Of5Standard", XFA_BARCODETYPE_code2Of5Standard, + BC_UNKNOWN}, + {0x411764f7, L"aztec", XFA_BARCODETYPE_aztec, BC_UNKNOWN}, + {0x44d4e84c, L"ean8", XFA_BARCODETYPE_ean8, BC_EAN8}, + {0x48468902, L"ucc128sscc", XFA_BARCODETYPE_ucc128sscc, BC_UNKNOWN}, + {0x4880aea4, L"upcAadd2", XFA_BARCODETYPE_upcAadd2, BC_UNKNOWN}, + {0x4880aea7, L"upcAadd5", XFA_BARCODETYPE_upcAadd5, BC_UNKNOWN}, + {0x54f18256, L"code2Of5Industrial", XFA_BARCODETYPE_code2Of5Industrial, + BC_UNKNOWN}, + {0x58e15f25, L"rss14Limited", XFA_BARCODETYPE_rss14Limited, BC_UNKNOWN}, + {0x5c08d1b9, L"postAUSReplyPaid", XFA_BARCODETYPE_postAUSReplyPaid, + BC_UNKNOWN}, + {0x5fa700bd, L"rss14", XFA_BARCODETYPE_rss14, BC_UNKNOWN}, + {0x631a7e35, L"logmars", XFA_BARCODETYPE_logmars, BC_UNKNOWN}, + {0x6a236236, L"pdf417", XFA_BARCODETYPE_pdf417, BC_PDF417}, + {0x6d098ece, L"upcean2", XFA_BARCODETYPE_upcean2, BC_UNKNOWN}, + {0x6d098ed1, L"upcean5", XFA_BARCODETYPE_upcean5, BC_UNKNOWN}, + {0x76b04eed, L"code3Of9extended", XFA_BARCODETYPE_code3Of9extended, + BC_UNKNOWN}, + {0x7c7db84a, L"maxicode", XFA_BARCODETYPE_maxicode, BC_UNKNOWN}, + {0x8266f7f7, L"ucc128random", XFA_BARCODETYPE_ucc128random, BC_UNKNOWN}, + {0x83eca147, L"postUSDPBC", XFA_BARCODETYPE_postUSDPBC, BC_UNKNOWN}, + {0x8dd71de0, L"postAUSStandard", XFA_BARCODETYPE_postAUSStandard, + BC_UNKNOWN}, + {0x98adad85, L"plessey", XFA_BARCODETYPE_plessey, BC_UNKNOWN}, + {0x9f84cce6, L"ean13pwcd", XFA_BARCODETYPE_ean13pwcd, BC_UNKNOWN}, + {0xb514fbe9, L"upcA", XFA_BARCODETYPE_upcA, BC_UPCA}, + {0xb514fbed, L"upcE", XFA_BARCODETYPE_upcE, BC_UNKNOWN}, + {0xb5c6a853, L"ean13add2", XFA_BARCODETYPE_ean13add2, BC_UNKNOWN}, + {0xb5c6a856, L"ean13add5", XFA_BARCODETYPE_ean13add5, BC_UNKNOWN}, + {0xb81fc512, L"postUKRM4SCC", XFA_BARCODETYPE_postUKRM4SCC, BC_UNKNOWN}, + {0xbad34b22, L"code128SSCC", XFA_BARCODETYPE_code128SSCC, BC_UNKNOWN}, + {0xbfbe0cf6, L"postUS5Zip", XFA_BARCODETYPE_postUS5Zip, BC_UNKNOWN}, + {0xc56618e8, L"pdf417macro", XFA_BARCODETYPE_pdf417macro, BC_UNKNOWN}, + {0xca730f8a, L"code2Of5Interleaved", XFA_BARCODETYPE_code2Of5Interleaved, + BC_UNKNOWN}, + {0xd0097ac6, L"rss14Expanded", XFA_BARCODETYPE_rss14Expanded, BC_UNKNOWN}, + {0xd25a0240, L"postAUSCust2", XFA_BARCODETYPE_postAUSCust2, BC_UNKNOWN}, + {0xd25a0241, L"postAUSCust3", XFA_BARCODETYPE_postAUSCust3, BC_UNKNOWN}, + {0xd53ed3e7, L"rss14Truncated", XFA_BARCODETYPE_rss14Truncated, BC_UNKNOWN}, + {0xe72bcd57, L"code128A", XFA_BARCODETYPE_code128A, BC_UNKNOWN}, + {0xe72bcd58, L"code128B", XFA_BARCODETYPE_code128B, BC_CODE128_B}, + {0xe72bcd59, L"code128C", XFA_BARCODETYPE_code128C, BC_CODE128_C}, + {0xee83c50f, L"rss14StackedOmni", XFA_BARCODETYPE_rss14StackedOmni, + BC_UNKNOWN}, + {0xf2a18f7e, L"QRCode", XFA_BARCODETYPE_QRCode, BC_QR_CODE}, + {0xfaeaf37f, L"postUSStandard", XFA_BARCODETYPE_postUSStandard, BC_UNKNOWN}, + {0xfb48155c, L"code3Of9", XFA_BARCODETYPE_code3Of9, BC_CODE39}, +}; +const int32_t g_iXFABarcodeTypeCount = + sizeof(g_XFABarCodeTypeEnumData) / sizeof(XFA_BARCODETYPEENUMINFO); + +XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( + const CFX_WideStringC& wsName) { + int32_t iLength = wsName.GetLength(); + if (iLength == 0) { + return NULL; + } + uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength, TRUE); + int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; + do { + int32_t iMid = (iStart + iEnd) / 2; + XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid; + if (uHash == pInfo->uHash) { + return pInfo; + } else if (uHash < pInfo->uHash) { + iEnd = iMid - 1; + } else { + iStart = iMid + 1; + } + } while (iStart <= iEnd); + return NULL; +} + +} // namespace. + CXFA_FFBarcode::CXFA_FFBarcode(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFTextEdit(pPageView, pDataAcc) {} @@ -139,97 +237,3 @@ FX_BOOL CXFA_FFBarcode::OnRButtonDown(FX_DWORD dwFlags, } return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); } -extern const XFA_BARCODETYPEENUMINFO g_XFABarCodeTypeEnumData[] = { - {0x7fb4a18, L"ean13", XFA_BARCODETYPE_ean13, BC_EAN13}, - {0x8d13a3d, L"code11", XFA_BARCODETYPE_code11, BC_UNKNOWN}, - {0x8d149a8, L"code49", XFA_BARCODETYPE_code49, BC_UNKNOWN}, - {0x8d16347, L"code93", XFA_BARCODETYPE_code93, BC_UNKNOWN}, - {0x91a92e2, L"upsMaxicode", XFA_BARCODETYPE_upsMaxicode, BC_UNKNOWN}, - {0xa7d48dc, L"fim", XFA_BARCODETYPE_fim, BC_UNKNOWN}, - {0xb359fe9, L"msi", XFA_BARCODETYPE_msi, BC_UNKNOWN}, - {0x121f738c, L"code2Of5Matrix", XFA_BARCODETYPE_code2Of5Matrix, BC_UNKNOWN}, - {0x15358616, L"ucc128", XFA_BARCODETYPE_ucc128, BC_UNKNOWN}, - {0x1f4bfa05, L"rfid", XFA_BARCODETYPE_rfid, BC_UNKNOWN}, - {0x1fda71bc, L"rss14Stacked", XFA_BARCODETYPE_rss14Stacked, BC_UNKNOWN}, - {0x22065087, L"ean8add2", XFA_BARCODETYPE_ean8add2, BC_UNKNOWN}, - {0x2206508a, L"ean8add5", XFA_BARCODETYPE_ean8add5, BC_UNKNOWN}, - {0x2278366c, L"codabar", XFA_BARCODETYPE_codabar, BC_CODABAR}, - {0x2a039a8d, L"telepen", XFA_BARCODETYPE_telepen, BC_UNKNOWN}, - {0x323ed337, L"upcApwcd", XFA_BARCODETYPE_upcApwcd, BC_UNKNOWN}, - {0x347a1846, L"postUSIMB", XFA_BARCODETYPE_postUSIMB, BC_UNKNOWN}, - {0x391bb836, L"code128", XFA_BARCODETYPE_code128, BC_CODE128}, - {0x398eddaf, L"dataMatrix", XFA_BARCODETYPE_dataMatrix, BC_DATAMATRIX}, - {0x3cff60a8, L"upcEadd2", XFA_BARCODETYPE_upcEadd2, BC_UNKNOWN}, - {0x3cff60ab, L"upcEadd5", XFA_BARCODETYPE_upcEadd5, BC_UNKNOWN}, - {0x402cb188, L"code2Of5Standard", XFA_BARCODETYPE_code2Of5Standard, - BC_UNKNOWN}, - {0x411764f7, L"aztec", XFA_BARCODETYPE_aztec, BC_UNKNOWN}, - {0x44d4e84c, L"ean8", XFA_BARCODETYPE_ean8, BC_EAN8}, - {0x48468902, L"ucc128sscc", XFA_BARCODETYPE_ucc128sscc, BC_UNKNOWN}, - {0x4880aea4, L"upcAadd2", XFA_BARCODETYPE_upcAadd2, BC_UNKNOWN}, - {0x4880aea7, L"upcAadd5", XFA_BARCODETYPE_upcAadd5, BC_UNKNOWN}, - {0x54f18256, L"code2Of5Industrial", XFA_BARCODETYPE_code2Of5Industrial, - BC_UNKNOWN}, - {0x58e15f25, L"rss14Limited", XFA_BARCODETYPE_rss14Limited, BC_UNKNOWN}, - {0x5c08d1b9, L"postAUSReplyPaid", XFA_BARCODETYPE_postAUSReplyPaid, - BC_UNKNOWN}, - {0x5fa700bd, L"rss14", XFA_BARCODETYPE_rss14, BC_UNKNOWN}, - {0x631a7e35, L"logmars", XFA_BARCODETYPE_logmars, BC_UNKNOWN}, - {0x6a236236, L"pdf417", XFA_BARCODETYPE_pdf417, BC_PDF417}, - {0x6d098ece, L"upcean2", XFA_BARCODETYPE_upcean2, BC_UNKNOWN}, - {0x6d098ed1, L"upcean5", XFA_BARCODETYPE_upcean5, BC_UNKNOWN}, - {0x76b04eed, L"code3Of9extended", XFA_BARCODETYPE_code3Of9extended, - BC_UNKNOWN}, - {0x7c7db84a, L"maxicode", XFA_BARCODETYPE_maxicode, BC_UNKNOWN}, - {0x8266f7f7, L"ucc128random", XFA_BARCODETYPE_ucc128random, BC_UNKNOWN}, - {0x83eca147, L"postUSDPBC", XFA_BARCODETYPE_postUSDPBC, BC_UNKNOWN}, - {0x8dd71de0, L"postAUSStandard", XFA_BARCODETYPE_postAUSStandard, - BC_UNKNOWN}, - {0x98adad85, L"plessey", XFA_BARCODETYPE_plessey, BC_UNKNOWN}, - {0x9f84cce6, L"ean13pwcd", XFA_BARCODETYPE_ean13pwcd, BC_UNKNOWN}, - {0xb514fbe9, L"upcA", XFA_BARCODETYPE_upcA, BC_UPCA}, - {0xb514fbed, L"upcE", XFA_BARCODETYPE_upcE, BC_UNKNOWN}, - {0xb5c6a853, L"ean13add2", XFA_BARCODETYPE_ean13add2, BC_UNKNOWN}, - {0xb5c6a856, L"ean13add5", XFA_BARCODETYPE_ean13add5, BC_UNKNOWN}, - {0xb81fc512, L"postUKRM4SCC", XFA_BARCODETYPE_postUKRM4SCC, BC_UNKNOWN}, - {0xbad34b22, L"code128SSCC", XFA_BARCODETYPE_code128SSCC, BC_UNKNOWN}, - {0xbfbe0cf6, L"postUS5Zip", XFA_BARCODETYPE_postUS5Zip, BC_UNKNOWN}, - {0xc56618e8, L"pdf417macro", XFA_BARCODETYPE_pdf417macro, BC_UNKNOWN}, - {0xca730f8a, L"code2Of5Interleaved", XFA_BARCODETYPE_code2Of5Interleaved, - BC_UNKNOWN}, - {0xd0097ac6, L"rss14Expanded", XFA_BARCODETYPE_rss14Expanded, BC_UNKNOWN}, - {0xd25a0240, L"postAUSCust2", XFA_BARCODETYPE_postAUSCust2, BC_UNKNOWN}, - {0xd25a0241, L"postAUSCust3", XFA_BARCODETYPE_postAUSCust3, BC_UNKNOWN}, - {0xd53ed3e7, L"rss14Truncated", XFA_BARCODETYPE_rss14Truncated, BC_UNKNOWN}, - {0xe72bcd57, L"code128A", XFA_BARCODETYPE_code128A, BC_UNKNOWN}, - {0xe72bcd58, L"code128B", XFA_BARCODETYPE_code128B, BC_CODE128_B}, - {0xe72bcd59, L"code128C", XFA_BARCODETYPE_code128C, BC_CODE128_C}, - {0xee83c50f, L"rss14StackedOmni", XFA_BARCODETYPE_rss14StackedOmni, - BC_UNKNOWN}, - {0xf2a18f7e, L"QRCode", XFA_BARCODETYPE_QRCode, BC_QR_CODE}, - {0xfaeaf37f, L"postUSStandard", XFA_BARCODETYPE_postUSStandard, BC_UNKNOWN}, - {0xfb48155c, L"code3Of9", XFA_BARCODETYPE_code3Of9, BC_CODE39}, -}; -extern const int32_t g_iXFABarcodeTypeCount = - sizeof(g_XFABarCodeTypeEnumData) / sizeof(XFA_BARCODETYPEENUMINFO); -static XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( - const CFX_WideStringC& wsName) { - int32_t iLength = wsName.GetLength(); - if (iLength == 0) { - return NULL; - } - uint32_t uHash = FX_HashCode_String_GetW(wsName.GetPtr(), iLength, TRUE); - int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; - do { - int32_t iMid = (iStart + iEnd) / 2; - XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid; - if (uHash == pInfo->uHash) { - return pInfo; - } else if (uHash < pInfo->uHash) { - iEnd = iMid - 1; - } else { - iStart = iMid + 1; - } - } while (iStart <= iEnd); - return NULL; -} diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index cd390e8bcb..2e00f4e3a2 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -96,6 +96,5 @@ struct XFA_BARCODETYPEENUMINFO { BC_TYPE eBCType; }; typedef XFA_BARCODETYPEENUMINFO const* XFA_LPCBARCODETYPEENUMINFO; -extern const XFA_BARCODETYPEENUMINFO g_XFABarCodeTypeEnumData[]; #endif // XFA_FXFA_APP_XFA_FFBARCODE_H_ diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 6ebf4e3f41..11b70024c4 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -23,6 +23,14 @@ #include "xfa/include/fwl/basewidget/fwl_pushbutton.h" #include "xfa/include/fwl/basewidget/fwl_scrollbar.h" +namespace { + +const FX_WCHAR* const g_FWLTheme_CalFonts[] = { + L"Arial", L"Courier New", L"DejaVu Sans", +}; + +} // namespace + CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { IFWL_Widget* pOuter = pWidget; while (pOuter->GetOuter()) { @@ -66,9 +74,6 @@ CXFA_FWLTheme::~CXFA_FWLTheme() { delete m_pCaretTP; delete m_pBarcodeTP; } -static const FX_WCHAR* g_FWLTheme_CalFonts[] = { - L"Arial", L"Courier New", L"DejaVu Sans", -}; FWL_ERR CXFA_FWLTheme::Initialize() { m_pTextOut = IFDE_TextOut::Create(); for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); |