summaryrefslogtreecommitdiff
path: root/fxbarcode/BC_TwoDimWriter.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-20 15:58:56 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-21 00:54:04 +0000
commit1badb85e5c3a4b4cd42ca1a2b223d6b3bc67cc4a (patch)
tree55bf63857592387531797b0f08e0a6effc0f40c9 /fxbarcode/BC_TwoDimWriter.cpp
parentaeee187c927c07f47a9e5886a417dcc58badefb6 (diff)
downloadpdfium-1badb85e5c3a4b4cd42ca1a2b223d6b3bc67cc4a.tar.xz
Change more fxbarcode to use return values.
Change-Id: Idcc05fb8c5a1448f552b4db5ae131ad82aef4d59 Reviewed-on: https://pdfium-review.googlesource.com/4258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/BC_TwoDimWriter.cpp')
-rw-r--r--fxbarcode/BC_TwoDimWriter.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/fxbarcode/BC_TwoDimWriter.cpp b/fxbarcode/BC_TwoDimWriter.cpp
index 9906f35bd5..6852fee35c 100644
--- a/fxbarcode/BC_TwoDimWriter.cpp
+++ b/fxbarcode/BC_TwoDimWriter.cpp
@@ -57,10 +57,9 @@ int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const {
return m_iCorrectLevel;
}
-void CBC_TwoDimWriter::RenderResult(uint8_t* code,
+bool CBC_TwoDimWriter::RenderResult(uint8_t* code,
int32_t codeWidth,
- int32_t codeHeight,
- int32_t& e) {
+ int32_t codeHeight) {
int32_t inputWidth = codeWidth;
int32_t inputHeight = codeHeight;
int32_t tempWidth = inputWidth + 2;
@@ -77,8 +76,7 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
int32_t outputHeight = scaledHeight.ValueOrDie();
if (m_bFixedSize) {
if (m_Width < outputWidth || m_Height < outputHeight) {
- e = BCExceptionBitmapSizeError;
- return;
+ return false;
}
} else {
if (m_Width > outputWidth || m_Height > outputHeight) {
@@ -104,12 +102,11 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
for (int32_t inputX = 0, outputX = leftPadding;
(inputX < inputWidth) && (outputX < outputWidth - multiX);
inputX++, outputX += multiX) {
- if (code[inputX + inputY * inputWidth] == 1) {
- if (!m_output->SetRegion(outputX, outputY, multiX, multiY)) {
- e = BCExceptionGeneric;
- return;
- }
+ if (code[inputX + inputY * inputWidth] == 1 &&
+ !m_output->SetRegion(outputX, outputY, multiX, multiY)) {
+ return false;
}
}
}
+ return true;
}