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/qrcode/BC_QRCodeWriter.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/qrcode/BC_QRCodeWriter.cpp')
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp | 132 |
1 files changed, 68 insertions, 64 deletions
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp index c52ec8e4bb..65891a5edb 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -29,75 +29,79 @@ #include "BC_QRCoder.h"
#include "BC_QRCodeReader.h"
#include "BC_QRCoderErrorCorrectionLevel.h"
-CBC_QRCodeWriter::CBC_QRCodeWriter()
-{
- m_bFixedSize = TRUE;
- m_iCorrectLevel = 1;
- m_iVersion = 0;
+CBC_QRCodeWriter::CBC_QRCodeWriter() {
+ m_bFixedSize = TRUE;
+ m_iCorrectLevel = 1;
+ m_iVersion = 0;
}
-CBC_QRCodeWriter::~CBC_QRCodeWriter()
-{
+CBC_QRCodeWriter::~CBC_QRCodeWriter() {}
+void CBC_QRCodeWriter::ReleaseAll() {
+ CBC_QRCodeReader::ReleaseAll();
}
-void CBC_QRCodeWriter::ReleaseAll()
-{
- CBC_QRCodeReader::ReleaseAll();
+FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version) {
+ if (version < 0 || version > 40) {
+ return FALSE;
+ }
+ m_iVersion = version;
+ return TRUE;
}
-FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version)
-{
- if (version < 0 || version > 40) {
- return FALSE;
- }
- m_iVersion = version;
- return TRUE;
-}
-FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level)
-{
- if (level < 0 || level > 3) {
- return FALSE;
- }
- m_iCorrectLevel = level;
- return TRUE;
+FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
+ if (level < 0 || level > 3) {
+ return FALSE;
+ }
+ m_iCorrectLevel = level;
+ return TRUE;
}
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e)
-{
- CBC_QRCoderErrorCorrectionLevel *ec = NULL;
- switch(ecLevel) {
- case 0:
- ec = CBC_QRCoderErrorCorrectionLevel::L;
- break;
- case 1:
- ec = CBC_QRCoderErrorCorrectionLevel::M;
- break;
- case 2:
- ec = CBC_QRCoderErrorCorrectionLevel::Q;
- break;
- case 3:
- ec = CBC_QRCoderErrorCorrectionLevel::H;
- break;
- default: {
- e = BCExceptionUnSupportEclevel;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
- }
- CBC_QRCoder qr;
- if (m_iVersion > 0 && m_iVersion < 41) {
- CFX_ByteString byteStr = contents.UTF8Encode();
- CBC_QRCoderEncoder::Encode(byteStr, ec, &qr, e, m_iVersion);
- } else {
- CBC_QRCoderEncoder::Encode(contents, ec, &qr, e);
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
+ int32_t ecLevel,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ CBC_QRCoderErrorCorrectionLevel* ec = NULL;
+ switch (ecLevel) {
+ case 0:
+ ec = CBC_QRCoderErrorCorrectionLevel::L;
+ break;
+ case 1:
+ ec = CBC_QRCoderErrorCorrectionLevel::M;
+ break;
+ case 2:
+ ec = CBC_QRCoderErrorCorrectionLevel::Q;
+ break;
+ case 3:
+ ec = CBC_QRCoderErrorCorrectionLevel::H;
+ break;
+ default: {
+ e = BCExceptionUnSupportEclevel;
+ BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
}
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- outWidth = qr.GetMatrixWidth();
- outHeight = qr.GetMatrixWidth();
- uint8_t* result = FX_Alloc(uint8_t, outWidth * outWidth);
- FXSYS_memcpy(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
- return result;
+ }
+ CBC_QRCoder qr;
+ if (m_iVersion > 0 && m_iVersion < 41) {
+ CFX_ByteString byteStr = contents.UTF8Encode();
+ CBC_QRCoderEncoder::Encode(byteStr, ec, &qr, e, m_iVersion);
+ } else {
+ CBC_QRCoderEncoder::Encode(contents, ec, &qr, e);
+ }
+ BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ outWidth = qr.GetMatrixWidth();
+ outHeight = qr.GetMatrixWidth();
+ uint8_t* result = FX_Alloc(uint8_t, outWidth * outWidth);
+ FXSYS_memcpy(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
+ return result;
}
-uint8_t *CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
-{
- return NULL;
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t hints,
+ int32_t& e) {
+ return NULL;
}
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
-{
- return NULL;
+uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
+ BCFORMAT format,
+ int32_t& outWidth,
+ int32_t& outHeight,
+ int32_t& e) {
+ return NULL;
}
|