diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
commit | 9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch) | |
tree | c97037f398d714665aefccb6eb54d0969ad7030c /xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp | |
parent | 780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff) | |
download | pdfium-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/pdf417/BC_PDF417Reader.cpp')
-rw-r--r-- | xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp | 146 |
1 files changed, 87 insertions, 59 deletions
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp index a880317ee0..f970d700dc 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp @@ -50,70 +50,98 @@ #include "BC_PDF417DecodedBitStreamParser.h"
#include "BC_PDF417ScanningDecoder.h"
#include "BC_PDF417Reader.h"
-#define Integer_MAX_VALUE 2147483647
-CBC_PDF417Reader::CBC_PDF417Reader()
-{
+#define Integer_MAX_VALUE 2147483647
+CBC_PDF417Reader::CBC_PDF417Reader() {}
+CBC_PDF417Reader::~CBC_PDF417Reader() {}
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image, int32_t& e) {
+ return Decode(image, 0, e);
}
-CBC_PDF417Reader::~CBC_PDF417Reader()
-{
-}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t &e)
-{
- return Decode(image, 0, e);
-}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, int32_t hints, int32_t &e)
-{
- CFX_ByteString results;
- CBC_PDF417DetectorResult* detectorResult = CBC_Detector::detect(image, hints, multiple, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, "");
- for (int32_t i = 0; i < detectorResult->getPoints()->GetSize(); i++) {
- CFX_PtrArray* points = (CFX_PtrArray*)detectorResult->getPoints()->GetAt(i);
- CBC_CommonDecoderResult* ResultTemp = CBC_PDF417ScanningDecoder::decode(detectorResult->getBits(), (CBC_ResultPoint*)points->GetAt(4), (CBC_ResultPoint*)points->GetAt(5),
- (CBC_ResultPoint*)points->GetAt(6), (CBC_ResultPoint*)points->GetAt(7), getMinCodewordWidth(*points), getMaxCodewordWidth(*points), e);
- if (ResultTemp == NULL) {
- delete detectorResult;
- e = BCExceptiontNotFoundInstance;
- return "";
- }
- results += ResultTemp->GetText();
- delete ResultTemp;
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image,
+ FX_BOOL multiple,
+ int32_t hints,
+ int32_t& e) {
+ CFX_ByteString results;
+ CBC_PDF417DetectorResult* detectorResult =
+ CBC_Detector::detect(image, hints, multiple, e);
+ BC_EXCEPTION_CHECK_ReturnValue(e, "");
+ for (int32_t i = 0; i < detectorResult->getPoints()->GetSize(); i++) {
+ CFX_PtrArray* points = (CFX_PtrArray*)detectorResult->getPoints()->GetAt(i);
+ CBC_CommonDecoderResult* ResultTemp = CBC_PDF417ScanningDecoder::decode(
+ detectorResult->getBits(), (CBC_ResultPoint*)points->GetAt(4),
+ (CBC_ResultPoint*)points->GetAt(5), (CBC_ResultPoint*)points->GetAt(6),
+ (CBC_ResultPoint*)points->GetAt(7), getMinCodewordWidth(*points),
+ getMaxCodewordWidth(*points), e);
+ if (ResultTemp == NULL) {
+ delete detectorResult;
+ e = BCExceptiontNotFoundInstance;
+ return "";
}
- delete detectorResult;
- return results;
+ results += ResultTemp->GetText();
+ delete ResultTemp;
+ }
+ delete detectorResult;
+ return results;
}
-CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
-{
- CFX_ByteString bs = Decode(image, FALSE, 0, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, "");
- return bs;
+CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image,
+ int32_t hints,
+ int32_t& e) {
+ CFX_ByteString bs = Decode(image, FALSE, 0, e);
+ BC_EXCEPTION_CHECK_ReturnValue(e, "");
+ return bs;
}
-int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
-{
- if (p1 == NULL || p2 == NULL) {
- return 0;
- }
- return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX());
+int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1,
+ CBC_ResultPoint* p2) {
+ if (p1 == NULL || p2 == NULL) {
+ return 0;
+ }
+ return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
-int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2)
-{
- if (p1 == NULL || p2 == NULL) {
- return Integer_MAX_VALUE;
- }
- return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX());
+int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,
+ CBC_ResultPoint* p2) {
+ if (p1 == NULL || p2 == NULL) {
+ return Integer_MAX_VALUE;
+ }
+ return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
-int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p)
-{
- int32_t a = getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t b = getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
- int32_t d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
- return c < d ? c : d;
+int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p) {
+ int32_t a =
+ getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b =
+ getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0),
+ (CBC_ResultPoint*)p.GetAt(4)) < a
+ ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0),
+ (CBC_ResultPoint*)p.GetAt(4))
+ : a;
+ int32_t d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1),
+ (CBC_ResultPoint*)p.GetAt(5)) < b
+ ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1),
+ (CBC_ResultPoint*)p.GetAt(5))
+ : b;
+ return c < d ? c : d;
}
-int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p)
-{
- int32_t a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
- int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a;
- int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b;
- return c < d ? c : d;
+int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p) {
+ int32_t a =
+ getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t b =
+ getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) *
+ CBC_PDF417Common::MODULES_IN_CODEWORD /
+ CBC_PDF417Common::MODULES_IN_STOP_PATTERN;
+ int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0),
+ (CBC_ResultPoint*)p.GetAt(4)) < a
+ ? getMinWidth((CBC_ResultPoint*)p.GetAt(0),
+ (CBC_ResultPoint*)p.GetAt(4))
+ : a;
+ int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1),
+ (CBC_ResultPoint*)p.GetAt(5)) < b
+ ? getMinWidth((CBC_ResultPoint*)p.GetAt(1),
+ (CBC_ResultPoint*)p.GetAt(5))
+ : b;
+ return c < d ? c : d;
}
|