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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp

Issue 1977093002: Make CFX_ByteString(const CFX_ByteStringC&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nit Created 4 years, 7 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/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
index 38099e0328bb30dda3c4709f674a8de93a855d6b..d6416fb05530d8506d364393806d6e739822c3ea 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
@@ -112,10 +112,11 @@ FX_BOOL CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
uint32_t CPDF_SecurityHandler::GetPermissions() {
return m_Permissions;
}
-static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
- const CFX_ByteStringC& name,
- int& cipher,
- int& keylen) {
+
+static FX_BOOL LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
+ const CFX_ByteString& name,
+ int& cipher,
+ int& keylen) {
int Version = pEncryptDict->GetIntegerBy("V");
cipher = FXCIPHER_RC4;
keylen = 0;
@@ -163,19 +164,15 @@ FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_Version = pEncryptDict->GetIntegerBy("V");
m_Revision = pEncryptDict->GetIntegerBy("R");
m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
- if (m_Version < 4) {
- return _LoadCryptInfo(pEncryptDict, CFX_ByteStringC(), m_Cipher, m_KeyLen);
- }
+ if (m_Version < 4)
+ return LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
+
CFX_ByteString stmf_name = pEncryptDict->GetStringBy("StmF");
CFX_ByteString strf_name = pEncryptDict->GetStringBy("StrF");
- if (stmf_name != strf_name) {
+ if (stmf_name != strf_name)
return FALSE;
- }
- if (!_LoadCryptInfo(pEncryptDict, strf_name.AsStringC(), m_Cipher,
- m_KeyLen)) {
- return FALSE;
- }
- return TRUE;
+
+ return LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen);
}
FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
@@ -186,17 +183,18 @@ FX_BOOL CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
m_Version = pEncryptDict->GetIntegerBy("V");
m_Revision = pEncryptDict->GetIntegerBy("R");
m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
- CFX_ByteString strf_name, stmf_name;
+
+ CFX_ByteString strf_name;
+ CFX_ByteString stmf_name;
if (m_Version >= 4) {
stmf_name = pEncryptDict->GetStringBy("StmF");
strf_name = pEncryptDict->GetStringBy("StrF");
- if (stmf_name != strf_name) {
+ if (stmf_name != strf_name)
return FALSE;
- }
}
- if (!_LoadCryptInfo(pEncryptDict, strf_name.AsStringC(), cipher, key_len)) {
+ if (!LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len))
return FALSE;
- }
+
m_Cipher = cipher;
m_KeyLen = key_len;
return TRUE;
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_document.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698