Chromium Code Reviews| Index: fpdfsdk/fpdfppo.cpp |
| diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp |
| index 777310bb2b59778424eb6286cfbc6e9878b27f9a..73785488be61f828a5f194d09203a695e9fd6525 100644 |
| --- a/fpdfsdk/fpdfppo.cpp |
| +++ b/fpdfsdk/fpdfppo.cpp |
| @@ -191,12 +191,12 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( |
| if (!pp) |
| return nullptr; |
| - if (pDict->KeyExist((const char*)nSrctag)) |
| - return pDict->GetObjectBy((const char*)nSrctag); |
| + if (pDict->KeyExist(nSrctag.AsStringC())) |
|
Lei Zhang
2016/04/13 21:54:58
Call AsStringC once and reuse the resulting object
Tom Sepez
2016/04/13 22:25:19
Ok, but AsStringC is cheap since it just copies tw
|
| + return pDict->GetObjectBy(nSrctag.AsStringC()); |
| while (pp) { |
| - if (pp->KeyExist((const char*)nSrctag)) |
| - return pp->GetObjectBy((const char*)nSrctag); |
| + if (pp->KeyExist(nSrctag.AsStringC())) |
| + return pp->GetObjectBy(nSrctag.AsStringC()); |
| if (!pp->KeyExist("Parent")) |
| break; |
| pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); |
| @@ -223,8 +223,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, |
| const CFX_ByteString& key = it->first; |
| CPDF_Object* pNextObj = it->second; |
| ++it; |
| - if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") || |
| - !FXSYS_strcmp(key, "First")) { |
| + if (!FXSYS_strcmp(key.c_str(), "Parent") || |
| + !FXSYS_strcmp(key.c_str(), "Prev") || |
| + !FXSYS_strcmp(key.c_str(), "First")) { |
| continue; |
| } |
| if (pNextObj) { |
| @@ -290,11 +291,11 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, |
| if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { |
| if (pDictClone->KeyExist("Type")) { |
| CFX_ByteString strType = pDictClone->GetStringBy("Type"); |
| - if (!FXSYS_stricmp(strType, "Pages")) { |
| + if (!FXSYS_stricmp(strType.c_str(), "Pages")) { |
| pDictClone->Release(); |
| return 4; |
| } |
| - if (!FXSYS_stricmp(strType, "Page")) { |
| + if (!FXSYS_stricmp(strType.c_str(), "Page")) { |
| pDictClone->Release(); |
| return 0; |
| } |
| @@ -330,12 +331,12 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, |
| cbMidRange = rangstring.Mid(nStringFrom, nStringTo - nStringFrom); |
| int nMid = cbMidRange.Find('-'); |
| if (nMid == -1) { |
| - long lPageNum = atol(cbMidRange); |
| + long lPageNum = atol(cbMidRange.c_str()); |
| if (lPageNum <= 0 || lPageNum > nCount) |
| return FALSE; |
| pageArray->push_back((uint16_t)lPageNum); |
| } else { |
| - int nStartPageNum = atol(cbMidRange.Mid(0, nMid)); |
| + int nStartPageNum = atol(cbMidRange.Mid(0, nMid).c_str()); |
| if (nStartPageNum == 0) |
| return FALSE; |
| @@ -344,7 +345,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, |
| if (nEnd == 0) |
| return FALSE; |
| - int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd)); |
| + int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd).c_str()); |
| if (nStartPageNum < 0 || nStartPageNum > nEndPageNum || |
| nEndPageNum > nCount) { |
| return FALSE; |