Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: xfa/fxbarcode/cbc_pdf417i.cpp

Issue 2037573005: Clean up C-Style casts in CBC_CodeBase and subclasses (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fxbarcode/cbc_onecode.cpp ('k') | xfa/fxbarcode/cbc_qrcode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxbarcode/cbc_pdf417i.cpp
diff --git a/xfa/fxbarcode/cbc_pdf417i.cpp b/xfa/fxbarcode/cbc_pdf417i.cpp
index 228caed47f8a0f53c09f74b7ff73c440df31c55c..514cc0141508c539ec29ce9f71270a665829ec27 100644
--- a/xfa/fxbarcode/cbc_pdf417i.cpp
+++ b/xfa/fxbarcode/cbc_pdf417i.cpp
@@ -27,23 +27,19 @@
#include "xfa/fxbarcode/pdf417/BC_PDF417Reader.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417Writer.h"
-CBC_PDF417I::CBC_PDF417I() {
- m_pBCReader = (CBC_Reader*)new (CBC_PDF417Reader);
- m_pBCWriter = (CBC_Writer*)new (CBC_PDF417Writer);
-}
+CBC_PDF417I::CBC_PDF417I()
+ : CBC_CodeBase(new CBC_PDF417Reader, new CBC_PDF417Writer) {}
-CBC_PDF417I::~CBC_PDF417I() {
- delete (m_pBCReader);
- delete (m_pBCWriter);
-}
+CBC_PDF417I::~CBC_PDF417I() {}
FX_BOOL CBC_PDF417I::SetErrorCorrectionLevel(int32_t level) {
- ((CBC_PDF417Writer*)m_pBCWriter)->SetErrorCorrectionLevel(level);
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
+ ->SetErrorCorrectionLevel(level);
return TRUE;
}
void CBC_PDF417I::SetTruncated(FX_BOOL truncated) {
- ((CBC_PDF417Writer*)m_pBCWriter)->SetTruncated(truncated);
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())->SetTruncated(truncated);
}
FX_BOOL CBC_PDF417I::Encode(const CFX_WideStringC& contents,
@@ -52,10 +48,11 @@ FX_BOOL CBC_PDF417I::Encode(const CFX_WideStringC& contents,
int32_t outWidth = 0;
int32_t outHeight = 0;
uint8_t* data =
- ((CBC_PDF417Writer*)m_pBCWriter)
+ static_cast<CBC_PDF417Writer*>(m_pBCWriter.get())
->Encode(CFX_WideString(contents), outWidth, outHeight, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderResult(data, outWidth, outHeight, e);
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderResult(data, outWidth, outHeight, e);
FX_Free(data);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
@@ -64,12 +61,14 @@ FX_BOOL CBC_PDF417I::Encode(const CFX_WideStringC& contents,
FX_BOOL CBC_PDF417I::RenderDevice(CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t& e) {
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderDeviceResult(device, matrix);
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderDeviceResult(device, matrix);
return TRUE;
}
FX_BOOL CBC_PDF417I::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
- ((CBC_TwoDimWriter*)m_pBCWriter)->RenderBitmapResult(pOutBitmap, e);
+ static_cast<CBC_TwoDimWriter*>(m_pBCWriter.get())
+ ->RenderBitmapResult(pOutBitmap, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return TRUE;
}
« no previous file with comments | « xfa/fxbarcode/cbc_onecode.cpp ('k') | xfa/fxbarcode/cbc_qrcode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698