From ea208f204a96339eeff696970a4a859bb93b41e5 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 24 Feb 2016 13:28:52 -0800 Subject: Moar _CAPS work, part 5 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1735663002 . --- xfa/src/fgas/src/font/fx_fontutils.cpp | 3 +- xfa/src/fgas/src/font/fx_fontutils.h | 8 ++--- xfa/src/fgas/src/font/fx_gefont.cpp | 2 +- xfa/src/fgas/src/font/fx_stdfontmgr.cpp | 12 ++++---- xfa/src/fgas/src/layout/fx_textbreak.cpp | 7 +++-- xfa/src/fgas/src/layout/fx_unicode.h | 5 +-- xfa/src/fgas/src/localization/fx_datetime.cpp | 5 +-- xfa/src/fgas/src/localization/fx_locale.cpp | 44 +++++++++++++++------------ 8 files changed, 48 insertions(+), 38 deletions(-) diff --git a/xfa/src/fgas/src/font/fx_fontutils.cpp b/xfa/src/fgas/src/font/fx_fontutils.cpp index 0affb52ecf..0f569d2055 100644 --- a/xfa/src/fgas/src/font/fx_fontutils.cpp +++ b/xfa/src/fgas/src/font/fx_fontutils.cpp @@ -130,7 +130,8 @@ static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { {0xFF00, 0xFF5F, 68, 936}, {0xFF60, 0xFF9F, 68, 932}, {0xFFA0, 0xFFEF, 68, 0xFFFF}, }; -FGAS_LPCFONTUSB FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) { + +const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode) { int32_t iEnd = sizeof(g_FXGdiFontUSBTable) / sizeof(FGAS_FONTUSB) - 1; FXSYS_assert(iEnd >= 0); int32_t iStart = 0, iMid; diff --git a/xfa/src/fgas/src/font/fx_fontutils.h b/xfa/src/fgas/src/font/fx_fontutils.h index 100a70ae78..d122c1df42 100644 --- a/xfa/src/fgas/src/font/fx_fontutils.h +++ b/xfa/src/fgas/src/font/fx_fontutils.h @@ -7,17 +7,17 @@ #ifndef XFA_SRC_FGAS_SRC_FONT_FX_FONTUTILS_H_ #define XFA_SRC_FGAS_SRC_FONT_FX_FONTUTILS_H_ -typedef struct _FGAS_FONTUSB { +struct FGAS_FONTUSB { FX_WCHAR wStartUnicode; FX_WCHAR wEndUnicode; FX_WORD wBitField; FX_WORD wCodePage; -} FGAS_FONTUSB, *FGAS_LPFONTUSB; -typedef FGAS_FONTUSB const* FGAS_LPCFONTUSB; +}; + FX_DWORD FGAS_GetFontHashCode(FX_WORD wCodePage, FX_DWORD dwFontStyles); FX_DWORD FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage); -FGAS_LPCFONTUSB FGAS_GetUnicodeBitField(FX_WCHAR wUnicode); +const FGAS_FONTUSB* FGAS_GetUnicodeBitField(FX_WCHAR wUnicode); #endif // XFA_SRC_FGAS_SRC_FONT_FX_FONTUTILS_H_ diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp index 2e28ce31b8..2943a99915 100644 --- a/xfa/src/fgas/src/font/fx_gefont.cpp +++ b/xfa/src/fgas/src/font/fx_gefont.cpp @@ -484,7 +484,7 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, } return iGlyphIndex; } - FGAS_LPCFONTUSB pFontUSB = FGAS_GetUnicodeBitField(wUnicode); + const FGAS_FONTUSB* pFontUSB = FGAS_GetUnicodeBitField(wUnicode); if (pFontUSB == NULL) { return 0xFFFF; } diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp index 3f1c59e2cc..bb4a7cfd15 100644 --- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp +++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp @@ -789,7 +789,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, IFX_Font* pFont = nullptr; if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont)) return nullptr; - FGAS_LPCFONTUSB x = FGAS_GetUnicodeBitField(wUnicode); + const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); FX_WORD wCodePage = x ? x->wCodePage : 0xFFFF; FX_WORD wBitField = x ? x->wBitField : 0x03E7; CFX_ByteString bsHash; @@ -1140,6 +1140,7 @@ static const FX_BitCodePage g_Bit2CodePage[] = { {54, 861}, {55, 860}, {56, 857}, {57, 855}, {58, 852}, {59, 775}, {60, 737}, {61, 708}, {62, 850}, {63, 437}, }; + FX_WORD FX_GetCodePageBit(FX_WORD wCodePage) { for (int32_t i = 0; i < sizeof(g_Bit2CodePage) / sizeof(FX_BitCodePage); i++) { @@ -1149,13 +1150,12 @@ FX_WORD FX_GetCodePageBit(FX_WORD wCodePage) { } return (FX_WORD)-1; } + FX_WORD FX_GetUnicodeBit(FX_WCHAR wcUnicode) { - FGAS_LPCFONTUSB x = FGAS_GetUnicodeBitField(wcUnicode); - if (NULL == x) { - return 999; - } - return x->wBitField; + const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wcUnicode); + return x ? x->wBitField : 999; } + int32_t CFX_FontMgrImp::CalcPenalty(CFX_FontDescriptor* pInstalled, FX_WORD wCodePage, FX_DWORD dwFontStyles, diff --git a/xfa/src/fgas/src/layout/fx_textbreak.cpp b/xfa/src/fgas/src/layout/fx_textbreak.cpp index 779ddadcda..700af7975e 100644 --- a/xfa/src/fgas/src/layout/fx_textbreak.cpp +++ b/xfa/src/fgas/src/layout/fx_textbreak.cpp @@ -1159,12 +1159,13 @@ void CFX_TxtBreak::Reset() { m_pTxtLine1->RemoveAll(TRUE); m_pTxtLine2->RemoveAll(TRUE); } -typedef struct _FX_FORMCHAR { + +struct FX_FORMCHAR { FX_WORD wch; FX_WORD wForm; int32_t iWidth; -} FX_FORMCHAR, *FX_LPFORMCHAR; -typedef FX_FORMCHAR const* FX_LPCFORMCHAR; +}; + int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, FXTEXT_CHARPOS* pCharPos, FX_BOOL bCharCode, diff --git a/xfa/src/fgas/src/layout/fx_unicode.h b/xfa/src/fgas/src/layout/fx_unicode.h index 8c6149a3a8..70652e40f0 100644 --- a/xfa/src/fgas/src/layout/fx_unicode.h +++ b/xfa/src/fgas/src/layout/fx_unicode.h @@ -7,11 +7,12 @@ #ifndef XFA_SRC_FGAS_SRC_LAYOUT_FX_UNICODE_H_ #define XFA_SRC_FGAS_SRC_LAYOUT_FX_UNICODE_H_ -typedef struct _FX_TPO { +struct FX_TPO { int32_t index; int32_t pos; -} FX_TPO; +}; typedef CFX_MassArrayTemplate CFX_TPOArray; + void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd); #endif // XFA_SRC_FGAS_SRC_LAYOUT_FX_UNICODE_H_ diff --git a/xfa/src/fgas/src/localization/fx_datetime.cpp b/xfa/src/fgas/src/localization/fx_datetime.cpp index 1907977b78..99d383b30f 100644 --- a/xfa/src/fgas/src/localization/fx_datetime.cpp +++ b/xfa/src/fgas/src/localization/fx_datetime.cpp @@ -130,7 +130,7 @@ static void FX_DaysToDate(int64_t iDays, iDay += (uint8_t)iDays; } -typedef struct _FXUT_SYSTEMTIME { +struct FXUT_SYSTEMTIME { FX_WORD wYear; FX_WORD wMonth; FX_WORD wDayOfWeek; @@ -139,7 +139,8 @@ typedef struct _FXUT_SYSTEMTIME { FX_WORD wMinute; FX_WORD wSecond; FX_WORD wMilliseconds; -} FXUT_SYSTEMTIME; +}; + void CFX_Unitime::Now() { FXUT_SYSTEMTIME utLocal; #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ diff --git a/xfa/src/fgas/src/localization/fx_locale.cpp b/xfa/src/fgas/src/localization/fx_locale.cpp index 13939f6433..46eeae0c4f 100644 --- a/xfa/src/fgas/src/localization/fx_locale.cpp +++ b/xfa/src/fgas/src/localization/fx_locale.cpp @@ -17,47 +17,52 @@ #define FX_LOCALECATEGORY_TextHash 0x2d08af85 #define FX_LOCALECATEGORY_ZeroHash 0x568cb500 #define FX_LOCALECATEGORY_NullHash 0x052931bb -typedef struct _FX_LOCALESUBCATEGORYINFO { + +struct FX_LOCALESUBCATEGORYINFO { uint32_t uHash; const FX_WCHAR* pName; int32_t eSubCategory; -} FX_LOCALESUBCATEGORYINFO, *FX_LPLOCALESUBCATEGORYINFO; -typedef FX_LOCALESUBCATEGORYINFO const* FX_LPCLOCALESUBCATEGORYINFO; -const static FX_LOCALESUBCATEGORYINFO g_FXLocaleDateTimeSubCatData[] = { +}; + +static const FX_LOCALESUBCATEGORYINFO g_FXLocaleDateTimeSubCatData[] = { {0x14da2125, L"default", FX_LOCALEDATETIMESUBCATEGORY_Default}, {0x9041d4b0, L"short", FX_LOCALEDATETIMESUBCATEGORY_Short}, {0xa084a381, L"medium", FX_LOCALEDATETIMESUBCATEGORY_Medium}, {0xcdce56b3, L"full", FX_LOCALEDATETIMESUBCATEGORY_Full}, {0xf6b4afb0, L"long", FX_LOCALEDATETIMESUBCATEGORY_Long}, }; -const static int32_t g_iFXLocaleDateTimeSubCatCount = +static const int32_t g_iFXLocaleDateTimeSubCatCount = sizeof(g_FXLocaleDateTimeSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO); -const static FX_LOCALESUBCATEGORYINFO g_FXLocaleNumSubCatData[] = { + +static const FX_LOCALESUBCATEGORYINFO g_FXLocaleNumSubCatData[] = { {0x46f95531, L"percent", FX_LOCALENUMPATTERN_Percent}, {0x4c4e8acb, L"currency", FX_LOCALENUMPATTERN_Currency}, {0x54034c2f, L"decimal", FX_LOCALENUMPATTERN_Decimal}, {0x7568e6ae, L"integer", FX_LOCALENUMPATTERN_Integer}, }; -const static int32_t g_iFXLocaleNumSubCatCount = +static const int32_t g_iFXLocaleNumSubCatCount = sizeof(g_FXLocaleNumSubCatData) / sizeof(FX_LOCALESUBCATEGORYINFO); -typedef struct _FX_LOCALETIMEZONEINFO { + +struct FX_LOCALETIMEZONEINFO { FX_DWORD uHash; int16_t iHour; int16_t iMinute; -} FX_LOCALETIMEZONEINFO, *FX_LPLOCALETIMEZONEINFO; -typedef FX_LOCALETIMEZONEINFO const* FX_LPCLOCALETIMEZONEINFO; -const static FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = { +}; + +static const FX_LOCALETIMEZONEINFO g_FXLocaleTimeZoneData[] = { {FXBSTR_ID(0, 'C', 'D', 'T'), -5, 0}, {FXBSTR_ID(0, 'C', 'S', 'T'), -6, 0}, {FXBSTR_ID(0, 'E', 'D', 'T'), -4, 0}, {FXBSTR_ID(0, 'E', 'S', 'T'), -5, 0}, {FXBSTR_ID(0, 'M', 'D', 'T'), -6, 0}, {FXBSTR_ID(0, 'M', 'S', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'D', 'T'), -7, 0}, {FXBSTR_ID(0, 'P', 'S', 'T'), -8, 0}, }; -const static int32_t g_iFXLocaleTimeZoneCount = +static const int32_t g_iFXLocaleTimeZoneCount = sizeof(g_FXLocaleTimeZoneData) / sizeof(FX_LOCALETIMEZONEINFO); -const static CFX_WideStringC gs_wsTextSymbols = FX_WSTRC(L"AXO09"); -const static CFX_WideStringC gs_wsTimeSymbols = FX_WSTRC(L"hHkKMSFAzZ"); -const static CFX_WideStringC gs_wsDateSymbols = FX_WSTRC(L"DJMEeGgYwW"); -const static CFX_WideStringC gs_wsConstChars = FX_WSTRC(L",-:/. "); + +static const CFX_WideStringC gs_wsTextSymbols = FX_WSTRC(L"AXO09"); +static const CFX_WideStringC gs_wsTimeSymbols = FX_WSTRC(L"hHkKMSFAzZ"); +static const CFX_WideStringC gs_wsDateSymbols = FX_WSTRC(L"DJMEeGgYwW"); +static const CFX_WideStringC gs_wsConstChars = FX_WSTRC(L",-:/. "); + static FX_STRSIZE FX_Local_Find(const CFX_WideStringC& wsSymbols, FX_WCHAR ch, FX_STRSIZE nStart = 0) { @@ -2766,11 +2771,12 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, } FX_ResolveZone(hour, minute, tzDiff, pLocale); } else { - FX_LPCLOCALETIMEZONEINFO pTimeZoneInfo = NULL; - int32_t iStart = 0, iEnd = g_iFXLocaleTimeZoneCount - 1; + const FX_LOCALETIMEZONEINFO* pTimeZoneInfo = NULL; + int32_t iStart = 0; + int32_t iEnd = g_iFXLocaleTimeZoneCount - 1; do { int32_t iMid = (iStart + iEnd) / 2; - FX_LPCLOCALETIMEZONEINFO pInfo = g_FXLocaleTimeZoneData + iMid; + const FX_LOCALETIMEZONEINFO* pInfo = g_FXLocaleTimeZoneData + iMid; if (dwHash == pInfo->uHash) { pTimeZoneInfo = pInfo; break; -- cgit v1.2.3