diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-12-30 16:56:12 -0800 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-12-30 16:56:12 -0800 |
commit | 659a56bcbeb12b22708fe979d12b318080d828ba (patch) | |
tree | a2dcf561ef8db60344789adc97dbd690f828825c /core/src/fpdfapi/fpdf_parser | |
parent | 3fc36e8ba200e0dd6099a1f4d72c463c3e8a1d01 (diff) | |
download | pdfium-659a56bcbeb12b22708fe979d12b318080d828ba.tar.xz |
Get rid of FX_LPCSTR cast.
Follow up on https://codereview.chromium.org/733693003
R=brucedawson@chromium.org, tsepez@chromium.org
Review URL: https://codereview.chromium.org/809993004
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
5 files changed, 15 insertions, 15 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index f6daf40b8b..9514065eeb 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -438,7 +438,7 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap } CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap) { - return PDF_DecodeText((FX_LPCBYTE)(FX_LPCSTR)bstr, bstr.GetLength(), pCharMap); + return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); } CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 3dc0e551b4..b6d6dc70c0 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -25,12 +25,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)okey, okey.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength()); FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P")); CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) { FX_DWORD tag = (FX_DWORD) - 1; @@ -406,7 +406,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ } FXSYS_memset32(test, 0, sizeof(test)); FXSYS_memset32(tmpkey, 0, sizeof(tmpkey)); - FXSYS_memcpy32(test, (FX_LPCSTR)ukey, copy_len); + FXSYS_memcpy32(test, ukey.c_str(), copy_len); for (int i = 19; i >= 0; i --) { for (int j = 0; j < key_len; j ++) { tmpkey[j] = key[j] ^ i; @@ -419,12 +419,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ CPDF_Array* pIdArray = m_pParser->GetIDArray(); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } CRYPT_MD5Finish(md5, ukeybuf); return FXSYS_memcmp32(test, ukeybuf, 16) == 0; } - if (FXSYS_memcmp32((FX_LPVOID)(FX_LPCSTR)ukey, ukeybuf, 16) == 0) { + if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) { return TRUE; } return FALSE; @@ -461,7 +461,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa } FX_BYTE okeybuf[64]; FXSYS_memset32(okeybuf, 0, sizeof(okeybuf)); - FXSYS_memcpy32(okeybuf, (FX_LPCSTR)okey, okeylen); + FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { @@ -566,7 +566,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } FX_BYTE digest[32]; CRYPT_MD5Finish(md5, digest); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 07b447b1b6..c477ba6f6e 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -328,7 +328,7 @@ void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len) ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); } else if (m_Type == PDFOBJ_STREAM) { CFX_ByteString result = PDF_EncodeText(pUnicodes, len); - ((CPDF_Stream*)this)->SetData((FX_LPBYTE)(FX_LPCSTR)result, result.GetLength(), FALSE, FALSE); + ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE); } } CPDF_Number::CPDF_Number(int value) diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 9fa26d87ae..08cc9e5b51 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2194,9 +2194,9 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO } if (key.GetLength() >= 1) { if (nKeys < 32) { - pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } else { - pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } } } @@ -2380,9 +2380,9 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList return NULL; } if (key.GetLength() == 1) { - pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } else { - pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } } if (pContext) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 7559bcee91..e5e68c2f5c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -284,14 +284,14 @@ CFX_ByteString PDF_NameDecode(FX_BSTR bstr) } CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) { - if (FXSYS_memchr((FX_LPCSTR)orig, '#', orig.GetLength()) == NULL) { + if (FXSYS_memchr(orig.c_str(), '#', orig.GetLength()) == NULL) { return orig; } return PDF_NameDecode(CFX_ByteStringC(orig)); } CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { - FX_LPBYTE src_buf = (FX_LPBYTE)(FX_LPCSTR)orig; + FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str(); int src_len = orig.GetLength(); int dest_len = 0; int i; |