summaryrefslogtreecommitdiff
path: root/core/fpdftext
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-13 16:43:37 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-14 14:14:51 +0000
commit812e96c2b4c5908a1979da5e27cdcecda0d1dfc9 (patch)
treef0b0607f6b757eb22237527215094bd87b5d03ba /core/fpdftext
parent893822aa5b6254591f8e80fbffcbb4fa6ad849aa (diff)
downloadpdfium-812e96c2b4c5908a1979da5e27cdcecda0d1dfc9.tar.xz
Replace FX_CHAR and FX_WCHAR with underlying types.
Change-Id: I96e0a20d66b9184d22f64d8e4ce0dadd5a78c1e8 Reviewed-on: https://pdfium-review.googlesource.com/2967 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdftext')
-rw-r--r--core/fpdftext/cpdf_linkextract.cpp6
-rw-r--r--core/fpdftext/cpdf_textpage.cpp52
-rw-r--r--core/fpdftext/cpdf_textpage.h16
-rw-r--r--core/fpdftext/cpdf_textpagefind.cpp23
-rw-r--r--core/fpdftext/cpdf_textpagefind.h4
5 files changed, 50 insertions, 51 deletions
diff --git a/core/fpdftext/cpdf_linkextract.cpp b/core/fpdftext/cpdf_linkextract.cpp
index a1fc93e158..686b6a23b8 100644
--- a/core/fpdftext/cpdf_linkextract.cpp
+++ b/core/fpdftext/cpdf_linkextract.cpp
@@ -45,7 +45,7 @@ void CPDF_LinkExtract::ParseLink() {
strBeCheck = m_pTextPage->GetPageText(start, nCount);
if (strBeCheck.GetLength() > 5) {
while (strBeCheck.GetLength() > 0) {
- FX_WCHAR ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1);
+ wchar_t ch = strBeCheck.GetAt(strBeCheck.GetLength() - 1);
if (ch == L')' || ch == L',' || ch == L'>' || ch == L'.') {
strBeCheck = strBeCheck.Mid(0, strBeCheck.GetLength() - 1);
nCount--;
@@ -101,7 +101,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) {
// Check the local part.
int pPos = aPos; // Used to track the position of '@' or '.'.
for (int i = aPos - 1; i >= 0; i--) {
- FX_WCHAR ch = str.GetAt(i);
+ wchar_t ch = str.GetAt(i);
if (ch == L'_' || ch == L'-' || FXSYS_iswalnum(ch))
continue;
@@ -137,7 +137,7 @@ bool CPDF_LinkExtract::CheckMailLink(CFX_WideString& str) {
int nLen = str.GetLength();
pPos = 0; // Used to track the position of '.'.
for (int i = aPos + 1; i < nLen; i++) {
- FX_WCHAR wch = str.GetAt(i);
+ wchar_t wch = str.GetAt(i);
if (wch == L'-' || FXSYS_iswalnum(wch))
continue;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 73a1a7e88e..1a1edcb0ff 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -66,9 +66,9 @@ FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj,
return baseSpace;
}
-FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
+FX_STRSIZE Unicode_GetNormalization(wchar_t wch, wchar_t* pDst) {
wch = wch & 0xFFFF;
- FX_WCHAR wFind = g_UnicodeData_Normalization[wch];
+ wchar_t wFind = g_UnicodeData_Normalization[wch];
if (!wFind) {
if (pDst)
*pDst = wch;
@@ -84,12 +84,12 @@ FX_STRSIZE Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst) {
const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind];
if (pMap == g_UnicodeData_Normalization_Map4) {
pMap = g_UnicodeData_Normalization_Map4 + wch;
- wFind = (FX_WCHAR)(*pMap++);
+ wFind = (wchar_t)(*pMap++);
} else {
pMap += wch;
}
if (pDst) {
- FX_WCHAR n = wFind;
+ wchar_t n = wFind;
while (n--)
*pDst++ = *pMap++;
}
@@ -568,7 +568,7 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::FindTextlineFlowOrientation()
return TextOrientation::Unknown;
}
-void CPDF_TextPage::AppendGeneratedCharacter(FX_WCHAR unicode,
+void CPDF_TextPage::AppendGeneratedCharacter(wchar_t unicode,
const CFX_Matrix& formMatrix) {
PAGECHAR_INFO generateChar;
if (!GenerateCharInfo(unicode, generateChar))
@@ -639,7 +639,7 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const {
return pFont->GetCharBBox(charCode).Width();
}
-void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
+void CPDF_TextPage::AddCharInfoByLRDirection(wchar_t wChar,
PAGECHAR_INFO info) {
if (IsControlChar(info)) {
info.m_Index = -1;
@@ -649,10 +649,10 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
info.m_Index = m_TextBuf.GetLength();
if (wChar >= 0xFB00 && wChar <= 0xFB06) {
- FX_WCHAR* pDst = nullptr;
+ wchar_t* pDst = nullptr;
FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
- pDst = FX_Alloc(FX_WCHAR, nCount);
+ pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
for (int nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
@@ -669,7 +669,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(FX_WCHAR wChar,
m_CharList.push_back(info);
}
-void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar,
+void CPDF_TextPage::AddCharInfoByRLDirection(wchar_t wChar,
PAGECHAR_INFO info) {
if (IsControlChar(info)) {
info.m_Index = -1;
@@ -679,10 +679,10 @@ void CPDF_TextPage::AddCharInfoByRLDirection(FX_WCHAR wChar,
info.m_Index = m_TextBuf.GetLength();
wChar = FX_GetMirrorChar(wChar, true, false);
- FX_WCHAR* pDst = nullptr;
+ wchar_t* pDst = nullptr;
FX_STRSIZE nCount = Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
- pDst = FX_Alloc(FX_WCHAR, nCount);
+ pDst = FX_Alloc(wchar_t, nCount);
Unicode_GetNormalization(wChar, pDst);
for (int nIndex = 0; nIndex < nCount; nIndex++) {
PAGECHAR_INFO info2 = info;
@@ -858,7 +858,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
bExist = false;
for (FX_STRSIZE i = 0; i < nItems; i++) {
- FX_WCHAR wChar = actText.GetAt(i);
+ wchar_t wChar = actText.GetAt(i);
if ((wChar > 0x80 && wChar < 0xFFFD) || (wChar <= 0x80 && isprint(wChar))) {
bExist = true;
break;
@@ -895,7 +895,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
matrix.Concat(Obj.m_formMatrix);
for (FX_STRSIZE k = 0; k < nItems; k++) {
- FX_WCHAR wChar = actText.GetAt(k);
+ wchar_t wChar = actText.GetAt(k);
if (wChar <= 0x80 && !isprint(wChar))
wChar = 0x20;
if (wChar >= 0xFFFD)
@@ -934,7 +934,7 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
std::swap(m_TempCharList[i], m_TempCharList[j]);
std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
}
- FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
+ wchar_t* pTempBuffer = m_TempTextBuf.GetBuffer();
i = iBufStartAppend;
j = m_TempTextBuf.GetLength() - 1;
for (; i < j; i++, j--)
@@ -951,9 +951,9 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
if (item.m_CharCode == static_cast<uint32_t>(-1))
continue;
CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
- FX_WCHAR wChar = wstrItem.GetAt(0);
+ wchar_t wChar = wstrItem.GetAt(0);
if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode)
- wChar = (FX_WCHAR)item.m_CharCode;
+ wChar = (wchar_t)item.m_CharCode;
if (wChar)
str += wChar;
}
@@ -1010,8 +1010,8 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CFX_WideString wstrItem =
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
- wstrItem += (FX_WCHAR)item.m_CharCode;
- FX_WCHAR curChar = wstrItem.GetAt(0);
+ wstrItem += (wchar_t)item.m_CharCode;
+ wchar_t curChar = wstrItem.GetAt(0);
if (curChar == 0x2D || curChar == 0xAD)
return;
}
@@ -1112,7 +1112,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
bool bNoUnicode = false;
if (wstrItem.IsEmpty() && item.m_CharCode) {
- wstrItem += static_cast<FX_WCHAR>(item.m_CharCode);
+ wstrItem += static_cast<wchar_t>(item.m_CharCode);
bNoUnicode = true;
}
charinfo.m_Index = -1;
@@ -1223,18 +1223,18 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
return m_TextlineDir;
}
-bool CPDF_TextPage::IsHyphen(FX_WCHAR curChar) {
+bool CPDF_TextPage::IsHyphen(wchar_t curChar) {
CFX_WideString strCurText = m_TempTextBuf.MakeString();
if (strCurText.IsEmpty())
strCurText = m_TextBuf.AsStringC();
FX_STRSIZE nCount = strCurText.GetLength();
int nIndex = nCount - 1;
- FX_WCHAR wcTmp = strCurText.GetAt(nIndex);
+ wchar_t wcTmp = strCurText.GetAt(nIndex);
while (wcTmp == 0x20 && nIndex <= nCount - 1 && nIndex >= 0)
wcTmp = strCurText.GetAt(--nIndex);
if (0x2D == wcTmp || 0xAD == wcTmp) {
if (--nIndex > 0) {
- FX_WCHAR preChar = strCurText.GetAt((nIndex));
+ wchar_t preChar = strCurText.GetAt((nIndex));
if (((preChar >= L'A' && preChar <= L'Z') ||
(preChar >= L'a' && preChar <= L'z')) &&
((curChar >= L'A' && curChar <= L'Z') ||
@@ -1275,8 +1275,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
CFX_WideString wstrItem =
pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
- wstrItem += static_cast<FX_WCHAR>(item.m_CharCode);
- FX_WCHAR curChar = wstrItem.GetAt(0);
+ wstrItem += static_cast<wchar_t>(item.m_CharCode);
+ wchar_t curChar = wstrItem.GetAt(0);
if (WritingMode == TextOrientation::Horizontal) {
if (this_rect.Height() > 4.5 && prev_rect.Height() > 4.5) {
FX_FLOAT top =
@@ -1368,7 +1368,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
}
CFX_WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
- FX_WCHAR preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
+ wchar_t preChar = PrevStr.GetAt(PrevStr.GetLength() - 1);
CFX_Matrix matrix = pObj->GetTextMatrix();
matrix.Concat(formMatrix);
@@ -1482,7 +1482,7 @@ bool CPDF_TextPage::IsSameAsPreTextObject(
return false;
}
-bool CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) {
+bool CPDF_TextPage::GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info) {
const PAGECHAR_INFO* preChar;
if (!m_TempCharList.empty())
preChar = &m_TempCharList.back();
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 91942d1bec..e8de6205a2 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -49,8 +49,8 @@ class FPDF_CHAR_INFO {
FPDF_CHAR_INFO();
~FPDF_CHAR_INFO();
- FX_WCHAR m_Unicode;
- FX_WCHAR m_Charcode;
+ wchar_t m_Unicode;
+ wchar_t m_Charcode;
int32_t m_Flag;
FX_FLOAT m_FontSize;
CFX_PointF m_Origin;
@@ -72,7 +72,7 @@ class PAGECHAR_INFO {
int m_Index;
int m_CharCode;
- FX_WCHAR m_Unicode;
+ wchar_t m_Unicode;
int32_t m_Flag;
CFX_PointF m_Origin;
CFX_FloatRect m_CharBox;
@@ -125,7 +125,7 @@ class CPDF_TextPage {
Hyphen,
};
- bool IsHyphen(FX_WCHAR curChar);
+ bool IsHyphen(wchar_t curChar);
bool IsControlChar(const PAGECHAR_INFO& charInfo);
void ProcessObject();
void ProcessFormObject(CPDF_FormObject* pFormObj,
@@ -137,7 +137,7 @@ class CPDF_TextPage {
CPDF_PageObjectList::const_iterator ObjPos);
GenerateCharacter ProcessInsertObject(const CPDF_TextObject* pObj,
const CFX_Matrix& formMatrix);
- bool GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info);
+ bool GenerateCharInfo(wchar_t unicode, PAGECHAR_INFO& info);
bool IsSameAsPreTextObject(CPDF_TextObject* pTextObj,
const CPDF_PageObjectList* pObjList,
CPDF_PageObjectList::const_iterator ObjPos);
@@ -148,12 +148,12 @@ class CPDF_TextPage {
void ProcessMarkedContent(PDFTEXT_Obj pObj);
void CheckMarkedContentObject(int32_t& start, int32_t& nCount) const;
void FindPreviousTextObject();
- void AddCharInfoByLRDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
- void AddCharInfoByRLDirection(FX_WCHAR wChar, PAGECHAR_INFO info);
+ void AddCharInfoByLRDirection(wchar_t wChar, PAGECHAR_INFO info);
+ void AddCharInfoByRLDirection(wchar_t wChar, PAGECHAR_INFO info);
TextOrientation GetTextObjectWritingMode(
const CPDF_TextObject* pTextObj) const;
TextOrientation FindTextlineFlowOrientation() const;
- void AppendGeneratedCharacter(FX_WCHAR unicode, const CFX_Matrix& formMatrix);
+ void AppendGeneratedCharacter(wchar_t unicode, const CFX_Matrix& formMatrix);
void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
bool IsRightToLeft(const CPDF_TextObject* pTextObj,
diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp
index a79b5e7e8a..e268975aa7 100644
--- a/core/fpdftext/cpdf_textpagefind.cpp
+++ b/core/fpdftext/cpdf_textpagefind.cpp
@@ -17,7 +17,7 @@
namespace {
-bool IsIgnoreSpaceCharacter(FX_WCHAR curChar) {
+bool IsIgnoreSpaceCharacter(wchar_t curChar) {
if (curChar < 255 || (curChar >= 0x0600 && curChar <= 0x06FF) ||
(curChar >= 0xFE70 && curChar <= 0xFEFF) ||
(curChar >= 0xFB50 && curChar <= 0xFDFF) ||
@@ -150,7 +150,7 @@ bool CPDF_TextPageFind::FindNext() {
CFX_WideString csWord = m_csFindWhatArray[iWord];
if (csWord.IsEmpty()) {
if (iWord == nCount - 1) {
- FX_WCHAR strInsert = m_strText.GetAt(nStartPos);
+ wchar_t strInsert = m_strText.GetAt(nStartPos);
if (strInsert == TEXT_LINEFEED_CHAR || strInsert == TEXT_SPACE_CHAR ||
strInsert == TEXT_RETURN_CHAR || strInsert == 160) {
nResultPos = nStartPos + 1;
@@ -183,7 +183,7 @@ bool CPDF_TextPageFind::FindNext() {
bMatch = false;
}
for (int d = PreResEndPos; d < nResultPos; d++) {
- FX_WCHAR strInsert = m_strText.GetAt(d);
+ wchar_t strInsert = m_strText.GetAt(d);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -192,7 +192,7 @@ bool CPDF_TextPageFind::FindNext() {
}
} else if (bSpaceStart) {
if (nResultPos > 0) {
- FX_WCHAR strInsert = m_strText.GetAt(nResultPos - 1);
+ wchar_t strInsert = m_strText.GetAt(nResultPos - 1);
if (strInsert != TEXT_LINEFEED_CHAR && strInsert != TEXT_SPACE_CHAR &&
strInsert != TEXT_RETURN_CHAR && strInsert != 160) {
bMatch = false;
@@ -293,7 +293,7 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
int pos = 0;
while (pos < csWord.GetLength()) {
CFX_WideString curStr = csWord.Mid(pos, 1);
- FX_WCHAR curChar = csWord.GetAt(pos);
+ wchar_t curChar = csWord.GetAt(pos);
if (IsIgnoreSpaceCharacter(curChar)) {
if (pos > 0 && curChar == 0x2019) {
pos++;
@@ -321,8 +321,8 @@ void CPDF_TextPageFind::ExtractFindWhat(const CFX_WideString& findwhat) {
bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
int startPos,
int endPos) {
- FX_WCHAR char_left = 0;
- FX_WCHAR char_right = 0;
+ wchar_t char_left = 0;
+ wchar_t char_right = 0;
int char_count = endPos - startPos + 1;
if (char_count < 1)
return false;
@@ -362,9 +362,9 @@ bool CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText,
}
bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
+ const wchar_t* lpszFullString,
int iSubString,
- FX_WCHAR chSep) {
+ wchar_t chSep) {
if (!lpszFullString)
return false;
while (iSubString--) {
@@ -377,12 +377,11 @@ bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString,
while (*lpszFullString == chSep)
lpszFullString++;
}
- const FX_WCHAR* lpchEnd = std::wcschr(lpszFullString, chSep);
+ const wchar_t* lpchEnd = std::wcschr(lpszFullString, chSep);
int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString)
: (int)FXSYS_wcslen(lpszFullString);
ASSERT(nLen >= 0);
- FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString,
- nLen * sizeof(FX_WCHAR));
+ FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(wchar_t));
rString.ReleaseBuffer();
return true;
}
diff --git a/core/fpdftext/cpdf_textpagefind.h b/core/fpdftext/cpdf_textpagefind.h
index c60cb576a7..dd509018bd 100644
--- a/core/fpdftext/cpdf_textpagefind.h
+++ b/core/fpdftext/cpdf_textpagefind.h
@@ -32,9 +32,9 @@ class CPDF_TextPageFind {
int startPos,
int endPos);
bool ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
+ const wchar_t* lpszFullString,
int iSubString,
- FX_WCHAR chSep);
+ wchar_t chSep);
CFX_WideString MakeReverse(const CFX_WideString& str);
int GetCharIndex(int index) const;