summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-09-29 09:43:00 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-29 09:43:00 -0700
commit561867e2b95a3872c2aed3b74a7e918816d56851 (patch)
tree320344290ae7449dbbe0057d385e30272ba4f205 /core/fpdfapi
parent37fa2835becf6c5ed4c9b7c8042493c2a00f642e (diff)
downloadpdfium-561867e2b95a3872c2aed3b74a7e918816d56851.tar.xz
Remove FX_BOOL from font_int.h
It is not necessary. For some methods, bool can be used instead. For some other methods, the returned boolean is never used, so they can be void. Review-Url: https://codereview.chromium.org/2382803002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp4
-rw-r--r--core/fpdfapi/fpdf_font/font_int.h28
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp50
3 files changed, 37 insertions, 45 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 35d30b3fe3..dbad4e547a 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -829,8 +829,8 @@ void CPDF_CIDFont::LoadGB2312() {
m_Charset = CIDSET_GB1;
m_bType1 = false;
CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager;
- m_pCMap = manager.GetPredefinedCMap("GBK-EUC-H", FALSE);
- m_pCID2UnicodeMap = manager.GetCID2UnicodeMap(m_Charset, FALSE);
+ m_pCMap = manager.GetPredefinedCMap("GBK-EUC-H", false);
+ m_pCID2UnicodeMap = manager.GetCID2UnicodeMap(m_Charset, false);
if (!IsEmbedded())
LoadSubstFont();
diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h
index f0d5724577..3a30b54c02 100644
--- a/core/fpdfapi/fpdf_font/font_int.h
+++ b/core/fpdfapi/fpdf_font/font_int.h
@@ -29,13 +29,12 @@ class CPDF_CMapManager {
CPDF_CMapManager();
~CPDF_CMapManager();
- void* GetPackage(FX_BOOL bPrompt);
- CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK);
- CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, FX_BOOL bPromptCJK);
+ CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK);
+ CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK);
- CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(CIDSet charset, FX_BOOL bPromptCJK);
+ CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK);
+ CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
std::map<CFX_ByteString, CPDF_CMap*> m_CMaps;
CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6];
@@ -91,7 +90,7 @@ class CPDF_CMapParser {
public:
CPDF_CMapParser();
~CPDF_CMapParser();
- FX_BOOL Initialize(CPDF_CMap* pMap);
+ void Initialize(CPDF_CMap* pMap);
void ParseWord(const CFX_ByteStringC& str);
CFX_BinaryBuf m_AddMaps;
@@ -135,12 +134,12 @@ class CPDF_CMap {
CPDF_CMap();
~CPDF_CMap();
- FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& name,
- FX_BOOL bPromptCJK);
- FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
+ void LoadPredefined(CPDF_CMapManager* pMgr,
+ const CFX_ByteString& name,
+ bool bPromptCJK);
+ void LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
- FX_BOOL IsLoaded() const;
+ bool IsLoaded() const;
bool IsVertWriting() const;
uint16_t CIDFromCharCode(uint32_t charcode) const;
int GetCharSize(uint32_t charcode) const;
@@ -161,7 +160,7 @@ class CPDF_CMap {
uint8_t* m_pLeadingBytes;
uint16_t* m_pMapping;
uint8_t* m_pAddMapping;
- FX_BOOL m_bLoaded;
+ bool m_bLoaded;
const FXCMAP_CMap* m_pEmbedMap;
};
@@ -170,9 +169,8 @@ class CPDF_CID2UnicodeMap {
CPDF_CID2UnicodeMap();
~CPDF_CID2UnicodeMap();
- FX_BOOL Initialize();
- FX_BOOL IsLoaded();
- void Load(CPDF_CMapManager* pMgr, CIDSet charset, FX_BOOL bPromptCJK);
+ bool IsLoaded();
+ void Load(CPDF_CMapManager* pMgr, CIDSet charset, bool bPromptCJK);
FX_WCHAR UnicodeFromCID(uint16_t CID);
private:
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 93d29d9bc7..da6923d6c7 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -291,7 +291,7 @@ CPDF_CMapManager::~CPDF_CMapManager() {
}
}
CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name,
- FX_BOOL bPromptCJK) {
+ bool bPromptCJK) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end()) {
return it->second;
@@ -303,7 +303,7 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name,
return pCMap;
}
CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name,
- FX_BOOL bPromptCJK) {
+ bool bPromptCJK) {
CPDF_CMap* pCMap = new CPDF_CMap;
const FX_CHAR* pname = name.c_str();
if (*pname == '/') {
@@ -314,18 +314,14 @@ CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name,
}
CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(CIDSet charset,
- FX_BOOL bPromptCJK) {
+ bool bPromptCJK) {
if (!m_CID2UnicodeMaps[charset])
m_CID2UnicodeMaps[charset] = LoadCID2UnicodeMap(charset, bPromptCJK);
return m_CID2UnicodeMaps[charset];
}
CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(CIDSet charset,
- FX_BOOL bPromptCJK) {
+ bool bPromptCJK) {
CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap();
- if (!pMap->Initialize()) {
- delete pMap;
- return nullptr;
- }
pMap->Load(this, charset, bPromptCJK);
return pMap;
}
@@ -335,12 +331,11 @@ CPDF_CMapParser::CPDF_CMapParser()
CPDF_CMapParser::~CPDF_CMapParser() {}
-FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap) {
+void CPDF_CMapParser::Initialize(CPDF_CMap* pCMap) {
m_pCMap = pCMap;
m_Status = 0;
m_CodeSeq = 0;
m_AddMaps.EstimateSize(0, 10240);
- return TRUE;
}
void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
@@ -501,7 +496,7 @@ CPDF_CMap::CPDF_CMap() {
m_Coding = CIDCODING_UNKNOWN;
m_CodingScheme = TwoBytes;
m_bVertical = false;
- m_bLoaded = FALSE;
+ m_bLoaded = false;
m_pMapping = nullptr;
m_pLeadingBytes = nullptr;
m_pAddMapping = nullptr;
@@ -514,7 +509,7 @@ CPDF_CMap::~CPDF_CMap() {
FX_Free(m_pLeadingBytes);
}
-FX_BOOL CPDF_CMap::IsLoaded() const {
+bool CPDF_CMap::IsLoaded() const {
return m_bLoaded;
}
@@ -522,15 +517,15 @@ bool CPDF_CMap::IsVertWriting() const {
return m_bVertical;
}
-FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& bsName,
- FX_BOOL bPromptCJK) {
+void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
+ const CFX_ByteString& bsName,
+ bool bPromptCJK) {
m_PredefinedCMap = bsName;
if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
m_Coding = CIDCODING_CID;
m_bVertical = bsName[9] == 'V';
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
+ return;
}
CFX_ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Right(1) == "V";
@@ -545,7 +540,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
}
}
if (!map)
- return FALSE;
+ return;
m_Charset = map->m_Charset;
m_Coding = map->m_Coding;
@@ -561,13 +556,12 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
}
FPDFAPI_FindEmbeddedCMap(bsName, m_Charset, m_Coding, m_pEmbedMap);
if (!m_pEmbedMap)
- return FALSE;
+ return;
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
}
-FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
+void CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
m_pMapping = FX_Alloc(uint16_t, 65536);
CPDF_CMapParser parser;
parser.Initialize(this);
@@ -587,7 +581,6 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8,
CompareDWORD);
}
- return TRUE;
}
uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
@@ -750,16 +743,17 @@ int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const {
}
return 0;
}
+
CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap() {
m_EmbeddedCount = 0;
}
+
CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap() {}
-FX_BOOL CPDF_CID2UnicodeMap::Initialize() {
- return TRUE;
-}
-FX_BOOL CPDF_CID2UnicodeMap::IsLoaded() {
+
+bool CPDF_CID2UnicodeMap::IsLoaded() {
return m_EmbeddedCount != 0;
}
+
FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
if (m_Charset == CIDSET_UNICODE) {
return CID;
@@ -772,7 +766,7 @@ FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr,
CIDSet charset,
- FX_BOOL bPromptCJK) {
+ bool bPromptCJK) {
m_Charset = charset;
CPDF_FontGlobals* pFontGlobals =