summaryrefslogtreecommitdiff
path: root/xfa/src/fgas
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fgas')
-rw-r--r--xfa/src/fgas/include/fx_cpg.h52
-rw-r--r--xfa/src/fgas/include/fx_datetime.h50
-rw-r--r--xfa/src/fgas/include/fx_rbk.h14
-rw-r--r--xfa/src/fgas/include/fx_tbk.h14
-rw-r--r--xfa/src/fgas/include/fx_ucd.h9
-rw-r--r--xfa/src/fgas/src/crt/fx_algorithm.cpp7
-rw-r--r--xfa/src/fgas/src/crt/fx_memory.cpp65
-rw-r--r--xfa/src/fgas/src/crt/fx_memory.h71
-rw-r--r--xfa/src/fgas/src/crt/fx_utils.cpp19
-rw-r--r--xfa/src/fgas/src/layout/fx_rtfbreak.cpp4
-rw-r--r--xfa/src/fgas/src/layout/fx_rtfbreak.h4
-rw-r--r--xfa/src/fgas/src/layout/fx_textbreak.cpp4
-rw-r--r--xfa/src/fgas/src/layout/fx_textbreak.h4
-rw-r--r--xfa/src/fgas/src/layout/fx_unicode.cpp4
14 files changed, 171 insertions, 150 deletions
diff --git a/xfa/src/fgas/include/fx_cpg.h b/xfa/src/fgas/include/fx_cpg.h
index 970066156a..0652411779 100644
--- a/xfa/src/fgas/include/fx_cpg.h
+++ b/xfa/src/fgas/include/fx_cpg.h
@@ -164,7 +164,8 @@ enum FX_CODESYSTEM {
FX_SBCS,
FX_DBCS,
};
-typedef struct _FX_CODEPAGE_HEADER {
+
+struct FX_CODEPAGE_HEADER {
uint16_t uCPID;
uint8_t uMinCharBytes;
uint8_t uMaxCharBytes;
@@ -176,54 +177,63 @@ typedef struct _FX_CODEPAGE_HEADER {
FX_WCHAR wMinUnicode;
FX_WCHAR wMaxUnicode;
FX_WCHAR wDefUnicode;
-} FX_CODEPAGE_HEADER;
+};
+
#define FX_CPMAPTYPE_Consecution 1
#define FX_CPMAPTYPE_Strict 2
#define FX_CPMAPTYPE_NoMapping 3
#define FX_CPMAPTYPE_Delta 4
-typedef struct _FX_CPCU_MAPTABLE1 {
+
+struct FX_CPCU_MAPTABLE1 {
uint16_t uMapType;
uint16_t uUniocde;
-} FX_CPCU_MAPTABLE1;
-typedef struct _FX_CPCU_MAPTABLE2 {
+};
+
+struct FX_CPCU_MAPTABLE2 {
uint8_t uTrailByte;
uint8_t uMapType;
uint16_t uOffset;
-} FX_CPCU_MAPTABLE2;
-typedef struct _FX_CPCU_MAPINFO {
+};
+
+struct FX_CPCU_MAPINFO {
FX_CPCU_MAPTABLE1* pMapTable1;
FX_CPCU_MAPTABLE2* pMapTable2;
const uint8_t* pMapData;
-} FX_CPCU_MAPINFO;
-typedef struct _FX_CPUC_MAPTABLE {
+};
+
+struct FX_CPUC_MAPTABLE {
uint16_t uStartUnicode;
uint16_t uEndUnicode;
uint16_t uMapType;
uint16_t uOffset;
-} FX_CPUC_MAPTABLE;
-typedef struct _FX_CPUC_MAPINFO {
+};
+
+struct FX_CPUC_MAPINFO {
uint32_t uMapCount;
FX_CPUC_MAPTABLE* pMapTable;
const uint8_t* pMapData;
-} FX_CPUC_MAPINFO;
-typedef struct _FX_CODEPAGE {
+};
+
+struct FX_CODEPAGE {
FX_CODEPAGE_HEADER const* pCPHeader;
FX_CPCU_MAPINFO const* pCPCUMapInfo;
FX_CPUC_MAPINFO const* pCPUCMapInfo;
-} FX_CODEPAGE, *FX_LPCODEPAGE;
-typedef FX_CODEPAGE const* FX_LPCCODEPAGE;
-typedef struct _FX_STR2CPHASH {
+};
+
+struct FX_STR2CPHASH {
uint32_t uHash;
uint32_t uCodePage;
-} FX_STR2CPHASH;
-typedef struct _FX_CHARSET_MAP {
+};
+
+struct FX_CHARSET_MAP {
uint16_t charset;
uint16_t codepage;
-} FX_CHARSET_MAP;
-typedef struct _FX_LANG2CPMAP {
+};
+
+struct FX_LANG2CPMAP {
FX_WORD wLanguage;
FX_WORD wCodepage;
-} FX_LANG2CPMAP;
+};
class IFX_CodePage {
public:
diff --git a/xfa/src/fgas/include/fx_datetime.h b/xfa/src/fgas/include/fx_datetime.h
index f5bbee7f81..99d1561b50 100644
--- a/xfa/src/fgas/include/fx_datetime.h
+++ b/xfa/src/fgas/include/fx_datetime.h
@@ -161,25 +161,25 @@ class CFX_Unitime {
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(push, 1)
#endif
-typedef struct _FX_DATE {
+struct FX_DATE {
int32_t year;
uint8_t month;
uint8_t day;
-} FX_DATE, *FX_LPDATE;
-typedef FX_DATE const* FX_LPCDATE;
-typedef struct _FX_TIME {
+};
+
+struct FX_TIME {
uint8_t hour;
uint8_t minute;
uint8_t second;
FX_WORD millisecond;
-} FX_TIME, *FX_LPTIME;
-typedef FX_TIME const* FX_LPCTIME;
-typedef struct _FX_TIMEZONE {
+};
+
+struct FX_TIMEZONE {
int8_t tzHour;
uint8_t tzMinute;
-} FX_TIMEZONE, *FX_LPTIMEZONE;
-typedef FX_TIMEZONE const* FX_LPCTIMEZONE;
-typedef struct _FX_DATETIME {
+};
+
+struct FX_DATETIME {
union {
struct {
int32_t year;
@@ -197,9 +197,9 @@ typedef struct _FX_DATETIME {
} sTime;
FX_TIME aTime;
} Time;
-} FX_DATETIME, *FX_LPDATETIME;
-typedef FX_DATETIME const* FX_LPCDATETIME;
-typedef struct _FX_DATETIMEZONE {
+};
+
+struct FX_DATETIMEZONE {
union {
struct {
union {
@@ -229,11 +229,11 @@ typedef struct _FX_DATETIMEZONE {
};
FX_TIMEZONE tz;
};
-} FX_DATETIMEZONE, *FX_LPDATETIMEZONE;
-typedef FX_DATETIMEZONE const* FX_LPCDATETIMEZONE;
+};
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(pop)
#endif
+
class CFX_DateTime {
public:
CFX_DateTime() {}
@@ -241,7 +241,7 @@ class CFX_DateTime {
CFX_DateTime(const CFX_DateTime& dt) { m_DateTime = dt.m_DateTime; }
virtual ~CFX_DateTime() {}
operator FX_DATETIME*() { return &m_DateTime; }
- operator FX_DATETIME const*() const { return &m_DateTime; }
+ operator const FX_DATETIME*() const { return &m_DateTime; }
operator FX_DATETIME&() { return m_DateTime; }
operator const FX_DATETIME&() const { return m_DateTime; }
CFX_DateTime& operator=(const CFX_DateTime& dt) {
@@ -331,24 +331,30 @@ class CFX_DateTime {
return dt;
}
friend FX_BOOL operator==(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp((FX_LPCDATETIME)dt1, (FX_LPCDATETIME)dt2,
+ return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
+ static_cast<const FX_DATETIME*>(dt2),
sizeof(FX_DATETIME)) == 0;
}
friend FX_BOOL operator==(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp((FX_LPCDATETIME)dt1, &dt2, sizeof(FX_DATETIME)) == 0;
+ return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
+ sizeof(FX_DATETIME)) == 0;
}
friend FX_BOOL operator==(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, (FX_LPCDATETIME)dt2, sizeof(FX_DATETIME)) == 0;
+ return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
+ sizeof(FX_DATETIME)) == 0;
}
friend FX_BOOL operator!=(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp((FX_LPCDATETIME)dt1, (FX_LPCDATETIME)dt2,
+ return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1),
+ static_cast<const FX_DATETIME*>(dt2),
sizeof(FX_DATETIME)) != 0;
}
friend FX_BOOL operator!=(const CFX_DateTime& dt1, const FX_DATETIME& dt2) {
- return FXSYS_memcmp((FX_LPCDATETIME)dt1, &dt2, sizeof(FX_DATETIME)) != 0;
+ return FXSYS_memcmp(static_cast<const FX_DATETIME*>(dt1), &dt2,
+ sizeof(FX_DATETIME)) != 0;
}
friend FX_BOOL operator!=(const FX_DATETIME& dt1, const CFX_DateTime& dt2) {
- return FXSYS_memcmp(&dt1, (FX_LPCDATETIME)dt2, sizeof(FX_DATETIME)) != 0;
+ return FXSYS_memcmp(&dt1, static_cast<const FX_DATETIME*>(dt2),
+ sizeof(FX_DATETIME)) != 0;
}
friend FX_BOOL operator>(const CFX_DateTime& dt1, const CFX_DateTime& dt2) {
return dt1.ToUnitime() > dt2.ToUnitime();
diff --git a/xfa/src/fgas/include/fx_rbk.h b/xfa/src/fgas/include/fx_rbk.h
index a56040de67..5ce93960c9 100644
--- a/xfa/src/fgas/include/fx_rbk.h
+++ b/xfa/src/fgas/include/fx_rbk.h
@@ -63,8 +63,9 @@ class IFX_RTFBreak;
(FX_RTFLINEALIGNMENT_Right | FX_RTFLINEALIGNMENT_Distributed)
#define FX_RTFLINEALIGNMENT_LowerMask 0x03
#define FX_RTFLINEALIGNMENT_HigherMask 0x0C
-typedef struct _FX_RTFTEXTOBJ {
- _FX_RTFTEXTOBJ() {
+
+struct FX_RTFTEXTOBJ {
+ FX_RTFTEXTOBJ() {
pStr = NULL;
pWidths = NULL;
iLength = 0;
@@ -78,6 +79,7 @@ typedef struct _FX_RTFTEXTOBJ {
iHorizontalScale = 100;
iVerticalScale = 100;
}
+
const FX_WCHAR* pStr;
int32_t* pWidths;
int32_t iLength;
@@ -90,8 +92,8 @@ typedef struct _FX_RTFTEXTOBJ {
FX_WCHAR wLineBreakChar;
int32_t iHorizontalScale;
int32_t iVerticalScale;
-} FX_RTFTEXTOBJ, *FX_LPRTFTEXTOBJ;
-typedef FX_RTFTEXTOBJ const* FX_LPCRTFTEXTOBJ;
+};
+
class CFX_RTFPiece : public CFX_Target {
public:
CFX_RTFPiece()
@@ -221,12 +223,12 @@ class IFX_RTFBreak {
virtual void ClearBreakPieces() = 0;
virtual void Reset() = 0;
virtual int32_t GetDisplayPos(
- FX_LPCRTFTEXTOBJ pText,
+ const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
CFX_WideString* pWSForms = NULL,
FX_AdjustCharDisplayPos pAdjustPos = NULL) const = 0;
- virtual int32_t GetCharRects(FX_LPCRTFTEXTOBJ pText,
+ virtual int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const = 0;
};
diff --git a/xfa/src/fgas/include/fx_tbk.h b/xfa/src/fgas/include/fx_tbk.h
index 5063aec142..073228883d 100644
--- a/xfa/src/fgas/include/fx_tbk.h
+++ b/xfa/src/fgas/include/fx_tbk.h
@@ -77,8 +77,9 @@ class IFX_TxtAccess {
virtual FX_WCHAR GetChar(void* pIdentity, int32_t index) const = 0;
virtual int32_t GetWidth(void* pIdentity, int32_t index) const = 0;
};
-typedef struct _FX_TXTRUN {
- _FX_TXTRUN() {
+
+struct FX_TXTRUN {
+ FX_TXTRUN() {
pAccess = NULL;
pIdentity = NULL;
pStr = NULL;
@@ -95,6 +96,7 @@ typedef struct _FX_TXTRUN {
wLineBreakChar = L'\n';
bSkipSpace = TRUE;
}
+
IFX_TxtAccess* pAccess;
void* pIdentity;
const FX_WCHAR* pStr;
@@ -110,8 +112,8 @@ typedef struct _FX_TXTRUN {
FX_LPCRECTF pRect;
FX_WCHAR wLineBreakChar;
FX_BOOL bSkipSpace;
-} FX_TXTRUN, *FX_LPTXTRUN;
-typedef FX_TXTRUN const* FX_LPCTXTRUN;
+};
+
class CFX_TxtPiece : public CFX_Target {
public:
CFX_TxtPiece()
@@ -206,12 +208,12 @@ class IFX_TxtBreak {
virtual void ClearBreakPieces() = 0;
virtual void Reset() = 0;
virtual int32_t GetDisplayPos(
- FX_LPCTXTRUN pTxtRun,
+ const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
CFX_WideString* pWSForms = NULL,
FX_AdjustCharDisplayPos pAdjustPos = NULL) const = 0;
- virtual int32_t GetCharRects(FX_LPCTXTRUN pTxtRun,
+ virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const = 0;
};
diff --git a/xfa/src/fgas/include/fx_ucd.h b/xfa/src/fgas/include/fx_ucd.h
index 51a0a1f2fc..ae1c882e94 100644
--- a/xfa/src/fgas/include/fx_ucd.h
+++ b/xfa/src/fgas/include/fx_ucd.h
@@ -13,12 +13,13 @@
#define FX_JAPCHARPROPERTYEX_Top 0x10
#define FX_JAPCHARPROPERTYEX_Middle 0x20
#define FX_JAPCHARPROPERTYEX_Bottom 0x30
-typedef struct _FX_JAPCHARPROPERTYEX {
+
+struct FX_JAPCHARPROPERTYEX {
FX_WCHAR wChar;
uint8_t uAlign;
-} FX_JAPCHARPROPERTYEX, *FX_LPJAPCHARPROPERTYEX;
-typedef FX_JAPCHARPROPERTYEX const* FX_LPCJAPCHARPROPERTYEX;
-FX_LPCJAPCHARPROPERTYEX FX_GetJapCharPropertyEx(FX_WCHAR wch);
+};
+
+const FX_JAPCHARPROPERTYEX* FX_GetJapCharPropertyEx(FX_WCHAR wch);
typedef FX_BOOL (*FX_AdjustCharDisplayPos)(FX_WCHAR wch,
FX_BOOL bMBCSCode,
IFX_Font* pFont,
diff --git a/xfa/src/fgas/src/crt/fx_algorithm.cpp b/xfa/src/fgas/src/crt/fx_algorithm.cpp
index 196cb87b21..7a6cae8727 100644
--- a/xfa/src/fgas/src/crt/fx_algorithm.cpp
+++ b/xfa/src/fgas/src/crt/fx_algorithm.cpp
@@ -15,7 +15,8 @@ const static FX_CHAR g_FXBase64EncoderMap[64] = {
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
};
-typedef struct _FX_BASE64DATA {
+
+struct FX_BASE64DATA {
FX_DWORD data1 : 2;
FX_DWORD data2 : 6;
FX_DWORD data3 : 4;
@@ -23,8 +24,8 @@ typedef struct _FX_BASE64DATA {
FX_DWORD data5 : 6;
FX_DWORD data6 : 2;
FX_DWORD data7 : 8;
-} FX_BASE64DATA, *FX_LPBASE64ENCODEDATA;
-typedef FX_BASE64DATA const* FX_LPCBASE64DATA;
+};
+
static void FX_Base64EncodePiece(const FX_BASE64DATA& src,
int32_t iBytes,
FX_CHAR dst[4]) {
diff --git a/xfa/src/fgas/src/crt/fx_memory.cpp b/xfa/src/fgas/src/crt/fx_memory.cpp
index 68a76bf184..23d9e2953d 100644
--- a/xfa/src/fgas/src/crt/fx_memory.cpp
+++ b/xfa/src/fgas/src/crt/fx_memory.cpp
@@ -35,17 +35,16 @@ CFX_StaticStore::CFX_StaticStore(size_t iDefChunkSize)
FXSYS_assert(m_iDefChunkSize != 0);
}
CFX_StaticStore::~CFX_StaticStore() {
- FX_LPSTATICSTORECHUNK pChunk, pNext;
- pChunk = m_pChunk;
- while (pChunk != NULL) {
- pNext = pChunk->pNextChunk;
+ FX_STATICSTORECHUNK* pChunk = m_pChunk;
+ while (pChunk) {
+ FX_STATICSTORECHUNK* pNext = pChunk->pNextChunk;
FX_Free(pChunk);
pChunk = pNext;
}
}
-FX_LPSTATICSTORECHUNK CFX_StaticStore::AllocChunk(size_t size) {
+FX_STATICSTORECHUNK* CFX_StaticStore::AllocChunk(size_t size) {
FXSYS_assert(size != 0);
- FX_LPSTATICSTORECHUNK pChunk = (FX_LPSTATICSTORECHUNK)FX_Alloc(
+ FX_STATICSTORECHUNK* pChunk = (FX_STATICSTORECHUNK*)FX_Alloc(
uint8_t, sizeof(FX_STATICSTORECHUNK) + size);
pChunk->iChunkSize = size;
pChunk->iFreeSize = size;
@@ -58,7 +57,7 @@ FX_LPSTATICSTORECHUNK CFX_StaticStore::AllocChunk(size_t size) {
m_pLastChunk = pChunk;
return pChunk;
}
-FX_LPSTATICSTORECHUNK CFX_StaticStore::FindChunk(size_t size) {
+FX_STATICSTORECHUNK* CFX_StaticStore::FindChunk(size_t size) {
FXSYS_assert(size != 0);
if (m_pLastChunk == NULL || m_pLastChunk->iFreeSize < size) {
return AllocChunk(std::max(m_iDefChunkSize, size));
@@ -68,8 +67,8 @@ FX_LPSTATICSTORECHUNK CFX_StaticStore::FindChunk(size_t size) {
void* CFX_StaticStore::Alloc(size_t size) {
size = FX_4BYTEALIGN(size);
FXSYS_assert(size != 0);
- FX_LPSTATICSTORECHUNK pChunk = FindChunk(size);
- FXSYS_assert(pChunk != NULL && pChunk->iFreeSize >= size);
+ FX_STATICSTORECHUNK* pChunk = FindChunk(size);
+ FXSYS_assert(pChunk->iFreeSize >= size);
uint8_t* p = (uint8_t*)pChunk;
p += sizeof(FX_STATICSTORECHUNK) + pChunk->iChunkSize - pChunk->iFreeSize;
pChunk->iFreeSize -= size;
@@ -89,19 +88,18 @@ CFX_FixedStore::CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk)
FXSYS_assert(m_iBlockSize != 0 && m_iDefChunkSize != 0);
}
CFX_FixedStore::~CFX_FixedStore() {
- FX_LPFIXEDSTORECHUNK pChunk, pNext;
- pChunk = m_pChunk;
- while (pChunk != NULL) {
- pNext = pChunk->pNextChunk;
+ FX_FIXEDSTORECHUNK* pChunk = m_pChunk;
+ while (pChunk) {
+ FX_FIXEDSTORECHUNK* pNext = pChunk->pNextChunk;
FX_Free(pChunk);
pChunk = pNext;
}
}
-FX_LPFIXEDSTORECHUNK CFX_FixedStore::AllocChunk() {
+FX_FIXEDSTORECHUNK* CFX_FixedStore::AllocChunk() {
int32_t iTotalSize = sizeof(FX_FIXEDSTORECHUNK) + m_iDefChunkSize +
m_iBlockSize * m_iDefChunkSize;
- FX_LPFIXEDSTORECHUNK pChunk =
- (FX_LPFIXEDSTORECHUNK)FX_Alloc(uint8_t, iTotalSize);
+ FX_FIXEDSTORECHUNK* pChunk =
+ (FX_FIXEDSTORECHUNK*)FX_Alloc(uint8_t, iTotalSize);
if (pChunk == NULL) {
return NULL;
}
@@ -116,7 +114,7 @@ void* CFX_FixedStore::Alloc(size_t size) {
if (size > m_iBlockSize) {
return NULL;
}
- FX_LPFIXEDSTORECHUNK pChunk = m_pChunk;
+ FX_FIXEDSTORECHUNK* pChunk = m_pChunk;
while (pChunk != NULL) {
if (pChunk->iFreeNum > 0) {
break;
@@ -140,8 +138,8 @@ void* CFX_FixedStore::Alloc(size_t size) {
}
void CFX_FixedStore::Free(void* pBlock) {
FXSYS_assert(pBlock != NULL);
- FX_LPFIXEDSTORECHUNK pPrior, pChunk;
- pPrior = NULL, pChunk = m_pChunk;
+ FX_FIXEDSTORECHUNK* pPrior = NULL;
+ FX_FIXEDSTORECHUNK* pChunk = m_pChunk;
uint8_t* pStart = NULL;
uint8_t* pEnd;
while (pChunk != NULL) {
@@ -184,17 +182,16 @@ CFX_DynamicStore::CFX_DynamicStore(size_t iDefChunkSize)
FXSYS_assert(m_iDefChunkSize != 0);
}
CFX_DynamicStore::~CFX_DynamicStore() {
- FX_LPDYNAMICSTORECHUNK pChunk, pNext;
- pChunk = m_pChunk;
- while (pChunk != NULL) {
- pNext = pChunk->pNextChunk;
+ FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
+ while (pChunk) {
+ FX_DYNAMICSTORECHUNK* pNext = pChunk->pNextChunk;
FX_Free(pChunk);
pChunk = pNext;
}
}
-FX_LPDYNAMICSTORECHUNK CFX_DynamicStore::AllocChunk(size_t size) {
+FX_DYNAMICSTORECHUNK* CFX_DynamicStore::AllocChunk(size_t size) {
FXSYS_assert(size != 0);
- FX_LPDYNAMICSTORECHUNK pChunk = (FX_LPDYNAMICSTORECHUNK)FX_Alloc(
+ FX_DYNAMICSTORECHUNK* pChunk = (FX_DYNAMICSTORECHUNK*)FX_Alloc(
uint8_t,
sizeof(FX_DYNAMICSTORECHUNK) + sizeof(FX_DYNAMICSTOREBLOCK) * 2 + size);
if (pChunk == NULL) {
@@ -202,14 +199,14 @@ FX_LPDYNAMICSTORECHUNK CFX_DynamicStore::AllocChunk(size_t size) {
}
pChunk->iChunkSize = size;
pChunk->iFreeSize = size;
- FX_LPDYNAMICSTOREBLOCK pBlock = pChunk->FirstBlock();
+ FX_DYNAMICSTOREBLOCK* pBlock = pChunk->FirstBlock();
pBlock->iBlockSize = size;
pBlock->bUsed = FALSE;
pBlock = pBlock->NextBlock();
pBlock->iBlockSize = 0;
pBlock->bUsed = TRUE;
if (m_pChunk != NULL && size >= m_iDefChunkSize) {
- FX_LPDYNAMICSTORECHUNK pLast = m_pChunk;
+ FX_DYNAMICSTORECHUNK* pLast = m_pChunk;
while (pLast->pNextChunk != NULL) {
pLast = pLast->pNextChunk;
}
@@ -224,8 +221,8 @@ FX_LPDYNAMICSTORECHUNK CFX_DynamicStore::AllocChunk(size_t size) {
void* CFX_DynamicStore::Alloc(size_t size) {
size = FX_4BYTEALIGN(size);
FXSYS_assert(size != 0);
- FX_LPDYNAMICSTORECHUNK pChunk = m_pChunk;
- FX_LPDYNAMICSTOREBLOCK pBlock = NULL;
+ FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
+ FX_DYNAMICSTOREBLOCK* pBlock = NULL;
while (pChunk != NULL) {
if (pChunk->iFreeSize >= size) {
pBlock = pChunk->FirstBlock();
@@ -253,7 +250,7 @@ void* CFX_DynamicStore::Alloc(size_t size) {
if (pBlock->iBlockSize > m) {
size_t n = pBlock->iBlockSize;
pBlock->iBlockSize = size;
- FX_LPDYNAMICSTOREBLOCK pNextBlock = pBlock->NextBlock();
+ FX_DYNAMICSTOREBLOCK* pNextBlock = pBlock->NextBlock();
pNextBlock->bUsed = FALSE;
pNextBlock->iBlockSize = n - size - sizeof(FX_DYNAMICSTOREBLOCK);
pChunk->iFreeSize -= size + sizeof(FX_DYNAMICSTOREBLOCK);
@@ -264,8 +261,8 @@ void* CFX_DynamicStore::Alloc(size_t size) {
}
void CFX_DynamicStore::Free(void* pBlock) {
FXSYS_assert(pBlock != NULL);
- FX_LPDYNAMICSTORECHUNK pPriorChunk, pChunk;
- pPriorChunk = NULL, pChunk = m_pChunk;
+ FX_DYNAMICSTORECHUNK* pPriorChunk = NULL;
+ FX_DYNAMICSTORECHUNK* pChunk = m_pChunk;
while (pChunk != NULL) {
if (pBlock > pChunk &&
pBlock <= ((uint8_t*)pChunk + sizeof(FX_DYNAMICSTORECHUNK) +
@@ -275,8 +272,8 @@ void CFX_DynamicStore::Free(void* pBlock) {
pPriorChunk = pChunk, pChunk = pChunk->pNextChunk;
}
FXSYS_assert(pChunk != NULL);
- FX_LPDYNAMICSTOREBLOCK pPriorBlock, pFindBlock;
- pPriorBlock = NULL, pFindBlock = pChunk->FirstBlock();
+ FX_DYNAMICSTOREBLOCK* pPriorBlock = NULL;
+ FX_DYNAMICSTOREBLOCK* pFindBlock = pChunk->FirstBlock();
while (pFindBlock->iBlockSize != 0) {
if (pBlock == (void*)pFindBlock->Data()) {
break;
diff --git a/xfa/src/fgas/src/crt/fx_memory.h b/xfa/src/fgas/src/crt/fx_memory.h
index 75f4327c0c..d933945cb6 100644
--- a/xfa/src/fgas/src/crt/fx_memory.h
+++ b/xfa/src/fgas/src/crt/fx_memory.h
@@ -25,18 +25,19 @@ class CFX_DefStore : public IFX_MEMAllocator, public CFX_Target {
virtual size_t SetDefChunkSize(size_t size) { return 0; }
virtual size_t GetCurrentDataSize() const { return 0; }
};
+
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(push, 1)
#endif
-typedef struct _FX_STATICSTORECHUNK {
- _FX_STATICSTORECHUNK* pNextChunk;
+struct FX_STATICSTORECHUNK {
+ FX_STATICSTORECHUNK* pNextChunk;
size_t iChunkSize;
size_t iFreeSize;
-} FX_STATICSTORECHUNK, *FX_LPSTATICSTORECHUNK;
-typedef FX_STATICSTORECHUNK const* FX_LPCSTATICSTORECHUNK;
+};
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(pop)
#endif
+
class CFX_StaticStore : public IFX_MEMAllocator, public CFX_Target {
public:
CFX_StaticStore(size_t iDefChunkSize = 4096);
@@ -52,27 +53,27 @@ class CFX_StaticStore : public IFX_MEMAllocator, public CFX_Target {
protected:
size_t m_iAllocatedSize;
size_t m_iDefChunkSize;
- FX_LPSTATICSTORECHUNK m_pChunk;
- FX_LPSTATICSTORECHUNK m_pLastChunk;
- FX_LPSTATICSTORECHUNK AllocChunk(size_t size);
- FX_LPSTATICSTORECHUNK FindChunk(size_t size);
+ FX_STATICSTORECHUNK* m_pChunk;
+ FX_STATICSTORECHUNK* m_pLastChunk;
+ FX_STATICSTORECHUNK* AllocChunk(size_t size);
+ FX_STATICSTORECHUNK* FindChunk(size_t size);
};
+
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(push, 1)
#endif
-typedef struct _FX_FIXEDSTORECHUNK {
- uint8_t* FirstFlag() const {
- return (uint8_t*)this + sizeof(_FX_FIXEDSTORECHUNK);
- }
- uint8_t* FirstBlock() const { return FirstFlag() + iChunkSize; }
- _FX_FIXEDSTORECHUNK* pNextChunk;
+struct FX_FIXEDSTORECHUNK {
+ uint8_t* FirstFlag() { return reinterpret_cast<uint8_t*>(this + 1); }
+ uint8_t* FirstBlock() { return FirstFlag() + iChunkSize; }
+
+ FX_FIXEDSTORECHUNK* pNextChunk;
size_t iChunkSize;
size_t iFreeNum;
-} FX_FIXEDSTORECHUNK, *FX_LPFIXEDSTORECHUNK;
-typedef FX_FIXEDSTORECHUNK const* FX_LPCFIXEDSTORECHUNK;
+};
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(pop)
#endif
+
class CFX_FixedStore : public IFX_MEMAllocator, public CFX_Target {
public:
CFX_FixedStore(size_t iBlockSize, size_t iBlockNumsInChunk);
@@ -86,38 +87,37 @@ class CFX_FixedStore : public IFX_MEMAllocator, public CFX_Target {
virtual size_t GetCurrentDataSize() const { return 0; }
protected:
+ FX_FIXEDSTORECHUNK* AllocChunk();
+
size_t m_iBlockSize;
size_t m_iDefChunkSize;
- FX_LPFIXEDSTORECHUNK m_pChunk;
- FX_LPFIXEDSTORECHUNK AllocChunk();
+ FX_FIXEDSTORECHUNK* m_pChunk;
};
+
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(push, 1)
#endif
-typedef struct _FX_DYNAMICSTOREBLOCK {
- _FX_DYNAMICSTOREBLOCK* NextBlock() const {
- return (_FX_DYNAMICSTOREBLOCK*)(Data() + iBlockSize);
- }
- uint8_t* Data() const {
- return (uint8_t*)this + sizeof(_FX_DYNAMICSTOREBLOCK);
+struct FX_DYNAMICSTOREBLOCK {
+ uint8_t* Data() { return reinterpret_cast<uint8_t*>(this + 1); }
+ FX_DYNAMICSTOREBLOCK* NextBlock() {
+ return reinterpret_cast<FX_DYNAMICSTOREBLOCK*>(Data() + iBlockSize);
}
size_t iBlockSize;
FX_BOOL bUsed;
-} FX_DYNAMICSTOREBLOCK, *FX_LPDYNAMICSTOREBLOCK;
-typedef FX_DYNAMICSTOREBLOCK const* FX_LPCDYNAMICSTOREBLOCK;
-typedef struct _FX_DYNAMICSTORECHUNK {
- FX_LPDYNAMICSTOREBLOCK FirstBlock() const {
- return (FX_LPDYNAMICSTOREBLOCK)((uint8_t*)this +
- sizeof(_FX_DYNAMICSTORECHUNK));
+};
+
+struct FX_DYNAMICSTORECHUNK {
+ FX_DYNAMICSTOREBLOCK* FirstBlock() {
+ return reinterpret_cast<FX_DYNAMICSTOREBLOCK*>(this + 1);
}
- _FX_DYNAMICSTORECHUNK* pNextChunk;
+ FX_DYNAMICSTORECHUNK* pNextChunk;
size_t iChunkSize;
size_t iFreeSize;
-} FX_DYNAMICSTORECHUNK, *FX_LPDYNAMICSTORECHUNK;
-typedef FX_DYNAMICSTORECHUNK const* FX_LPCDYNAMICSTORECHUNK;
+};
#if _FX_OS_ != _FX_ANDROID_
#pragma pack(pop)
#endif
+
class CFX_DynamicStore : public IFX_MEMAllocator, public CFX_Target {
public:
CFX_DynamicStore(size_t iDefChunkSize = 4096);
@@ -131,9 +131,10 @@ class CFX_DynamicStore : public IFX_MEMAllocator, public CFX_Target {
virtual size_t GetCurrentDataSize() const { return 0; }
protected:
+ FX_DYNAMICSTORECHUNK* AllocChunk(size_t size);
+
size_t m_iDefChunkSize;
- FX_LPDYNAMICSTORECHUNK m_pChunk;
- FX_LPDYNAMICSTORECHUNK AllocChunk(size_t size);
+ FX_DYNAMICSTORECHUNK* m_pChunk;
};
#endif // XFA_SRC_FGAS_SRC_CRT_FX_MEMORY_H_
diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp
index fda9637467..3740178d87 100644
--- a/xfa/src/fgas/src/crt/fx_utils.cpp
+++ b/xfa/src/fgas/src/crt/fx_utils.cpp
@@ -329,18 +329,19 @@ int32_t CFX_BaseMassArray::RemoveLast(int32_t iCount) {
void CFX_BaseMassArray::RemoveAll(FX_BOOL bLeaveMemory) {
m_pData->RemoveAll(bLeaveMemory);
}
-typedef struct _FX_BASEDISCRETEARRAYDATA {
+
+struct FX_BASEDISCRETEARRAYDATA {
int32_t iBlockSize;
int32_t iChunkSize;
int32_t iChunkCount;
CFX_PtrArray ChunkBuffer;
-} FX_BASEDISCRETEARRAYDATA, *FX_LPBASEDISCRETEARRAYDATA;
-typedef FX_BASEDISCRETEARRAYDATA const* FX_LPCBASEDISCRETEARRAYDATA;
+};
+
CFX_BaseDiscreteArray::CFX_BaseDiscreteArray(int32_t iChunkSize,
int32_t iBlockSize) {
FXSYS_assert(iChunkSize > 0 && iBlockSize > 0);
- FX_LPBASEDISCRETEARRAYDATA pData;
- m_pData = pData = new FX_BASEDISCRETEARRAYDATA;
+ FX_BASEDISCRETEARRAYDATA* pData = new FX_BASEDISCRETEARRAYDATA;
+ m_pData = pData;
pData->ChunkBuffer.SetSize(16);
pData->iChunkCount = 0;
pData->iChunkSize = iChunkSize;
@@ -348,11 +349,11 @@ CFX_BaseDiscreteArray::CFX_BaseDiscreteArray(int32_t iChunkSize,
}
CFX_BaseDiscreteArray::~CFX_BaseDiscreteArray() {
RemoveAll();
- delete (FX_LPBASEDISCRETEARRAYDATA) m_pData;
+ delete static_cast<FX_BASEDISCRETEARRAYDATA*>(m_pData);
}
uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
FXSYS_assert(index > -1);
- FX_LPBASEDISCRETEARRAYDATA pData = (FX_LPBASEDISCRETEARRAYDATA)m_pData;
+ FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
int32_t& iChunkCount = pData->iChunkCount;
int32_t iChunkSize = pData->iChunkSize;
uint8_t* pChunk = NULL;
@@ -372,7 +373,7 @@ uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
}
uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const {
FXSYS_assert(index > -1);
- FX_LPBASEDISCRETEARRAYDATA pData = (FX_LPBASEDISCRETEARRAYDATA)m_pData;
+ FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
int32_t iChunkSize = pData->iChunkSize;
int32_t iChunk = index / iChunkSize;
if (iChunk >= pData->iChunkCount) {
@@ -385,7 +386,7 @@ uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const {
return pChunk + (index % iChunkSize) * pData->iBlockSize;
}
void CFX_BaseDiscreteArray::RemoveAll() {
- FX_LPBASEDISCRETEARRAYDATA pData = (FX_LPBASEDISCRETEARRAYDATA)m_pData;
+ FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
CFX_PtrArray& ChunkBuffer = pData->ChunkBuffer;
int32_t& iChunkCount = pData->iChunkCount;
for (int32_t i = 0; i < iChunkCount; i++) {
diff --git a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
index 7f566979ed..20bbf99981 100644
--- a/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_rtfbreak.cpp
@@ -1174,7 +1174,7 @@ void CFX_RTFBreak::Reset() {
m_RTFLine1.RemoveAll(TRUE);
m_RTFLine2.RemoveAll(TRUE);
}
-int32_t CFX_RTFBreak::GetDisplayPos(FX_LPCRTFTEXTOBJ pText,
+int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode,
CFX_WideString* pWSForms,
@@ -1418,7 +1418,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(FX_LPCRTFTEXTOBJ pText,
}
return iCount;
}
-int32_t CFX_RTFBreak::GetCharRects(FX_LPCRTFTEXTOBJ pText,
+int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox) const {
if (pText == NULL || pText->iLength < 1) {
diff --git a/xfa/src/fgas/src/layout/fx_rtfbreak.h b/xfa/src/fgas/src/layout/fx_rtfbreak.h
index 673eb628b5..39e53ed96c 100644
--- a/xfa/src/fgas/src/layout/fx_rtfbreak.h
+++ b/xfa/src/fgas/src/layout/fx_rtfbreak.h
@@ -97,12 +97,12 @@ class CFX_RTFBreak : public IFX_RTFBreak {
void ClearBreakPieces() override;
void Reset() override;
int32_t GetDisplayPos(
- FX_LPCRTFTEXTOBJ pText,
+ const FX_RTFTEXTOBJ* pText,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
CFX_WideString* pWSForms = NULL,
FX_AdjustCharDisplayPos pAdjustPos = NULL) const override;
- int32_t GetCharRects(FX_LPCRTFTEXTOBJ pText,
+ int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const override;
FX_DWORD AppendChar_CharCode(FX_WCHAR wch);
diff --git a/xfa/src/fgas/src/layout/fx_textbreak.cpp b/xfa/src/fgas/src/layout/fx_textbreak.cpp
index 20089c966f..779ddadcda 100644
--- a/xfa/src/fgas/src/layout/fx_textbreak.cpp
+++ b/xfa/src/fgas/src/layout/fx_textbreak.cpp
@@ -1165,7 +1165,7 @@ typedef struct _FX_FORMCHAR {
int32_t iWidth;
} FX_FORMCHAR, *FX_LPFORMCHAR;
typedef FX_FORMCHAR const* FX_LPCFORMCHAR;
-int32_t CFX_TxtBreak::GetDisplayPos(FX_LPCTXTRUN pTxtRun,
+int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode,
CFX_WideString* pWSForms,
@@ -1548,7 +1548,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(FX_LPCTXTRUN pTxtRun,
}
return iCount;
}
-int32_t CFX_TxtBreak::GetCharRects(FX_LPCTXTRUN pTxtRun,
+int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox) const {
if (pTxtRun == NULL || pTxtRun->iLength < 1) {
diff --git a/xfa/src/fgas/src/layout/fx_textbreak.h b/xfa/src/fgas/src/layout/fx_textbreak.h
index 9e32f8da2e..b1baae493e 100644
--- a/xfa/src/fgas/src/layout/fx_textbreak.h
+++ b/xfa/src/fgas/src/layout/fx_textbreak.h
@@ -89,12 +89,12 @@ class CFX_TxtBreak : public IFX_TxtBreak {
virtual void ClearBreakPieces();
virtual void Reset();
virtual int32_t GetDisplayPos(
- FX_LPCTXTRUN pTxtRun,
+ const FX_TXTRUN* pTxtRun,
FXTEXT_CHARPOS* pCharPos,
FX_BOOL bCharCode = FALSE,
CFX_WideString* pWSForms = NULL,
FX_AdjustCharDisplayPos pAdjustPos = NULL) const;
- virtual int32_t GetCharRects(FX_LPCTXTRUN pTxtRun,
+ virtual int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
CFX_RectFArray& rtArray,
FX_BOOL bCharBBox = FALSE) const;
void AppendChar_PageLoad(CFX_Char* pCurChar, FX_DWORD dwProps);
diff --git a/xfa/src/fgas/src/layout/fx_unicode.cpp b/xfa/src/fgas/src/layout/fx_unicode.cpp
index 946b8d7049..a93edc15f7 100644
--- a/xfa/src/fgas/src/layout/fx_unicode.cpp
+++ b/xfa/src/fgas/src/layout/fx_unicode.cpp
@@ -60,7 +60,7 @@ static const FX_JAPCHARPROPERTYEX gs_FX_JapCharPropertysEx[] = {
{0x31F9, 0x23}, {0x31FA, 0x23}, {0x31FB, 0x23}, {0x31FC, 0x23},
{0x31FD, 0x23}, {0x31FE, 0x23}, {0x31FF, 0x23},
};
-FX_LPCJAPCHARPROPERTYEX FX_GetJapCharPropertyEx(FX_WCHAR wch) {
+const FX_JAPCHARPROPERTYEX* FX_GetJapCharPropertyEx(FX_WCHAR wch) {
int32_t iStart = 0;
int32_t iEnd =
sizeof(gs_FX_JapCharPropertysEx) / sizeof(FX_JAPCHARPROPERTYEX);
@@ -89,7 +89,7 @@ FX_BOOL FX_AdjustJapCharDisplayPos(FX_WCHAR wch,
if (wch < 0x3001 || wch > 0x31FF) {
return FALSE;
}
- FX_LPCJAPCHARPROPERTYEX pJapChar = FX_GetJapCharPropertyEx(wch);
+ const FX_JAPCHARPROPERTYEX* pJapChar = FX_GetJapCharPropertyEx(wch);
if (pJapChar == NULL) {
return FALSE;
}