summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp')
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp132
1 files changed, 64 insertions, 68 deletions
diff --git a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp
index afccce598f..ecd20cd5e5 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_TextEncoder.cpp
@@ -30,73 +30,69 @@
#include "BC_HighLevelEncoder.h"
#include "BC_C40Encoder.h"
#include "BC_TextEncoder.h"
-CBC_TextEncoder::CBC_TextEncoder()
-{
+CBC_TextEncoder::CBC_TextEncoder() {}
+CBC_TextEncoder::~CBC_TextEncoder() {}
+int32_t CBC_TextEncoder::getEncodingMode() {
+ return TEXT_ENCODATION;
}
-CBC_TextEncoder::~CBC_TextEncoder()
-{
-}
-int32_t CBC_TextEncoder::getEncodingMode()
-{
- return TEXT_ENCODATION;
-}
-int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c, CFX_WideString &sb, int32_t &e)
-{
- if (c == ' ') {
- sb += (FX_WCHAR)'\3';
- return 1;
- }
- if (c >= '0' && c <= '9') {
- sb += (FX_WCHAR) (c - 48 + 4);
- return 1;
- }
- if (c >= 'a' && c <= 'z') {
- sb += (FX_WCHAR) (c - 97 + 14);
- return 1;
- }
- if (c >= '\0' && c <= 0x1f) {
- sb += (FX_WCHAR)'\0';
- sb += c;
- return 2;
- }
- if (c >= '!' && c <= '/') {
- sb += (FX_WCHAR) '\1';
- sb += (FX_WCHAR) (c - 33);
- return 2;
- }
- if (c >= ':' && c <= '@') {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR) (c - 58 + 15);
- return 2;
- }
- if (c >= '[' && c <= '_') {
- sb += (FX_WCHAR) '\1';
- sb += (FX_WCHAR) (c - 91 + 22);
- return 2;
- }
- if (c == 0x0060) {
- sb += (FX_WCHAR) '\2';
- sb += (FX_WCHAR) (c - 96);
- return 2;
- }
- if (c >= 'A' && c <= 'Z') {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR) (c - 65 + 1);
- return 2;
- }
- if (c >= '{' && c <= 0x007f) {
- sb += (FX_WCHAR)'\2';
- sb += (FX_WCHAR) (c - 123 + 27);
- return 2;
- }
- if (c >= 0x0080) {
- sb += (FX_WCHAR)'\1';
- sb += (FX_WCHAR)0x001e;
- int32_t len = 2;
- len += encodeChar((FX_WCHAR) (c - 128), sb, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, -1);
- return len;
- }
- CBC_HighLevelEncoder::illegalCharacter(c, e);
- return -1;
+int32_t CBC_TextEncoder::encodeChar(FX_WCHAR c,
+ CFX_WideString& sb,
+ int32_t& e) {
+ if (c == ' ') {
+ sb += (FX_WCHAR)'\3';
+ return 1;
+ }
+ if (c >= '0' && c <= '9') {
+ sb += (FX_WCHAR)(c - 48 + 4);
+ return 1;
+ }
+ if (c >= 'a' && c <= 'z') {
+ sb += (FX_WCHAR)(c - 97 + 14);
+ return 1;
+ }
+ if (c >= '\0' && c <= 0x1f) {
+ sb += (FX_WCHAR)'\0';
+ sb += c;
+ return 2;
+ }
+ if (c >= '!' && c <= '/') {
+ sb += (FX_WCHAR)'\1';
+ sb += (FX_WCHAR)(c - 33);
+ return 2;
+ }
+ if (c >= ':' && c <= '@') {
+ sb += (FX_WCHAR)'\1';
+ sb += (FX_WCHAR)(c - 58 + 15);
+ return 2;
+ }
+ if (c >= '[' && c <= '_') {
+ sb += (FX_WCHAR)'\1';
+ sb += (FX_WCHAR)(c - 91 + 22);
+ return 2;
+ }
+ if (c == 0x0060) {
+ sb += (FX_WCHAR)'\2';
+ sb += (FX_WCHAR)(c - 96);
+ return 2;
+ }
+ if (c >= 'A' && c <= 'Z') {
+ sb += (FX_WCHAR)'\2';
+ sb += (FX_WCHAR)(c - 65 + 1);
+ return 2;
+ }
+ if (c >= '{' && c <= 0x007f) {
+ sb += (FX_WCHAR)'\2';
+ sb += (FX_WCHAR)(c - 123 + 27);
+ return 2;
+ }
+ if (c >= 0x0080) {
+ sb += (FX_WCHAR)'\1';
+ sb += (FX_WCHAR)0x001e;
+ int32_t len = 2;
+ len += encodeChar((FX_WCHAR)(c - 128), sb, e);
+ BC_EXCEPTION_CHECK_ReturnValue(e, -1);
+ return len;
+ }
+ CBC_HighLevelEncoder::illegalCharacter(c, e);
+ return -1;
}