summaryrefslogtreecommitdiff
path: root/xfa/fgas/crt
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-21 15:00:20 -0700
committerTom Sepez <tsepez@chromium.org>2016-03-21 15:00:20 -0700
commit62a70f90c49cf7714c960186eb063ad55333e6f3 (patch)
tree84b5d0f70b770e6a9ec261342d46638f4d5102bd /xfa/fgas/crt
parent4161c5ca6c5438476bf07b6dacfafb61ea611cc5 (diff)
downloadpdfium-62a70f90c49cf7714c960186eb063ad55333e6f3.tar.xz
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 .
Diffstat (limited to 'xfa/fgas/crt')
-rw-r--r--xfa/fgas/crt/fgas_codepage.cpp12
-rw-r--r--xfa/fgas/crt/fgas_codepage.h16
-rw-r--r--xfa/fgas/crt/fgas_encode.cpp28
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp20
-rw-r--r--xfa/fgas/crt/fgas_stream.h4
-rw-r--r--xfa/fgas/crt/fgas_utils.h8
6 files changed, 44 insertions, 44 deletions
diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp
index e717873abe..dcf3dfa690 100644
--- a/xfa/fgas/crt/fgas_codepage.cpp
+++ b/xfa/fgas/crt/fgas_codepage.cpp
@@ -17,7 +17,7 @@ static const FX_CHARSET_MAP g_FXCharset2CodePageTable[] = {
{186, 1257}, {204, 1251}, {222, 874}, {238, 1250}, {254, 437},
{255, 850},
};
-FX_WORD FX_GetCodePageFromCharset(uint8_t charset) {
+uint16_t FX_GetCodePageFromCharset(uint8_t charset) {
int32_t iEnd = sizeof(g_FXCharset2CodePageTable) / sizeof(FX_CHARSET_MAP) - 1;
FXSYS_assert(iEnd >= 0);
int32_t iStart = 0, iMid;
@@ -43,7 +43,7 @@ static const FX_CHARSET_MAP g_FXCodepage2CharsetTable[] = {
{84, 10004}, {85, 10006}, {86, 10081}, {87, 10021}, {88, 10029},
{89, 10007},
};
-FX_WORD FX_GetCharsetFromCodePage(FX_WORD codepage) {
+uint16_t FX_GetCharsetFromCodePage(uint16_t codepage) {
int32_t iEnd = sizeof(g_FXCodepage2CharsetTable) / sizeof(FX_CHARSET_MAP) - 1;
FXSYS_assert(iEnd >= 0);
int32_t iStart = 0, iMid;
@@ -197,7 +197,7 @@ const FX_LANG2CPMAP g_FXLang2CodepageTable[] = {
{FX_LANG_Spanish_Nicaragua, FX_CODEPAGE_MSWin_WesternEuropean},
{FX_LANG_Spanish_PuertoRico, FX_CODEPAGE_MSWin_WesternEuropean},
};
-FX_WORD FX_GetDefCodePageByLanguage(FX_WORD wLanguage) {
+uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage) {
int32_t iEnd = sizeof(g_FXLang2CodepageTable) / sizeof(FX_LANG2CPMAP) - 1;
FXSYS_assert(iEnd >= 0);
int32_t iStart = 0, iMid;
@@ -301,7 +301,7 @@ static const FX_STR2CPHASH g_FXCPHashTable[] = {
{0xf3d463c2, 0x3a4}, {0xf52a70a3, 0xc42e}, {0xf5693147, 0x6fb3},
{0xf637e157, 0x478}, {0xfc213f3a, 0x2717}, {0xff654d14, 0x3b5},
};
-FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
+uint16_t FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
FXSYS_assert(pStr != NULL);
if (iLength < 0) {
iLength = FXSYS_strlen(pStr);
@@ -317,7 +317,7 @@ FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
iMid = (iStart + iEnd) / 2;
const FX_STR2CPHASH& cp = g_FXCPHashTable[iMid];
if (uHash == cp.uHash) {
- return (FX_WORD)cp.uCodePage;
+ return (uint16_t)cp.uCodePage;
} else if (uHash < cp.uHash) {
iEnd = iMid - 1;
} else {
@@ -326,7 +326,7 @@ FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength) {
} while (iStart <= iEnd);
return 0xFFFF;
}
-FX_WORD FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) {
+uint16_t FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) {
if (iLength < 0) {
iLength = FXSYS_wcslen(pStr);
}
diff --git a/xfa/fgas/crt/fgas_codepage.h b/xfa/fgas/crt/fgas_codepage.h
index ec01816386..fe69f7ce93 100644
--- a/xfa/fgas/crt/fgas_codepage.h
+++ b/xfa/fgas/crt/fgas_codepage.h
@@ -133,24 +133,24 @@
#define FX_CHARSET_US 254
#define FX_CHARSET_OEM 255
-FX_WORD FX_GetCodePageFromCharset(uint8_t charset);
-FX_WORD FX_GetCharsetFromCodePage(FX_WORD codepage);
-FX_WORD FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength);
-FX_WORD FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength);
-FX_WORD FX_GetDefCodePageByLanguage(FX_WORD wLanguage);
+uint16_t FX_GetCodePageFromCharset(uint8_t charset);
+uint16_t FX_GetCharsetFromCodePage(uint16_t codepage);
+uint16_t FX_GetCodePageFromStringA(const FX_CHAR* pStr, int32_t iLength);
+uint16_t FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength);
+uint16_t FX_GetDefCodePageByLanguage(uint16_t wLanguage);
void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength);
void FX_SwapByteOrderCopy(const FX_WCHAR* pSrc,
FX_WCHAR* pDst,
int32_t iLength);
void FX_UTF16ToWChar(void* pBuffer, int32_t iLength);
-void FX_UTF16ToWCharCopy(const FX_WORD* pUTF16,
+void FX_UTF16ToWCharCopy(const uint16_t* pUTF16,
FX_WCHAR* pWChar,
int32_t iLength);
void FX_WCharToUTF16(void* pBuffer, int32_t iLength);
void FX_WCharToUTF16Copy(const FX_WCHAR* pWChar,
- FX_WORD* pUTF16,
+ uint16_t* pUTF16,
int32_t iLength);
-int32_t FX_DecodeString(FX_WORD wCodePage,
+int32_t FX_DecodeString(uint16_t wCodePage,
const FX_CHAR* pSrc,
int32_t* pSrcLen,
FX_WCHAR* pDst,
diff --git a/xfa/fgas/crt/fgas_encode.cpp b/xfa/fgas/crt/fgas_encode.cpp
index 138b4b1f5e..7d04e58131 100644
--- a/xfa/fgas/crt/fgas_encode.cpp
+++ b/xfa/fgas/crt/fgas_encode.cpp
@@ -11,17 +11,17 @@ void FX_SwapByteOrder(FX_WCHAR* pStr, int32_t iLength) {
if (iLength < 0) {
iLength = FXSYS_wcslen(pStr);
}
- FX_WORD wch;
+ uint16_t wch;
if (sizeof(FX_WCHAR) > 2) {
while (iLength-- > 0) {
- wch = (FX_WORD)*pStr;
+ wch = (uint16_t)*pStr;
wch = (wch >> 8) | (wch << 8);
wch &= 0x00FF;
*pStr++ = wch;
}
} else {
while (iLength-- > 0) {
- wch = (FX_WORD)*pStr;
+ wch = (uint16_t)*pStr;
wch = (wch >> 8) | (wch << 8);
*pStr++ = wch;
}
@@ -34,17 +34,17 @@ void FX_SwapByteOrderCopy(const FX_WCHAR* pSrc,
if (iLength < 0) {
iLength = FXSYS_wcslen(pSrc);
}
- FX_WORD wch;
+ uint16_t wch;
if (sizeof(FX_WCHAR) > 2) {
while (iLength-- > 0) {
- wch = (FX_WORD)*pSrc++;
+ wch = (uint16_t)*pSrc++;
wch = (wch >> 8) | (wch << 8);
wch &= 0x00FF;
*pDst++ = wch;
}
} else {
while (iLength-- > 0) {
- wch = (FX_WORD)*pSrc++;
+ wch = (uint16_t)*pSrc++;
wch = (wch >> 8) | (wch << 8);
*pDst++ = wch;
}
@@ -55,13 +55,13 @@ void FX_UTF16ToWChar(void* pBuffer, int32_t iLength) {
if (sizeof(FX_WCHAR) == 2) {
return;
}
- FX_WORD* pSrc = (FX_WORD*)pBuffer;
+ uint16_t* pSrc = (uint16_t*)pBuffer;
FX_WCHAR* pDst = (FX_WCHAR*)pBuffer;
while (--iLength >= 0) {
pDst[iLength] = (FX_WCHAR)pSrc[iLength];
}
}
-void FX_UTF16ToWCharCopy(const FX_WORD* pUTF16,
+void FX_UTF16ToWCharCopy(const uint16_t* pUTF16,
FX_WCHAR* pWChar,
int32_t iLength) {
FXSYS_assert(pUTF16 != NULL && pWChar != NULL && iLength > 0);
@@ -79,30 +79,30 @@ void FX_WCharToUTF16(void* pBuffer, int32_t iLength) {
return;
}
const FX_WCHAR* pSrc = (const FX_WCHAR*)pBuffer;
- FX_WORD* pDst = (FX_WORD*)pBuffer;
+ uint16_t* pDst = (uint16_t*)pBuffer;
while (--iLength >= 0) {
- *pDst++ = (FX_WORD)*pSrc++;
+ *pDst++ = (uint16_t)*pSrc++;
}
}
void FX_WCharToUTF16Copy(const FX_WCHAR* pWChar,
- FX_WORD* pUTF16,
+ uint16_t* pUTF16,
int32_t iLength) {
FXSYS_assert(pWChar != NULL && pUTF16 != NULL && iLength > 0);
if (sizeof(FX_WCHAR) == 2) {
FXSYS_memcpy(pUTF16, pWChar, iLength * sizeof(FX_WCHAR));
} else {
while (--iLength >= 0) {
- *pUTF16++ = (FX_WORD)*pWChar++;
+ *pUTF16++ = (uint16_t)*pWChar++;
}
}
}
inline FX_DWORD FX_DWordFromBytes(const uint8_t* pStr) {
return FXBSTR_ID(pStr[3], pStr[2], pStr[1], pStr[0]);
}
-inline FX_WORD FX_WordFromBytes(const uint8_t* pStr) {
+inline uint16_t FX_WordFromBytes(const uint8_t* pStr) {
return (pStr[1] << 8 | pStr[0]);
}
-int32_t FX_DecodeString(FX_WORD wCodePage,
+int32_t FX_DecodeString(uint16_t wCodePage,
const FX_CHAR* pSrc,
int32_t* pSrcLen,
FX_WCHAR* pDst,
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 6f082dd5f1..4dc3737d75 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -201,8 +201,8 @@ class CFX_Stream : public IFX_Stream {
virtual void Flush();
virtual FX_BOOL SetLength(int32_t iLength);
virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual FX_WORD GetCodePage() const;
- virtual FX_WORD SetCodePage(FX_WORD wCodePage);
+ virtual uint16_t GetCodePage() const;
+ virtual uint16_t SetCodePage(uint16_t wCodePage);
virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess,
int32_t iOffset,
int32_t iLength);
@@ -242,15 +242,15 @@ class CFX_TextStream : public IFX_Stream {
virtual FX_BOOL SetLength(int32_t iLength);
virtual int32_t GetBOM(uint8_t bom[4]) const;
- virtual FX_WORD GetCodePage() const;
- virtual FX_WORD SetCodePage(FX_WORD wCodePage);
+ virtual uint16_t GetCodePage() const;
+ virtual uint16_t SetCodePage(uint16_t wCodePage);
virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess,
int32_t iOffset,
int32_t iLength);
protected:
- FX_WORD m_wCodePage;
+ uint16_t m_wCodePage;
int32_t m_wBOMLength;
FX_DWORD m_dwBOM;
uint8_t* m_pBuf;
@@ -1015,7 +1015,7 @@ void CFX_TextStream::Flush() {
FX_BOOL CFX_TextStream::SetLength(int32_t iLength) {
return m_pStreamImp->SetLength(iLength);
}
-FX_WORD CFX_TextStream::GetCodePage() const {
+uint16_t CFX_TextStream::GetCodePage() const {
return m_wCodePage;
}
IFX_Stream* CFX_TextStream::CreateSharedStream(FX_DWORD dwAccess,
@@ -1038,11 +1038,11 @@ int32_t CFX_TextStream::GetBOM(uint8_t bom[4]) const {
*(FX_DWORD*)bom = m_dwBOM;
return m_wBOMLength;
}
-FX_WORD CFX_TextStream::SetCodePage(FX_WORD wCodePage) {
+uint16_t CFX_TextStream::SetCodePage(uint16_t wCodePage) {
if (m_wBOMLength > 0) {
return m_wCodePage;
}
- FX_WORD v = m_wCodePage;
+ uint16_t v = m_wCodePage;
m_wCodePage = wCodePage;
return v;
}
@@ -1421,14 +1421,14 @@ int32_t CFX_Stream::GetBOM(uint8_t bom[4]) const {
}
return 0;
}
-FX_WORD CFX_Stream::GetCodePage() const {
+uint16_t CFX_Stream::GetCodePage() const {
#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
return FX_CODEPAGE_UTF16LE;
#else
return FX_CODEPAGE_UTF16BE;
#endif
}
-FX_WORD CFX_Stream::SetCodePage(FX_WORD wCodePage) {
+uint16_t CFX_Stream::SetCodePage(uint16_t wCodePage) {
#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
return FX_CODEPAGE_UTF16LE;
#else
diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h
index e083886ec7..94b7f01ed6 100644
--- a/xfa/fgas/crt/fgas_stream.h
+++ b/xfa/fgas/crt/fgas_stream.h
@@ -68,8 +68,8 @@ class IFX_Stream {
virtual void Flush() = 0;
virtual FX_BOOL SetLength(int32_t iLength) = 0;
virtual int32_t GetBOM(uint8_t bom[4]) const = 0;
- virtual FX_WORD GetCodePage() const = 0;
- virtual FX_WORD SetCodePage(FX_WORD wCodePage) = 0;
+ virtual uint16_t GetCodePage() const = 0;
+ virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess,
int32_t iOffset,
int32_t iLength) = 0;
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index f03e3983fa..1138cfd7c9 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -85,7 +85,7 @@ class CFX_BaseArrayTemplate : public CFX_BaseArray {
};
typedef CFX_BaseArrayTemplate<void*> CFDE_PtrArray;
typedef CFX_BaseArrayTemplate<FX_DWORD> CFDE_DWordArray;
-typedef CFX_BaseArrayTemplate<FX_WORD> CFDE_WordArray;
+typedef CFX_BaseArrayTemplate<uint16_t> CFDE_WordArray;
template <class baseType>
class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray {
@@ -282,7 +282,7 @@ class CFX_MassArrayTemplate : public CFX_BaseMassArray {
typedef CFX_MassArrayTemplate<void*> CFX_PtrMassArray;
typedef CFX_MassArrayTemplate<int32_t> CFX_Int32MassArray;
typedef CFX_MassArrayTemplate<FX_DWORD> CFX_DWordMassArray;
-typedef CFX_MassArrayTemplate<FX_WORD> CFX_WordMassArray;
+typedef CFX_MassArrayTemplate<uint16_t> CFX_WordMassArray;
typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray;
typedef CFX_MassArrayTemplate<CFX_RectF> CFX_RectFMassArray;
@@ -397,7 +397,7 @@ class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray {
};
typedef CFX_DiscreteArrayTemplate<void*> CFX_PtrDiscreteArray;
typedef CFX_DiscreteArrayTemplate<FX_DWORD> CFX_DWordDiscreteArray;
-typedef CFX_DiscreteArrayTemplate<FX_WORD> CFX_WordDiscreteArray;
+typedef CFX_DiscreteArrayTemplate<uint16_t> CFX_WordDiscreteArray;
class CFX_BaseStack : public CFX_Target {
protected:
@@ -436,7 +436,7 @@ class CFX_StackTemplate : public CFX_BaseStack {
};
typedef CFX_StackTemplate<void*> CFX_PtrStack;
typedef CFX_StackTemplate<FX_DWORD> CFX_DWordStack;
-typedef CFX_StackTemplate<FX_WORD> CFX_WordStack;
+typedef CFX_StackTemplate<uint16_t> CFX_WordStack;
typedef CFX_StackTemplate<int32_t> CFX_Int32Stack;
template <class baseType>