summaryrefslogtreecommitdiff
path: root/fxbarcode/datamatrix
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-01 15:11:12 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-01 19:23:04 +0000
commita2188df09255b49ad41a89ae9b5de640d0b03126 (patch)
treee8fb878b806b96d795a30206347669e709ee29bf /fxbarcode/datamatrix
parent7558414b8aa1d14ce02e360dd88e4f421cee8725 (diff)
downloadpdfium-a2188df09255b49ad41a89ae9b5de640d0b03126.tar.xz
Cleanup usages of Mid(foo, 1), Right(1), and Left(1)chromium/3203
Mid(foo, 1) is equivalent to [foo], if all you want is the character. Similarly Left(1) is [0]. It is faster also, since it does not need to create intermediate strings. Right(1) is a touch more tricky, since it requires something like GetLength() ? [GetLength() - 1] : 0;. A new method, Last() has been added to perform this character extraction. Multiple call sites have been updated to use more efficient/simpler syntax. There are a number of call sites that use on these patterns, but based on the surrounding context we actually need/want a string, so they have not been modified. Change-Id: I485a7f9c7b34c9bdacecada610158f996816afdd Reviewed-on: https://pdfium-review.googlesource.com/12890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxbarcode/datamatrix')
-rw-r--r--fxbarcode/datamatrix/BC_HighLevelEncoder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 8b8b413c9b..d2f40dd060 100644
--- a/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -76,12 +76,12 @@ CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
return CFX_WideString();
context.setAllowRectangular(allowRectangular);
- if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Right(1) == MACRO_TRAILER)) {
+ if ((msg.Left(6) == MACRO_05_HEADER) && (msg.Last() == MACRO_TRAILER)) {
context.writeCodeword(MACRO_05);
context.setSkipAtEnd(2);
context.m_pos += 6;
} else if ((msg.Left(6) == MACRO_06_HEADER) &&
- (msg.Right(1) == MACRO_TRAILER)) {
+ (msg.Last() == MACRO_TRAILER)) {
context.writeCodeword(MACRO_06);
context.setSkipAtEnd(2);
context.m_pos += 6;