summaryrefslogtreecommitdiff
path: root/xfa
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 /xfa
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 'xfa')
-rw-r--r--xfa/fwl/cfwl_barcode.cpp9
-rw-r--r--xfa/fwl/cfwl_barcode.h4
-rw-r--r--xfa/fwl/cfx_barcode.cpp16
-rw-r--r--xfa/fwl/cfx_barcode.h8
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp2
5 files changed, 16 insertions, 23 deletions
diff --git a/xfa/fwl/cfwl_barcode.cpp b/xfa/fwl/cfwl_barcode.cpp
index 87ecee13b5..378bb8e06b 100644
--- a/xfa/fwl/cfwl_barcode.cpp
+++ b/xfa/fwl/cfwl_barcode.cpp
@@ -52,9 +52,7 @@ void CFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
if (pMatrix)
mt.Concat(*pMatrix);
- int32_t errorCode = 0;
- m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix,
- errorCode);
+ m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix);
return;
}
CFWL_Edit::DrawWidget(pGraphics, pMatrix);
@@ -131,7 +129,7 @@ void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) {
m_eTextLocation = location;
}
-void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) {
+void CFWL_Barcode::SetWideNarrowRatio(int8_t ratio) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
m_nWideNarrowRatio = ratio;
}
@@ -206,8 +204,7 @@ void CFWL_Barcode::GenerateBarcodeImageCache() {
if (m_dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED)
m_pBarcodeEngine->SetTruncated(m_bTruncated);
- int32_t errorCode = 0;
- m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringC(), true, errorCode)
+ m_dwStatus = m_pBarcodeEngine->Encode(GetText().AsStringC(), true)
? XFA_BCS_EncodeSuccess
: 0;
}
diff --git a/xfa/fwl/cfwl_barcode.h b/xfa/fwl/cfwl_barcode.h
index ce62d73dde..0620541c2f 100644
--- a/xfa/fwl/cfwl_barcode.h
+++ b/xfa/fwl/cfwl_barcode.h
@@ -61,7 +61,7 @@ class CFWL_Barcode : public CFWL_Edit {
void SetCalChecksum(bool calChecksum);
void SetPrintChecksum(bool printChecksum);
void SetTextLocation(BC_TEXT_LOC location);
- void SetWideNarrowRatio(int32_t ratio);
+ void SetWideNarrowRatio(int8_t ratio);
void SetStartChar(char startChar);
void SetEndChar(char endChar);
void SetErrorCorrectionLevel(int32_t ecLevel);
@@ -81,7 +81,7 @@ class CFWL_Barcode : public CFWL_Edit {
bool m_bCalChecksum;
bool m_bPrintChecksum;
BC_TEXT_LOC m_eTextLocation;
- int32_t m_nWideNarrowRatio;
+ int8_t m_nWideNarrowRatio;
char m_cStartChar;
char m_cEndChar;
int32_t m_nECLevel;
diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp
index 9d01ae26ef..e999d3a509 100644
--- a/xfa/fwl/cfx_barcode.cpp
+++ b/xfa/fwl/cfx_barcode.cpp
@@ -219,8 +219,8 @@ bool CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) {
return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(location) : false;
}
-bool CFX_Barcode::SetWideNarrowRatio(int32_t ratio) {
- typedef bool (CBC_CodeBase::*memptrtype)(int32_t);
+bool CFX_Barcode::SetWideNarrowRatio(int8_t ratio) {
+ typedef bool (CBC_CodeBase::*memptrtype)(int8_t);
memptrtype memptr = nullptr;
switch (GetType()) {
case BC_CODE39:
@@ -276,6 +276,7 @@ bool CFX_Barcode::SetErrorCorrectionLevel(int32_t level) {
}
return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(level) : false;
}
+
bool CFX_Barcode::SetTruncated(bool truncated) {
typedef void (CBC_CodeBase::*memptrtype)(bool);
memptrtype memptr = nullptr;
@@ -290,14 +291,11 @@ bool CFX_Barcode::SetTruncated(bool truncated) {
: false;
}
-bool CFX_Barcode::Encode(const CFX_WideStringC& contents,
- bool isDevice,
- int32_t& e) {
- return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice, e);
+bool CFX_Barcode::Encode(const CFX_WideStringC& contents, bool isDevice) {
+ return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice);
}
bool CFX_Barcode::RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e) {
- return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e);
+ const CFX_Matrix* matrix) {
+ return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix);
}
diff --git a/xfa/fwl/cfx_barcode.h b/xfa/fwl/cfx_barcode.h
index 20155ca0a2..83cb23437f 100644
--- a/xfa/fwl/cfx_barcode.h
+++ b/xfa/fwl/cfx_barcode.h
@@ -27,11 +27,9 @@ class CFX_Barcode {
bool Create(BC_TYPE type);
BC_TYPE GetType();
- bool Encode(const CFX_WideStringC& contents, bool isDevice, int32_t& e);
+ bool Encode(const CFX_WideStringC& contents, bool isDevice);
- bool RenderDevice(CFX_RenderDevice* device,
- const CFX_Matrix* matrix,
- int32_t& e);
+ bool RenderDevice(CFX_RenderDevice* device, const CFX_Matrix* matrix);
bool SetCharEncoding(BC_CHAR_ENCODING encoding);
@@ -51,7 +49,7 @@ class CFX_Barcode {
bool SetTextLocation(BC_TEXT_LOC location);
- bool SetWideNarrowRatio(int32_t ratio);
+ bool SetWideNarrowRatio(int8_t ratio);
bool SetStartChar(char start);
bool SetEndChar(char end);
bool SetErrorCorrectionLevel(int32_t level);
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 4e5e1f0a41..d15ec8c24f 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -216,7 +216,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() {
pBarCodeWidget->SetTruncated(boolVal);
}
if (pAcc->GetBarcodeAttribute_WideNarrowRatio(floatVal)) {
- pBarCodeWidget->SetWideNarrowRatio((int32_t)floatVal);
+ pBarCodeWidget->SetWideNarrowRatio(static_cast<int8_t>(floatVal));
}
if (pBarcodeTypeInfo->eName == XFA_BARCODETYPE_code3Of9 ||
pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean8 ||