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 | |
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 .
-rw-r--r-- | core/fpdfapi/fpdf_font/font_int.h | 34 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 6 | ||||
-rw-r--r-- | core/fpdfdoc/doc_action.cpp | 58 | ||||
-rw-r--r-- | core/fpdfdoc/doc_basic.cpp | 25 | ||||
-rw-r--r-- | core/include/fpdfapi/fpdf_resource.h | 2 | ||||
-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 |
8 files changed, 180 insertions, 153 deletions
diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h index c9981387e6..bb209d8c16 100644 --- a/core/fpdfapi/fpdf_font/font_int.h +++ b/core/fpdfapi/fpdf_font/font_int.h @@ -110,16 +110,27 @@ class CPDF_CMapParser { CFX_ByteString m_Registry, m_Ordering, m_Supplement; CFX_ByteString m_LastWord; }; -#define CIDCODING_UNKNOWN 0 -#define CIDCODING_GB 1 -#define CIDCODING_BIG5 2 -#define CIDCODING_JIS 3 -#define CIDCODING_KOREA 4 -#define CIDCODING_UCS2 5 -#define CIDCODING_CID 6 -#define CIDCODING_UTF16 7 + +enum CIDCoding : uint8_t { + CIDCODING_UNKNOWN = 0, + CIDCODING_GB, + CIDCODING_BIG5, + CIDCODING_JIS, + CIDCODING_KOREA, + CIDCODING_UCS2, + CIDCODING_CID, + CIDCODING_UTF16, +}; + class CPDF_CMap { public: + enum CodingScheme : uint8_t { + OneByte, + TwoBytes, + MixedTwoBytes, + MixedFourBytes + }; + CPDF_CMap(); FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, @@ -134,12 +145,6 @@ class CPDF_CMap { FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; int CountChar(const FX_CHAR* pString, int size) const; int AppendChar(FX_CHAR* str, FX_DWORD charcode) const; - typedef enum { - OneByte, - TwoBytes, - MixedTwoBytes, - MixedFourBytes - } CodingScheme; protected: ~CPDF_CMap(); @@ -147,7 +152,6 @@ class CPDF_CMap { friend class CPDF_CMapManager; friend class CPDF_CIDFont; - protected: CFX_ByteString m_PredefinedCMap; FX_BOOL m_bVertical; CIDSet m_Charset; diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 60fa40103b..97a3d4dbc1 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -22,15 +22,15 @@ namespace { const FX_CHAR* const g_CharsetNames[CIDSET_NUM_SETS] = { nullptr, "GB1", "CNS1", "Japan1", "Korea1", "UCS"}; -const int g_CharsetCPs[CIDSET_NUM_SETS] = {0, 936, 950, 932, 949, 1200}; +const uint16_t g_CharsetCPs[CIDSET_NUM_SETS] = {0, 936, 950, 932, 949, 1200}; class CPDF_PredefinedCMap { public: const FX_CHAR* m_pName; CIDSet m_Charset; - int m_Coding; + CIDCoding m_Coding; CPDF_CMap::CodingScheme m_CodingScheme; - FX_DWORD m_LeadingSegCount; + uint8_t m_LeadingSegCount; uint8_t m_LeadingSegs[4]; }; diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 963257006a..d0deb19a8c 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -10,6 +10,20 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" +namespace { + +const FX_CHAR* const g_sATypes[] = { + "Unknown", "GoTo", "GoToR", "GoToE", "Launch", + "Thread", "URI", "Sound", "Movie", "Hide", + "Named", "SubmitForm", "ResetForm", "ImportData", "JavaScript", + "SetOCGState", "Rendition", "Trans", "GoTo3DView", nullptr}; + +const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", + "PV", "PI", "O", "C", "K", "F", "V", "C", + "WC", "WS", "DS", "WP", "DP", ""}; + +} // namespace + CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { if (!m_pDict) { return CPDF_Dest(); @@ -31,27 +45,22 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { return CPDF_Dest(pArray); return CPDF_Dest(); } -const FX_CHAR* g_sATypes[] = { - "Unknown", "GoTo", "GoToR", "GoToE", "Launch", - "Thread", "URI", "Sound", "Movie", "Hide", - "Named", "SubmitForm", "ResetForm", "ImportData", "JavaScript", - "SetOCGState", "Rendition", "Trans", "GoTo3DView", ""}; + CPDF_Action::ActionType CPDF_Action::GetType() const { - ActionType eType = Unknown; - if (m_pDict) { - CFX_ByteString csType = m_pDict->GetStringBy("S"); - if (!csType.IsEmpty()) { - int i = 0; - while (g_sATypes[i][0] != '\0') { - if (csType == g_sATypes[i]) { - return (ActionType)i; - } - i++; - } - } + if (!m_pDict) + return Unknown; + + CFX_ByteString csType = m_pDict->GetStringBy("S"); + if (csType.IsEmpty()) + return Unknown; + + for (int i = 0; g_sATypes[i]; ++i) { + if (csType == g_sATypes[i]) + return static_cast<ActionType>(i); } - return eType; + return Unknown; } + CFX_WideString CPDF_Action::GetFilePath() const { CFX_ByteString type = m_pDict->GetStringBy("S"); if (type != "GoToR" && type != "Launch" && type != "SubmitForm" && @@ -249,17 +258,16 @@ CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { } return CPDF_Action(); } -const FX_CHAR* g_sAATypes[] = {"E", "X", "D", "U", "Fo", "Bl", "PO", "PC", - "PV", "PI", "O", "C", "K", "F", "V", "C", - "WC", "WS", "DS", "WP", "DP", ""}; + FX_BOOL CPDF_AAction::ActionExist(AActionType eType) const { - return m_pDict && m_pDict->KeyExist(g_sAATypes[(int)eType]); + return m_pDict && m_pDict->KeyExist(g_sAATypes[eType]); } + CPDF_Action CPDF_AAction::GetAction(AActionType eType) const { - if (!m_pDict) { + if (!m_pDict) return CPDF_Action(); - } - return CPDF_Action(m_pDict->GetDictBy(g_sAATypes[(int)eType])); + + return CPDF_Action(m_pDict->GetDictBy(g_sAATypes[eType])); } CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {} diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 851730346c..cd2afab408 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -9,7 +9,14 @@ #include "core/fpdfdoc/doc_utils.h" #include "core/include/fpdfdoc/fpdf_doc.h" +namespace { + const int nMaxRecursion = 32; +const FX_CHAR* const g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", + "FitB", "FitBH", "FitBV", nullptr}; + +} // namespace + int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) { CPDF_Array* pArray = ToArray(m_pObj); if (!pArray) @@ -38,25 +45,25 @@ FX_DWORD CPDF_Dest::GetPageObjNum() { return pPage->GetObjNum(); return 0; } -const FX_CHAR* g_sZoomModes[] = {"XYZ", "Fit", "FitH", "FitV", "FitR", - "FitB", "FitBH", "FitBV", ""}; + int CPDF_Dest::GetZoomMode() { CPDF_Array* pArray = ToArray(m_pObj); if (!pArray) return 0; - CFX_ByteString mode; CPDF_Object* pObj = pArray->GetElementValue(1); - mode = pObj ? pObj->GetString() : CFX_ByteString(); - int i = 0; - while (g_sZoomModes[i][0] != '\0') { - if (mode == g_sZoomModes[i]) { + if (!pObj) + return 0; + + CFX_ByteString mode = pObj->GetString(); + for (int i = 0; g_sZoomModes[i]; ++i) { + if (mode == g_sZoomModes[i]) return i + 1; - } - i++; } + return 0; } + FX_FLOAT CPDF_Dest::GetParam(int index) { CPDF_Array* pArray = ToArray(m_pObj); return pArray ? pArray->GetNumberAt(2 + index) : 0; diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index 1ae0030df8..379f53acb9 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -344,7 +344,7 @@ class CPDF_Type3Font : public CPDF_SimpleFont { std::map<FX_DWORD, CPDF_Type3Char*> m_CacheMap; }; -enum CIDSet { +enum CIDSet : uint8_t { CIDSET_UNKNOWN, CIDSET_GB1, CIDSET_CNS1, 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); |