summaryrefslogtreecommitdiff
path: root/core/src/fpdftext
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/fpdftext
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/fpdftext')
-rw-r--r--core/src/fpdftext/fpdf_text.cpp12
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp8
-rw-r--r--core/src/fpdftext/text_int.h4
-rw-r--r--core/src/fpdftext/unicodenormalization.cpp12
4 files changed, 18 insertions, 18 deletions
diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp
index fbd6860afb..bb0ed98940 100644
--- a/core/src/fpdftext/fpdf_text.cpp
+++ b/core/src/fpdftext/fpdf_text.cpp
@@ -9,14 +9,14 @@
#include "../../include/fpdftext/fpdf_text.h"
#include "txtproc.h"
#include "text_int.h"
-extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR);
-CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defchar)
+extern const FX_CHAR* FCS_GetAltStr(FX_WCHAR);
+CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, const FX_CHAR* defchar)
{
if (destcp == 0) {
if (unicode < 0x80) {
return CFX_ByteString((char)unicode);
}
- FX_LPCSTR altstr = FCS_GetAltStr(unicode);
+ const FX_CHAR* altstr = FCS_GetAltStr(unicode);
if (altstr) {
return CFX_ByteString(altstr, -1);
}
@@ -28,7 +28,7 @@ CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defcha
if (ret && !bDef) {
return CFX_ByteString(buf, ret);
}
- FX_LPCSTR altstr = FCS_GetAltStr(unicode);
+ const FX_CHAR* altstr = FCS_GetAltStr(unicode);
if (altstr) {
return CFX_ByteString(altstr, -1);
}
@@ -173,7 +173,7 @@ CTextBaseLine* CTextPage::InsertTextBox(CTextBaseLine* pBaseLine, FX_FLOAT basey
}
}
CFX_WideString text;
- FX_LPCSTR pStr = str;
+ const FX_CHAR* pStr = str;
int len = str.GetLength(), offset = 0;
while (offset < len) {
FX_DWORD ch = pFont->GetNextChar(pStr, len, offset);
@@ -286,7 +286,7 @@ void CTextPage::WriteOutput(CFX_WideStringArray& lines, int iMinWidth)
void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest)
{
wChar = FX_GetMirrorChar(wChar, TRUE, FALSE);
- FX_LPWSTR pDst = NULL;
+ FX_WCHAR* pDst = NULL;
FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
if (nCount < 1 ) {
sDest += wChar;
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index f5fa3d4921..16421ed5b6 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -1160,7 +1160,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i)
if(!IsControlChar(&Info)) {
Info.m_Index = m_TextBuf.GetLength();
if (wChar >= 0xFB00 && wChar <= 0xFB06) {
- FX_LPWSTR pDst = NULL;
+ FX_WCHAR* pDst = NULL;
FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
pDst = FX_Alloc(FX_WCHAR, nCount);
@@ -1192,7 +1192,7 @@ void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i)
if(!IsControlChar(&Info)) {
Info.m_Index = m_TextBuf.GetLength();
FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE);
- FX_LPWSTR pDst = NULL;
+ FX_WCHAR* pDst = NULL;
FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst);
if (nCount >= 1) {
pDst = FX_Alloc(FX_WCHAR, nCount);
@@ -2564,7 +2564,7 @@ FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, in
}
return TRUE;
}
-FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString,
+FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString,
int iSubString, FX_WCHAR chSep)
{
if (lpszFullString == NULL) {
@@ -2581,7 +2581,7 @@ FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR
lpszFullString++;
}
}
- FX_LPCWSTR lpchEnd = FXSYS_wcschr(lpszFullString, chSep);
+ const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep);
int nLen = (lpchEnd == NULL) ?
(int)FXSYS_wcslen(lpszFullString) : (int)(lpchEnd - lpszFullString);
ASSERT(nLen >= 0);
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index 70c53d909f..87d527d942 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -157,7 +157,7 @@ public:
protected:
void ExtractFindWhat(const CFX_WideString& findwhat);
FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText, int startPos, int endPos);
- FX_BOOL ExtractSubString(CFX_WideString& rString, FX_LPCWSTR lpszFullString,
+ FX_BOOL ExtractSubString(CFX_WideString& rString, const FX_WCHAR* lpszFullString,
int iSubString, FX_WCHAR chSep);
CFX_WideString MakeReverse(const CFX_WideString& str);
int ReverseFind(const CFX_WideString& csPageText, const CFX_WideString& csWord, int nStartPos, int& WordLength);
@@ -215,7 +215,7 @@ private:
CFX_WideString m_strPageText;
FX_BOOL m_IsParserd;
};
-FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst);
+FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst);
void NormalizeString(CFX_WideString& str);
void NormalizeCompositeChar(FX_WCHAR wChar, CFX_WideString& sDest);
diff --git a/core/src/fpdftext/unicodenormalization.cpp b/core/src/fpdftext/unicodenormalization.cpp
index ad2f3f6aea..7b01830582 100644
--- a/core/src/fpdftext/unicodenormalization.cpp
+++ b/core/src/fpdftext/unicodenormalization.cpp
@@ -10,14 +10,14 @@ extern const FX_WCHAR g_UnicodeData_Normalization_Map1[];
extern const FX_WCHAR g_UnicodeData_Normalization_Map2[];
extern const FX_WCHAR g_UnicodeData_Normalization_Map3[];
extern const FX_WCHAR g_UnicodeData_Normalization_Map4[];
-FX_LPCWSTR g_UnicodeData_Normalization_Maps[5] = {
+const FX_WCHAR* g_UnicodeData_Normalization_Maps[5] = {
NULL,
g_UnicodeData_Normalization_Map1,
g_UnicodeData_Normalization_Map2,
g_UnicodeData_Normalization_Map3,
g_UnicodeData_Normalization_Map4
};
-FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst)
+FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_WCHAR* pDst)
{
wch = wch & 0xFFFF;
FX_WCHAR wFind = g_UnicodeData_Normalization[wch];
@@ -34,7 +34,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst)
wch = wFind & 0x0FFF;
wFind >>= 12;
}
- FX_LPCWSTR pMap = g_UnicodeData_Normalization_Maps[wFind];
+ const FX_WCHAR* pMap = g_UnicodeData_Normalization_Maps[wFind];
if (pMap == g_UnicodeData_Normalization_Map4) {
pMap = g_UnicodeData_Normalization_Map4 + wch;
wFind = (FX_WCHAR)(*pMap ++);
@@ -49,7 +49,7 @@ FX_STRSIZE FX_Unicode_GetNormalization(FX_WCHAR wch, FX_LPWSTR pDst)
}
return (FX_STRSIZE)wFind;
}
-FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst)
+FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_WCHAR* pDst)
{
FX_STRSIZE nCount = 0;
for (FX_STRSIZE len = 0; len < wsSrc.GetLength(); len ++) {
@@ -64,11 +64,11 @@ FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, FX_LPWSTR pDst)
}
FX_STRSIZE FX_WideString_GetNormalization(FX_WSTR wsSrc, CFX_WideString &wsDst)
{
- FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_LPWSTR)NULL);
+ FX_STRSIZE nLen = FX_WideString_GetNormalization(wsSrc, (FX_WCHAR*)NULL);
if (!nLen) {
return 0;
}
- FX_LPWSTR pBuf = wsDst.GetBuffer(nLen);
+ FX_WCHAR* pBuf = wsDst.GetBuffer(nLen);
FX_WideString_GetNormalization(wsSrc, pBuf);
wsDst.ReleaseBuffer(nLen);
return nLen;