From 62a70f90c49cf7714c960186eb063ad55333e6f3 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 21 Mar 2016 15:00:20 -0700 Subject: Remove FX_WORD in favor of uint16_t. It isn't buying us anthing, and it looks strange in a struct when other uint types are already present. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1821043003 . --- core/include/fpdfapi/fpdf_resource.h | 20 ++++++++++---------- core/include/fpdfdoc/fpdf_ap.h | 8 ++++---- core/include/fpdfdoc/fpdf_vt.h | 14 +++++++------- core/include/fxcodec/fx_codec.h | 2 +- core/include/fxcrt/fx_basic.h | 5 ++--- core/include/fxcrt/fx_ext.h | 4 ++-- core/include/fxcrt/fx_string.h | 2 +- core/include/fxcrt/fx_system.h | 5 ++--- core/include/fxcrt/fx_ucd.h | 4 ++-- 9 files changed, 31 insertions(+), 33 deletions(-) (limited to 'core/include') diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index a8a3ecc52a..1ae0030df8 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -47,7 +47,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); -const FX_WORD* PDF_UnicodesForPredefinedCharSet(int encoding); +const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); @@ -243,11 +243,11 @@ class CPDF_SimpleFont : public CPDF_Font { void LoadCharMetrics(int charcode); CPDF_FontEncoding m_Encoding; - FX_WORD m_GlyphIndex[256]; - FX_WORD m_ExtGID[256]; + uint16_t m_GlyphIndex[256]; + uint16_t m_ExtGID[256]; CFX_ByteString* m_pCharNames; int m_BaseEncoding; - FX_WORD m_CharWidth[256]; + uint16_t m_CharWidth[256]; FX_SMALL_RECT m_CharBBox[256]; FX_BOOL m_bUseFontWidth; }; @@ -381,10 +381,10 @@ class CPDF_CIDFont : public CPDF_Font { FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override; FX_BOOL LoadGB2312(); - FX_WORD CIDFromCharCode(FX_DWORD charcode) const; - const uint8_t* GetCIDTransform(FX_WORD CID) const; - short GetVertWidth(FX_WORD CID) const; - void GetVertOrigin(FX_WORD CID, short& vx, short& vy) const; + uint16_t CIDFromCharCode(FX_DWORD charcode) const; + const uint8_t* GetCIDTransform(uint16_t CID) const; + short GetVertWidth(uint16_t CID) const; + void GetVertOrigin(uint16_t CID, short& vx, short& vy) const; virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; protected: @@ -402,8 +402,8 @@ class CPDF_CIDFont : public CPDF_Font { FX_BOOL m_bType1; CPDF_StreamAcc* m_pCIDToGIDMap; FX_BOOL m_bCIDIsGID; - FX_WORD m_DefaultWidth; - FX_WORD* m_pAnsiWidths; + uint16_t m_DefaultWidth; + uint16_t* m_pAnsiWidths; FX_SMALL_RECT m_CharBBox[256]; CFX_DWordArray m_WidthList; short m_DefaultVY; diff --git a/core/include/fpdfdoc/fpdf_ap.h b/core/include/fpdfdoc/fpdf_ap.h index 62e3907593..b468d14d20 100644 --- a/core/include/fpdfdoc/fpdf_ap.h +++ b/core/include/fpdfdoc/fpdf_ap.h @@ -53,14 +53,14 @@ class CPVT_Provider : public IPDF_VariableText_Provider { // IPDF_VariableText_Provider int32_t GetCharWidth(int32_t nFontIndex, - FX_WORD word, + uint16_t word, int32_t nWordStyle) override; int32_t GetTypeAscent(int32_t nFontIndex) override; int32_t GetTypeDescent(int32_t nFontIndex) override; - int32_t GetWordFontIndex(FX_WORD word, + int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex) override; - FX_BOOL IsLatinWord(FX_WORD word) override; + FX_BOOL IsLatinWord(uint16_t word) override; int32_t GetDefaultFontIndex() override; private: @@ -82,7 +82,7 @@ class CPVT_GenerateAP { IPDF_VariableText_Iterator* pIterator, const CFX_FloatPoint& ptOffset, FX_BOOL bContinuous, - FX_WORD SubWord = 0, + uint16_t SubWord = 0, const CPVT_WordRange* pVisible = NULL); static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect, diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h index dd2e300162..d79cad42d6 100644 --- a/core/include/fpdfdoc/fpdf_vt.h +++ b/core/include/fpdfdoc/fpdf_vt.h @@ -216,7 +216,7 @@ struct CPVT_Word { fFontSize(0), WordProps() {} - FX_WORD Word; + uint16_t Word; int32_t nCharset; @@ -266,18 +266,18 @@ class IPDF_VariableText_Provider { virtual ~IPDF_VariableText_Provider() {} virtual int32_t GetCharWidth(int32_t nFontIndex, - FX_WORD word, + uint16_t word, int32_t nWordStyle) = 0; virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0; virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0; - virtual int32_t GetWordFontIndex(FX_WORD word, + virtual int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex) = 0; - virtual FX_BOOL IsLatinWord(FX_WORD word) = 0; + virtual FX_BOOL IsLatinWord(uint16_t word) = 0; virtual int32_t GetDefaultFontIndex() = 0; }; @@ -328,7 +328,7 @@ class IPDF_VariableText { virtual void SetAlignment(int32_t nFormat = 0) = 0; - virtual void SetPasswordChar(FX_WORD wSubWord = '*') = 0; + virtual void SetPasswordChar(uint16_t wSubWord = '*') = 0; virtual void SetLimitChar(int32_t nLimitChar = 0) = 0; @@ -369,7 +369,7 @@ class IPDF_VariableText { virtual CPVT_WordPlace InsertWord( const CPVT_WordPlace& place, - FX_WORD word, + uint16_t word, int32_t charset = 1, const CPVT_WordProps* pWordProps = NULL) = 0; @@ -401,7 +401,7 @@ class IPDF_VariableText { virtual int32_t GetAlignment() const = 0; - virtual FX_WORD GetPasswordChar() const = 0; + virtual uint16_t GetPasswordChar() const = 0; virtual int32_t GetCharArray() const = 0; diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 183783d86c..bce7e49a1f 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -46,7 +46,7 @@ class CFX_DIBAttribute { int32_t m_nXDPI; int32_t m_nYDPI; FX_FLOAT m_fAspectRatio; - FX_WORD m_wDPIUnit; + uint16_t m_wDPIUnit; CFX_ByteString m_strAuthor; uint8_t m_strTime[20]; int32_t m_nGifLeft; diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index 11c573be6e..277286c80c 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -205,10 +205,10 @@ class CFX_FileBufferArchive { class CFX_CharMap { public: - static CFX_ByteString GetByteString(FX_WORD codepage, + static CFX_ByteString GetByteString(uint16_t codepage, const CFX_WideString& wstr); - static CFX_WideString GetWideString(FX_WORD codepage, + static CFX_WideString GetWideString(uint16_t codepage, const CFX_ByteString& bstr); CFX_CharMap() = delete; @@ -402,7 +402,6 @@ typedef CFX_ArrayTemplate CFX_DWordArray; #ifdef PDF_ENABLE_XFA typedef CFX_ArrayTemplate CFX_WideStringCArray; -typedef CFX_ArrayTemplate CFX_WordArray; typedef CFX_ArrayTemplate CFX_FloatArray; typedef CFX_ArrayTemplate CFX_ByteArray; typedef CFX_ArrayTemplate CFX_Int32Array; diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 0deb4266c8..08f735b910 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -97,8 +97,8 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); #ifdef PDF_ENABLE_XFA typedef struct FX_GUID { FX_DWORD data1; - FX_WORD data2; - FX_WORD data3; + uint16_t data2; + uint16_t data3; uint8_t data4[8]; } FX_GUID, *FX_LPGUID; typedef FX_GUID const* FX_LPCGUID; diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 9b623b9e71..afaf94b538 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -569,7 +569,7 @@ class CFX_WideString { static CFX_WideString FromLocal(const CFX_ByteString& str); static CFX_WideString FromCodePage(const CFX_ByteString& str, - FX_WORD codepage); + uint16_t codepage); static CFX_WideString FromUTF8(const char* str, FX_STRSIZE len); diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index f62e126fbb..770b1e7b2f 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -68,7 +68,6 @@ extern "C" { #endif typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef uint16_t FX_WORD; // Keep - "an efficient small type" typedef uint32_t FX_DWORD; // Keep - "an efficient type" typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef double FX_DOUBLE; // Keep, allow downgrade to floats. @@ -266,8 +265,8 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); (static_cast(p[2]) << 8) | (static_cast(p[3]))) #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) #define FXSYS_LOBYTE(word) ((uint8_t)(word)) -#define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) -#define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) +#define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16)) +#define FXSYS_LOWORD(dword) ((uint16_t)(dword)) int32_t FXSYS_atoi(const FX_CHAR* str); uint32_t FXSYS_atoui(const FX_CHAR* str); int32_t FXSYS_wtoi(const FX_WCHAR* str); diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h index 969f116d60..de7feccf58 100644 --- a/core/include/fxcrt/fx_ucd.h +++ b/core/include/fxcrt/fx_ucd.h @@ -124,7 +124,7 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - CFX_Char(FX_WORD wCharCode, FX_DWORD dwCharProps) + CFX_Char(uint16_t wCharCode, FX_DWORD dwCharProps) : m_wCharCode(wCharCode), m_nBreakType(0), m_nRotation(0), @@ -134,7 +134,7 @@ class CFX_Char { m_iHorizontalScale(100), m_iVertialScale(100) {} FX_DWORD GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } - FX_WORD m_wCharCode; + uint16_t m_wCharCode; uint8_t m_nBreakType; int8_t m_nRotation; FX_DWORD m_dwCharProps; -- cgit v1.2.3