summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_basic.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-04 16:41:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-04 16:41:35 -0700
commit28f97ff783c16f3391384ce97b765ce4eb310ac7 (patch)
tree69c4c8bc9dd39d5336c96f28b633d197dd207c81 /core/fpdfdoc/doc_basic.cpp
parented9c4386713084f37548b46ab36f618021f716f5 (diff)
downloadpdfium-28f97ff783c16f3391384ce97b765ce4eb310ac7.tar.xz
Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.
Having this happen implicitly can be dangerous because the lifetime has to be considered; we should have caught the "red bots" in https://codereview.chromium.org/1847333004/#ps60001 at compile time. Review URL: https://codereview.chromium.org/1853233002
Diffstat (limited to 'core/fpdfdoc/doc_basic.cpp')
-rw-r--r--core/fpdfdoc/doc_basic.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index c711709e73..0c7f895405 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -90,12 +90,13 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (pLimits) {
CFX_ByteString csLeft = pLimits->GetStringAt(0);
CFX_ByteString csRight = pLimits->GetStringAt(1);
- if (csLeft.Compare(csRight) > 0) {
+ if (csLeft.Compare(csRight.AsByteStringC()) > 0) {
CFX_ByteString csTmp = csRight;
csRight = csLeft;
csLeft = csTmp;
}
- if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) {
+ if (csName.Compare(csLeft.AsByteStringC()) < 0 ||
+ csName.Compare(csRight.AsByteStringC()) > 0) {
return NULL;
}
}
@@ -104,7 +105,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
uint32_t dwCount = pNames->GetCount() / 2;
for (uint32_t i = 0; i < dwCount; i++) {
CFX_ByteString csValue = pNames->GetStringAt(i * 2);
- int32_t iCompare = csValue.Compare(csName);
+ int32_t iCompare = csValue.Compare(csName.AsByteStringC());
if (iCompare <= 0) {
if (ppFind) {
*ppFind = pNames;
@@ -500,7 +501,7 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
CFX_ByteString bsOrig = bsLabel;
for (int i = 0; i < nPages; i++) {
bsLbl = PDF_EncodeText(GetLabel(i));
- if (!bsLbl.Compare(bsOrig)) {
+ if (!bsLbl.Compare(bsOrig.AsByteStringC())) {
return i;
}
}
@@ -512,6 +513,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
return -1;
}
int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
- CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr());
- return GetPageByLabel(bsLabel);
+ return GetPageByLabel(PDF_EncodeText(wsLabel.GetPtr()).AsByteStringC());
}