summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_formcalc_context.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-20 19:05:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-20 19:05:00 +0000
commitcc42afc14b6e54750a95b0e5fd7f01664280c36e (patch)
treefc5d57db9d91bf2ba4581d001d08e7c0f58a725c /fxjs/cfxjse_formcalc_context.cpp
parent1986bdfb19614b1bf18941b89ded895e237b53ae (diff)
downloadpdfium-cc42afc14b6e54750a95b0e5fd7f01664280c36e.tar.xz
Combine operator< and ByteString::Compare().
Fix or optimize some ByteString::Compare() callers. Change-Id: I0fde91afc3d17fe160b46d00a441ad05e56377e7 Reviewed-on: https://pdfium-review.googlesource.com/20851 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_formcalc_context.cpp')
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index b02e5a9d41..f9d130a119 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -4976,9 +4976,9 @@ void CFXJSE_FormCalcContext::less_operator(CFXJSE_Value* pThis,
}
if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringView()) ==
- -1);
+ int result =
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) < 0;
+ args.GetReturnValue()->SetInteger(result);
return;
}
@@ -5006,9 +5006,9 @@ void CFXJSE_FormCalcContext::lessequal_operator(
}
if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringView()) !=
- 1);
+ int result =
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) <= 0;
+ args.GetReturnValue()->SetInteger(result);
return;
}
@@ -5034,9 +5034,9 @@ void CFXJSE_FormCalcContext::greater_operator(CFXJSE_Value* pThis,
}
if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringView()) ==
- 1);
+ int result =
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) > 0;
+ args.GetReturnValue()->SetInteger(result);
return;
}
@@ -5064,9 +5064,9 @@ void CFXJSE_FormCalcContext::greaterequal_operator(
}
if (argFirst->IsString() && argSecond->IsString()) {
- args.GetReturnValue()->SetInteger(
- argFirst->ToString().Compare(argSecond->ToString().AsStringView()) !=
- -1);
+ int result =
+ argFirst->ToString().Compare(argSecond->ToString().AsStringView()) >= 0;
+ args.GetReturnValue()->SetInteger(result);
return;
}