summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-06-10 13:19:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-10 13:19:16 -0700
commitc14c958db677802a52e84a0e772f6185eb89b3fd (patch)
tree8ae7568163fc0478e678f9e0721f73e29c959bc2
parentcfb77ccb1c057d6beb73f0043e42eee8c4822f84 (diff)
downloadpdfium-c14c958db677802a52e84a0e772f6185eb89b3fd.tar.xz
Remove redundant casts, part 9.
Make CFDE_TxtEdtParag::m_lpData a int32_t*, not void*, since it is cast to int32_t everywhere it is used. Many fxbarcode casts are redundant, likely the result of previous generic PtrArray replacement with templated type. Review-Url: https://codereview.chromium.org/2059953002
-rw-r--r--xfa/fde/cfde_txtedtparag.cpp20
-rw-r--r--xfa/fde/cfde_txtedtparag.h2
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp4
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp7
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp4
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp14
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp6
8 files changed, 30 insertions, 35 deletions
diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp
index 11015f59fd..9ba0fa5431 100644
--- a/xfa/fde/cfde_txtedtparag.cpp
+++ b/xfa/fde/cfde_txtedtparag.cpp
@@ -29,7 +29,7 @@ CFDE_TxtEdtParag::~CFDE_TxtEdtParag() {
void CFDE_TxtEdtParag::LoadParag() {
if (m_lpData) {
- ((int32_t*)m_lpData)[0]++;
+ m_lpData[0]++;
return;
}
CFX_TxtBreak* pTxtBreak = m_pEngine->GetTextBreak();
@@ -77,12 +77,12 @@ void CFDE_TxtEdtParag::LoadParag() {
pTxtBreak->ClearBreakPieces();
int32_t nLineCount = LineBaseArr.GetSize();
m_nLineCount = nLineCount;
- if (m_lpData)
- m_lpData = FX_Realloc(int32_t, m_lpData, (nLineCount + 1));
- else
+ if (m_lpData) {
+ m_lpData = FX_Realloc(int32_t, m_lpData, nLineCount + 1);
+ } else {
m_lpData = FX_Alloc(int32_t, nLineCount + 1);
-
- int32_t* pIntArr = (int32_t*)m_lpData;
+ }
+ int32_t* pIntArr = m_lpData;
pIntArr[0] = 1;
m_nLineCount = nLineCount;
pIntArr++;
@@ -93,9 +93,9 @@ void CFDE_TxtEdtParag::LoadParag() {
}
void CFDE_TxtEdtParag::UnloadParag() {
- ((int32_t*)m_lpData)[0]--;
- ASSERT(((int32_t*)m_lpData)[0] >= 0);
- if (((int32_t*)m_lpData)[0] == 0) {
+ m_lpData[0]--;
+ ASSERT(m_lpData[0] >= 0);
+ if (m_lpData[0] == 0) {
FX_Free(m_lpData);
m_lpData = nullptr;
}
@@ -140,7 +140,7 @@ void CFDE_TxtEdtParag::CalcLines() {
void CFDE_TxtEdtParag::GetLineRange(int32_t nLineIndex,
int32_t& nStart,
int32_t& nCount) const {
- int32_t* pLineBaseArr = (int32_t*)m_lpData;
+ int32_t* pLineBaseArr = m_lpData;
ASSERT(nLineIndex < m_nLineCount);
nStart = m_nCharStart;
pLineBaseArr++;
diff --git a/xfa/fde/cfde_txtedtparag.h b/xfa/fde/cfde_txtedtparag.h
index 74eaaff088..4521f3be0c 100644
--- a/xfa/fde/cfde_txtedtparag.h
+++ b/xfa/fde/cfde_txtedtparag.h
@@ -36,7 +36,7 @@ class CFDE_TxtEdtParag {
int32_t m_nCharStart;
int32_t m_nCharCount;
int32_t m_nLineCount;
- void* m_lpData;
+ int32_t* m_lpData;
CFDE_TxtEdtEngine* m_pEngine;
};
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
index 9371dc42e8..e468cc42c3 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
@@ -48,8 +48,8 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords,
result->SetSize(totalBlocks);
int32_t numResultBlocks = 0;
for (int32_t j = 0; j < ecBlockArray.GetSize(); j++) {
- for (int32_t i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) {
- int32_t numDataCodewords = ((ECB*)ecBlockArray[j])->GetDataCodewords();
+ for (int32_t i = 0; i < ecBlockArray[j]->GetCount(); i++) {
+ int32_t numDataCodewords = ecBlockArray[j]->GetDataCodewords();
int32_t numBlockCodewords = ecBlocks->GetECCodewords() + numDataCodewords;
CFX_ByteArray codewords;
codewords.SetSize(numBlockCodewords);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
index 931a83163c..ef19370a74 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp
@@ -91,9 +91,8 @@ CFX_ByteString CBC_DetectionResult::toString() {
continue;
}
CBC_Codeword* codeword =
- (CBC_Codeword*)m_detectionResultColumns[barcodeColumn]
- ->getCodewords()
- ->GetAt(codewordsRow);
+ m_detectionResultColumns[barcodeColumn]->getCodewords()->GetAt(
+ codewordsRow);
if (!codeword) {
result += " | ";
continue;
@@ -107,7 +106,7 @@ CFX_ByteString CBC_DetectionResult::toString() {
void CBC_DetectionResult::adjustIndicatorColumnRowNumbers(
CBC_DetectionResultColumn* detectionResultColumn) {
if (detectionResultColumn) {
- ((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn)
+ static_cast<CBC_DetectionResultRowIndicatorColumn*>(detectionResultColumn)
->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata);
}
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
index 635dc20a6f..010b83c5fb 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp
@@ -47,14 +47,14 @@ CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) {
for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) {
int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i;
if (nearImageRow >= 0) {
- codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
+ codeword = m_codewords->GetAt(nearImageRow);
if (codeword) {
return codeword;
}
}
nearImageRow = imageRowToCodewordIndex(imageRow) + i;
if (nearImageRow < m_codewords->GetSize()) {
- codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow);
+ codeword = m_codewords->GetAt(nearImageRow);
if (codeword) {
return codeword;
}
@@ -74,7 +74,7 @@ void CBC_DetectionResultColumn::setCodeword(int32_t imageRow,
m_codewords->SetAt(imageRowToCodewordIndex(imageRow), codeword);
}
CBC_Codeword* CBC_DetectionResultColumn::getCodeword(int32_t imageRow) {
- return (CBC_Codeword*)m_codewords->GetAt(imageRowToCodewordIndex(imageRow));
+ return m_codewords->GetAt(imageRowToCodewordIndex(imageRow));
}
CBC_BoundingBox* CBC_DetectionResultColumn::getBoundingBox() {
return m_boundingBox;
@@ -87,7 +87,7 @@ CFX_ByteString CBC_DetectionResultColumn::toString() {
CFX_ByteString result;
int32_t row = 0;
for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
- CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i);
+ CBC_Codeword* codeword = m_codewords->GetAt(i);
if (!codeword) {
result += (FX_CHAR)row;
row++;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
index 5149c3db14..900036d315 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp
@@ -41,7 +41,7 @@ CBC_DetectionResultRowIndicatorColumn::
~CBC_DetectionResultRowIndicatorColumn() {}
void CBC_DetectionResultRowIndicatorColumn::setRowNumbers() {
for (int32_t i = 0; i < m_codewords->GetSize(); i++) {
- CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i);
+ CBC_Codeword* codeword = m_codewords->GetAt(i);
if (codeword) {
codeword->setRowNumberAsRowIndicatorColumn();
}
@@ -118,7 +118,7 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(
CFX_Int32Array* result = new CFX_Int32Array;
result->SetSize(barcodeMetadata->getRowCount());
for (int32_t i = 0; i < getCodewords()->GetSize(); i++) {
- CBC_Codeword* codeword = (CBC_Codeword*)getCodewords()->GetAt(i);
+ CBC_Codeword* codeword = getCodewords()->GetAt(i);
if (codeword) {
result->SetAt(codeword->getRowNumber(),
result->GetAt(codeword->getRowNumber()) + 1);
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
index aadb1a6ac5..f7e1546f19 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp
@@ -70,14 +70,12 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
delete buildmonomial;
delete syndrome;
BC_EXCEPTION_CHECK_ReturnValue(e, -1);
- CBC_PDF417ECModulusPoly* sigma =
- (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(0);
- CBC_PDF417ECModulusPoly* omega =
- (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(1);
+ CBC_PDF417ECModulusPoly* sigma = sigmaOmega->GetAt(0);
+ CBC_PDF417ECModulusPoly* omega = sigmaOmega->GetAt(1);
CFX_Int32Array* errorLocations = findErrorLocations(sigma, e);
if (e != BCExceptionNO) {
for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) {
- delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i);
+ delete sigmaOmega->GetAt(i);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
@@ -88,7 +86,7 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
if (e != BCExceptionNO) {
delete errorLocations;
for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) {
- delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i);
+ delete sigmaOmega->GetAt(i);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
@@ -104,7 +102,7 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
delete errorLocations;
delete errorMagnitudes;
for (int32_t j = 0; j < sigmaOmega->GetSize(); j++) {
- delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(j);
+ delete sigmaOmega->GetAt(j);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
@@ -117,7 +115,7 @@ int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array& received,
delete errorLocations;
delete errorMagnitudes;
for (int32_t k = 0; k < sigmaOmega->GetSize(); k++) {
- delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(k);
+ delete sigmaOmega->GetAt(k);
}
sigmaOmega->RemoveAll();
delete sigmaOmega;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
index a6e882b1cb..479b65970e 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp
@@ -465,8 +465,7 @@ CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(
for (int32_t i = 0;
i < detectionResult->getDetectionResultColumns().GetSize(); i++) {
CBC_DetectionResultColumn* detectionResultColumn =
- (CBC_DetectionResultColumn*)detectionResult->getDetectionResultColumns()
- .GetAt(i);
+ detectionResult->getDetectionResultColumns().GetAt(i);
if (!detectionResultColumn)
continue;
@@ -525,8 +524,7 @@ int32_t CBC_PDF417ScanningDecoder::getStartColumn(
->GetSize();
i++) {
CBC_Codeword* previousRowCodeword =
- (CBC_Codeword*)detectionResult->getDetectionResultColumn(
- barcodeColumn)
+ detectionResult->getDetectionResultColumn(barcodeColumn)
->getCodewords()
->GetAt(i);
if (previousRowCodeword) {