summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-10 11:09:44 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-10 11:09:44 -0700
commitfbf266fc0ea4be2523cbb901a641aa33f0035662 (patch)
treed0e5eda4d3c220818903eca76bc2ca835a1851d0 /core/src/fpdfdoc
parent3c949d5d2b0d680839766ea99c86b263230b263d (diff)
downloadpdfium-fbf266fc0ea4be2523cbb901a641aa33f0035662.tar.xz
Remove typdefs for pointer types in fx_system.h.
This involves fixing some multiple variable per line declarations, as the textually-substituted "*" applies only to the first one. This involves moving some consts around following the substitution. This involves replacing some typedefs used as constructors with better code. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1171733003
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp2
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp4
-rw-r--r--core/src/fpdfdoc/doc_form.cpp46
-rw-r--r--core/src/fpdfdoc/doc_link.cpp7
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp6
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp4
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp2
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp4
-rw-r--r--core/src/fpdfdoc/pdf_vt.h4
9 files changed, 41 insertions, 38 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 5086fba3a3..3fe20b6e28 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -129,7 +129,7 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDe
int CPDF_AnnotList::GetIndex(CPDF_Annot* pAnnot)
{
for (int i = 0; i < m_AnnotList.GetSize(); ++i)
- if (m_AnnotList[i] == (FX_LPVOID)pAnnot) {
+ if (m_AnnotList[i] == (void*)pAnnot) {
return i;
}
return -1;
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index dfa2e6718a..f9e692cb69 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -251,7 +251,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName)
return NULL;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str)
+static CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str)
{
CFX_WideString result;
while (*str) {
@@ -268,7 +268,7 @@ static CFX_WideString ChangeSlashToPlatform(FX_LPCWSTR str)
}
return result;
}
-static CFX_WideString ChangeSlashToPDF(FX_LPCWSTR str)
+static CFX_WideString ChangeSlashToPDF(const FX_WCHAR* str)
{
CFX_WideString result;
while (*str) {
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index f791a325e4..753ade0411 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -19,7 +19,7 @@ public:
m_pEnd = m_pStart + full_name.GetLength();
m_pCur = m_pStart;
}
- void GetNext(FX_LPCWSTR &pSubName, FX_STRSIZE& size)
+ void GetNext(const FX_WCHAR* &pSubName, FX_STRSIZE& size)
{
pSubName = m_pCur;
while (m_pCur < m_pEnd && m_pCur[0] != L'.') {
@@ -31,9 +31,9 @@ public:
}
}
protected:
- FX_LPCWSTR m_pStart;
- FX_LPCWSTR m_pEnd;
- FX_LPCWSTR m_pCur;
+ const FX_WCHAR* m_pStart;
+ const FX_WCHAR* m_pEnd;
+ const FX_WCHAR* m_pCur;
};
class CFieldTree
{
@@ -159,7 +159,7 @@ void CFieldTree::SetField(const CFX_WideString &full_name, CPDF_FormField *field
return;
}
_CFieldNameExtractor name_extractor(full_name);
- FX_LPCWSTR pName;
+ const FX_WCHAR* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
_Node *pNode = &m_Root, *pLast = NULL;
@@ -182,7 +182,7 @@ CPDF_FormField *CFieldTree::GetField(const CFX_WideString &full_name)
return NULL;
}
_CFieldNameExtractor name_extractor(full_name);
- FX_LPCWSTR pName;
+ const FX_WCHAR* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
_Node *pNode = &m_Root, *pLast = NULL;
@@ -200,7 +200,7 @@ CPDF_FormField *CFieldTree::RemoveField(const CFX_WideString & full_name)
return NULL;
}
_CFieldNameExtractor name_extractor(full_name);
- FX_LPCWSTR pName;
+ const FX_WCHAR* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
_Node *pNode = &m_Root, *pLast = NULL;
@@ -230,7 +230,7 @@ CFieldTree::_Node *CFieldTree::FindNode(const CFX_WideString& full_name)
return NULL;
}
_CFieldNameExtractor name_extractor(full_name);
- FX_LPCWSTR pName;
+ const FX_WCHAR* pName;
FX_STRSIZE nLength;
name_extractor.GetNext(pName, nLength);
_Node *pNode = &m_Root, *pLast = NULL;
@@ -267,7 +267,8 @@ CPDF_InterForm::~CPDF_InterForm()
{
FX_POSITION pos = m_ControlMap.GetStartPosition();
while (pos) {
- FX_LPVOID key, value;
+ void* key;
+ void* value;
m_ControlMap.GetNextAssoc(pos, key, value);
delete (CPDF_FormControl*)value;
}
@@ -289,7 +290,7 @@ void CPDF_InterForm::EnableUpdateAP(FX_BOOL bUpdateAP)
{
m_bUpdateAP = bUpdateAP;
}
-CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen, FX_LPCSTR csPrefix)
+CFX_ByteString CPDF_InterForm::GenerateNewResourceName(const CPDF_Dictionary* pResDict, const FX_CHAR* csType, int iMinLen, const FX_CHAR* csPrefix)
{
CFX_ByteString csStr = csPrefix;
CFX_ByteString csBType = csType;
@@ -473,7 +474,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B
}
return pFont;
}
-CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont)
+CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont)
{
CFX_ByteString csFontName;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -510,7 +511,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont
#endif
return csFontName;
}
-CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont)
+CFX_ByteString CPDF_InterForm::GetNativeFont(void* pLogFont)
{
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
uint8_t charSet = GetNativeCharSet();
@@ -695,7 +696,8 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, CFX_
}
int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2)
{
- FX_LPCSTR ptr1 = name1, ptr2 = name2;
+ const FX_CHAR* ptr1 = name1;
+ const FX_CHAR* ptr2 = name2;
if (name1.GetLength() != name2.GetLength()) {
int i = 0;
while (ptr1[i] == ptr2[i]) {
@@ -714,8 +716,8 @@ int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_Byte
}
int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2)
{
- FX_LPCWSTR ptr1 = name1.c_str();
- FX_LPCWSTR ptr2 = name2.c_str();
+ const FX_WCHAR* ptr1 = name1.c_str();
+ const FX_WCHAR* ptr2 = name2.c_str();
if (name1.GetLength() != name2.GetLength()) {
int i = 0;
while (ptr1[i] == ptr2[i]) {
@@ -819,7 +821,7 @@ FX_BOOL CPDF_InterForm::IsValidFormControl(const void* pControl)
while (pos) {
CPDF_Dictionary* pWidgetDict = NULL;
void* pFormControl = NULL;
- m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, pFormControl);
+ m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, pFormControl);
if (pControl == pFormControl) {
return TRUE;
}
@@ -839,7 +841,7 @@ int CPDF_InterForm::CountPageControls(CPDF_Page* pPage) const
continue;
}
CPDF_FormControl* pControl;
- if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) {
+ if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) {
continue;
}
count ++;
@@ -859,7 +861,7 @@ CPDF_FormControl* CPDF_InterForm::GetPageControl(CPDF_Page* pPage, int index) co
continue;
}
CPDF_FormControl* pControl;
- if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) {
+ if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) {
continue;
}
if (index == count) {
@@ -881,7 +883,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p
continue;
}
CPDF_FormControl* pControl;
- if (!m_ControlMap.Lookup(pAnnot, (FX_LPVOID&)pControl)) {
+ if (!m_ControlMap.Lookup(pAnnot, (void*&)pControl)) {
continue;
}
CFX_FloatRect rect = pControl->GetRect();
@@ -894,7 +896,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT p
CPDF_FormControl* CPDF_InterForm::GetControlByDict(CPDF_Dictionary* pWidgetDict) const
{
CPDF_FormControl* pControl = NULL;
- m_ControlMap.Lookup(pWidgetDict, (FX_LPVOID&)pControl);
+ m_ControlMap.Lookup(pWidgetDict, (void*&)pControl);
return pControl;
}
FX_DWORD CPDF_InterForm::CountInternalFields(const CFX_WideString& csFieldName) const
@@ -1202,7 +1204,7 @@ void CPDF_InterForm::ReloadForm()
while (pos) {
CPDF_Dictionary* pWidgetDict;
CPDF_FormControl* pControl;
- m_ControlMap.GetNextAssoc(pos, (FX_LPVOID&)pWidgetDict, (FX_LPVOID&)pControl);
+ m_ControlMap.GetNextAssoc(pos, (void*&)pWidgetDict, (void*&)pControl);
delete pControl;
}
m_ControlMap.RemoveAll();
@@ -1465,7 +1467,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field
return pDoc;
}
const struct _SupportFieldEncoding {
- FX_LPCSTR m_name;
+ const FX_CHAR* m_name;
int32_t m_codePage;
} g_fieldEncoding[] = {
{ "BigFive", 950 },
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index 0109e7c9b3..e614af3ec8 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -11,7 +11,8 @@ CPDF_LinkList::~CPDF_LinkList()
{
FX_POSITION pos = m_PageMap.GetStartPosition();
while (pos) {
- FX_LPVOID key, value;
+ void* key;
+ void* value;
m_PageMap.GetNextAssoc(pos, key, value);
delete (CFX_PtrArray*)value;
}
@@ -23,9 +24,9 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage)
return NULL;
}
CFX_PtrArray* pPageLinkList = NULL;
- if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) {
+ if (!m_PageMap.Lookup((void*)(uintptr_t)objnum, (void*&)pPageLinkList)) {
pPageLinkList = new CFX_PtrArray;
- m_PageMap.SetAt((FX_LPVOID)(uintptr_t)objnum, pPageLinkList);
+ m_PageMap.SetAt((void*)(uintptr_t)objnum, pPageLinkList);
LoadPageLinks(pPage, pPageLinkList);
}
return pPageLinkList;
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index e3226bd7dd..0239e0ad55 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -13,7 +13,7 @@ typedef struct _PDFDOC_METADATA {
CFX_CMapByteStringToPtr *m_pStringMap;
} PDFDOC_METADATA, * PDFDOC_LPMETADATA;
typedef PDFDOC_METADATA const * PDFDOC_LPCMETADATA;
-const FX_LPCSTR gs_FPDFDOC_Metadata_Titles[] = {
+const FX_CHAR* const gs_FPDFDOC_Metadata_Titles[] = {
"Title", "title",
"Subject", "description",
"Author", "creator",
@@ -60,7 +60,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc)
CPDF_StreamAcc acc;
acc.LoadAllData(pStream, FALSE);
int size = acc.GetSize();
- FX_LPCBYTE pBuf = acc.GetData();
+ const uint8_t* pBuf = acc.GetData();
CXML_Element *&pXmlElmnt = ((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt;
pXmlElmnt = CXML_Element::Parse(pBuf, size);
if (!pXmlElmnt) {
@@ -85,7 +85,7 @@ int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr)
if (!((PDFDOC_LPMETADATA)m_pData)->m_pStringMap->Lookup(bsItem, szTag)) {
return -1;
}
- CFX_ByteString bsTag = (FX_LPCSTR)szTag;
+ CFX_ByteString bsTag = (const FX_CHAR*)szTag;
wsStr = L"";
CXML_Element *pElmntRdf = ((PDFDOC_LPMETADATA)m_pData)->m_pElmntRdf;
if (!pElmntRdf) {
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index c2f77a58fa..318e9318ce 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -179,11 +179,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict)
if (!pOCGDict) {
return FALSE;
}
- FX_LPVOID bState = NULL;
+ void* bState = NULL;
if (m_OCGStates.Lookup(pOCGDict, bState)) {
return (uintptr_t)bState != 0;
}
- bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict);
+ bState = (void*)(uintptr_t)LoadOCGState(pOCGDict);
m_OCGStates.SetAt(pOCGDict, bState);
return (uintptr_t)bState != 0;
}
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index e3cd744c61..a724565c3f 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -125,7 +125,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
return NULL;
}
CPDF_StructElementImpl* pElement = NULL;
- if (map.Lookup(pDict, (FX_LPVOID&)pElement)) {
+ if (map.Lookup(pDict, (void*&)pElement)) {
return pElement;
}
pElement = new CPDF_StructElementImpl(this, NULL, pDict);
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 52096f7090..31faf67c33 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -917,7 +917,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co
}
return newplace;
}
-CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset,
+CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset,
const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps)
{
CFX_WideString swText = text;
@@ -977,7 +977,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place)
{
return ClearLeftWord(AjustLineHeader(place, TRUE));
}
-void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps,
+void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps)
{
DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index 662748fa6f..1ab8fdb918 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -469,13 +469,13 @@ public:
void RearrangeAll();
void RearrangePart(const CPVT_WordRange & PlaceRange);
void ResetAll();
- void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL,
+ void SetText(const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL,
const CPVT_WordProps * pWordProps = NULL);
CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1,
const CPVT_WordProps * pWordProps = NULL);
CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL,
const CPVT_WordProps * pWordProps = NULL);
- CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1,
+ CPVT_WordPlace InsertText(const CPVT_WordPlace & place, const FX_WCHAR* text, int32_t charset = 1,
const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL);
CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange);
CPVT_WordPlace DeleteWord(const CPVT_WordPlace & place);