Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2688)

Unified Diff: core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 7a01bba97a487345d77ef1167ed712dd49ce3436..f70b9ecfc4ceb7978e600c0028cbec31835fd939 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -641,22 +641,23 @@ int CPDF_CMap::AppendChar(FX_CHAR* str, FX_DWORD charcode) const
}
str[iSize - 1] = (uint8_t)charcode;
return iSize;
- } else if (charcode < 0x10000) {
+ }
+ if (charcode < 0x10000) {
str[0] = (uint8_t)(charcode >> 8);
str[1] = (uint8_t)charcode;
return 2;
- } else if (charcode < 0x1000000) {
+ }
+ if (charcode < 0x1000000) {
str[0] = (uint8_t)(charcode >> 16);
str[1] = (uint8_t)(charcode >> 8);
str[2] = (uint8_t)charcode;
return 3;
- } else {
- str[0] = (uint8_t)(charcode >> 24);
- str[1] = (uint8_t)(charcode >> 16);
- str[2] = (uint8_t)(charcode >> 8);
- str[3] = (uint8_t)charcode;
- return 4;
}
+ str[0] = (uint8_t)(charcode >> 24);
+ str[1] = (uint8_t)(charcode >> 16);
+ str[2] = (uint8_t)(charcode >> 8);
+ str[3] = (uint8_t)charcode;
+ return 4;
}
return 0;
}
@@ -794,9 +795,8 @@ FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const
#endif
if (m_pCMap->m_pEmbedMap) {
return _EmbeddedUnicodeFromCharcode(m_pCMap->m_pEmbedMap, m_pCMap->m_Charset, charcode);
- } else {
- return 0;
}
+ return 0;
}
return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
}
@@ -826,7 +826,8 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const
if (unicode < 0x80) {
return static_cast<FX_DWORD>(unicode);
- } else if (m_pCMap->m_Coding == CIDCODING_CID) {
+ }
+ if (m_pCMap->m_Coding == CIDCODING_CID) {
return 0;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -834,14 +835,15 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const
int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &unicode, 1, (char*)buffer, 4, NULL, NULL);
if (ret == 1) {
return buffer[0];
- } else if (ret == 2) {
+ }
+ if (ret == 2) {
return buffer[0] * 256 + buffer[1];
}
- return 0;
-#endif
+#else
if (m_pCMap->m_pEmbedMap) {
return _EmbeddedCharcodeFromUnicode(m_pCMap->m_pEmbedMap, m_pCMap->m_Charset, unicode);
}
+#endif
return 0;
}
static void FT_UseCIDCharmap(FXFT_Face face, int coding)
@@ -1234,9 +1236,8 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
}
if (index == 0 || index == 0xffff) {
return charcode == 0 ? -1 : (int)charcode;
- } else {
- return index;
}
+ return index;
}
if (m_Charset == CIDSET_JAPAN1) {
if (unicode == '\\') {
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698