summaryrefslogtreecommitdiff
path: root/fxbarcode/qrcode/BC_QRCodeWriter.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-03 16:40:51 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-04 19:04:37 +0000
commit03d58937248fa244cbf02a3d38d430a513500311 (patch)
tree9ea96b01b0f2f2464bd9d5c49e76dd8e0466a8b0 /fxbarcode/qrcode/BC_QRCodeWriter.cpp
parentc3202a95773d7a2c95038ad45c5ba2c9e095e67b (diff)
downloadpdfium-03d58937248fa244cbf02a3d38d430a513500311.tar.xz
Clean up QRCoderEncoder and friends.
Remove a bunch of unused code, including gotos. Fix some potential memory leaks. Change-Id: Ia2775e2ab176f4741b765e259a24a293a5717394 Reviewed-on: https://pdfium-review.googlesource.com/3560 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxbarcode/qrcode/BC_QRCodeWriter.cpp')
-rw-r--r--fxbarcode/qrcode/BC_QRCodeWriter.cpp34
1 files changed, 2 insertions, 32 deletions
diff --git a/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index b83bca89c8..b7d5359830 100644
--- a/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -33,7 +33,6 @@
CBC_QRCodeWriter::CBC_QRCodeWriter() {
m_bFixedSize = true;
m_iCorrectLevel = 1;
- m_iVersion = 0;
}
CBC_QRCodeWriter::~CBC_QRCodeWriter() {}
@@ -48,14 +47,6 @@ void CBC_QRCodeWriter::ReleaseAll() {
CBC_QRCoderVersion::Destroy();
}
-bool CBC_QRCodeWriter::SetVersion(int32_t version) {
- if (version < 0 || version > 40) {
- return false;
- }
- m_iVersion = version;
- return true;
-}
-
bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
if (level < 0 || level > 3) {
return false;
@@ -89,34 +80,13 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
}
}
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);
- }
+ CBC_QRCoderEncoder::Encode(contents, ec, &qr, e);
if (e != BCExceptionNO)
return nullptr;
+
outWidth = qr.GetMatrixWidth();
outHeight = qr.GetMatrixWidth();
uint8_t* result = FX_Alloc2D(uint8_t, outWidth, outHeight);
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 nullptr;
-}
-
-uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
- BCFORMAT format,
- int32_t& outWidth,
- int32_t& outHeight,
- int32_t& e) {
- return nullptr;
-}