summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-08 10:12:45 -0800
committerTom Sepez <tsepez@chromium.org>2016-03-08 10:12:45 -0800
commit69af2a34f211c1e8ab9737c82550da5125a51fcf (patch)
tree812310558bbbdc125534918a1d0ac6bf61951c99
parent83c523a519477a2fe5a7e3e8044c767bfee36770 (diff)
downloadpdfium-69af2a34f211c1e8ab9737c82550da5125a51fcf.tar.xz
FX_FONTDESCRIPTOR must be POD.
Since it is malloc'd, memset, and such, and clang-cl notices this. Also delete unused function found by clang-cl. BUG=pdfium:429 R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1777573003 .
-rw-r--r--core/src/fpdfdoc/doc_form.cpp15
-rw-r--r--xfa/src/fgas/include/fx_fnt.h28
2 files changed, 19 insertions, 24 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 684d9122ad..7a6db90f32 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -388,21 +388,6 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet,
}
return RetrieveSpecificFont(lf);
}
-#ifdef PDF_ENABLE_XFA
-static FX_BOOL RetrieveStockFont(int iFontObject,
- uint8_t charSet,
- LOGFONTA& lf) {
- HFONT hFont = (HFONT)::GetStockObject(iFontObject);
- if (hFont) {
- memset(&lf, 0, sizeof(LOGFONTA));
- int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf);
- if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) {
- return RetrieveSpecificFont(lf);
- }
- }
- return FALSE;
-}
-#endif // PDF_ENABLE_XFA
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument,
diff --git a/xfa/src/fgas/include/fx_fnt.h b/xfa/src/fgas/include/fx_fnt.h
index efb1b03b33..ce994d0e4d 100644
--- a/xfa/src/fgas/include/fx_fnt.h
+++ b/xfa/src/fgas/include/fx_fnt.h
@@ -102,35 +102,45 @@ class IFX_Font {
#endif
};
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-typedef struct _FX_FONTMATCHPARAMS {
+struct FX_FONTMATCHPARAMS {
const FX_WCHAR* pwsFamily;
FX_DWORD dwFontStyles;
FX_DWORD dwUSB;
FX_DWORD dwMatchFlags;
FX_WCHAR wUnicode;
FX_WORD wCodePage;
-} FX_FONTMATCHPARAMS, *FX_LPFONTMATCHPARAMS;
+} FX_FONTMATCHPARAMS;
+typedef FX_FONTMATCHPARAMS* FX_LPFONTMATCHPARAMS;
typedef FX_FONTMATCHPARAMS const* FX_LPCFONTMATCHPARAMS;
-typedef struct _FX_FONTSIGNATURE : public CFX_Target {
+
+struct FX_FONTSIGNATURE {
FX_DWORD fsUsb[4];
FX_DWORD fsCsb[2];
-} FX_FONTSIGNATURE;
-typedef struct _FX_FONTDESCRIPTOR : public CFX_Target {
+};
+inline bool operator==(const FX_FONTSIGNATURE& left,
+ const FX_FONTSIGNATURE& right) {
+ return left.fsUsb[0] == right.fsUsb[0] && left.fsUsb[1] == right.fsUsb[1] &&
+ left.fsUsb[2] == right.fsUsb[2] && left.fsUsb[3] == right.fsUsb[3] &&
+ left.fsCsb[0] == right.fsCsb[0] && left.fsCsb[1] == right.fsCsb[1];
+}
+
+struct FX_FONTDESCRIPTOR {
FX_WCHAR wsFontFace[32];
FX_DWORD dwFontStyles;
uint8_t uCharSet;
FX_FONTSIGNATURE FontSignature;
-} FX_FONTDESCRIPTOR, *FX_LPFONTDESCRIPTOR;
+};
+typedef FX_FONTDESCRIPTOR* FX_LPFONTDESCRIPTOR;
typedef FX_FONTDESCRIPTOR const* FX_LPCFONTDESCRIPTOR;
typedef CFX_MassArrayTemplate<FX_FONTDESCRIPTOR> CFX_FontDescriptors;
inline bool operator==(const FX_FONTDESCRIPTOR& left,
const FX_FONTDESCRIPTOR& right) {
return left.uCharSet == right.uCharSet &&
left.dwFontStyles == right.dwFontStyles &&
- FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0 &&
- FXSYS_memcmp(&left.FontSignature, &right.FontSignature,
- sizeof(FX_FONTSIGNATURE)) == 0;
+ left.FontSignature == right.FontSignature &&
+ FXSYS_wcscmp(left.wsFontFace, right.wsFontFace) == 0;
}
+
#define FX_FONTMATCHPARA_MacthStyle 0x01
#define FX_FONTMATCHPARA_MacthFamily 0x02
#define FX_FONTMATCHPARA_MacthUnicode 0x04