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

Unified Diff: xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp

Issue 2048983002: Get rid of NULLs in xfa/fxbarcode/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits 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/pdf417/BC_PDF417.cpp ('k') | xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
index d2ad98e4089160cf56ef70151beeb8804e7b17ac..928ddc57822502ef99b8078897d72aa0bdb17ad8 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp
@@ -31,9 +31,8 @@ CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image,
CBC_ResultPoint* topRight,
CBC_ResultPoint* bottomRight,
int32_t& e) {
- if ((topLeft == NULL && topRight == NULL) ||
- (bottomLeft == NULL && bottomRight == NULL) ||
- (topLeft && bottomLeft == NULL) || (topRight && bottomRight == NULL)) {
+ if ((!topLeft && !topRight) || (!bottomLeft && !bottomRight) ||
+ (topLeft && !bottomLeft) || (topRight && !bottomRight)) {
e = BCExceptionNotFoundInstance;
}
init(image, topLeft, bottomLeft, topRight, bottomRight);
@@ -53,19 +52,19 @@ CBC_BoundingBox::~CBC_BoundingBox() {
CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox,
CBC_BoundingBox* rightBox,
int32_t& e) {
- CBC_BoundingBox* boundingBox = NULL;
- if (leftBox == NULL) {
+ CBC_BoundingBox* boundingBox = nullptr;
+ if (!leftBox) {
boundingBox = new CBC_BoundingBox(rightBox);
return boundingBox;
}
- if (rightBox == NULL) {
+ if (!rightBox) {
boundingBox = new CBC_BoundingBox(leftBox);
return boundingBox;
}
boundingBox = new CBC_BoundingBox(leftBox->m_image, leftBox->m_topLeft,
leftBox->m_bottomLeft, rightBox->m_topRight,
rightBox->m_bottomRight, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return boundingBox;
}
CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
@@ -76,8 +75,8 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
CBC_ResultPoint* newBottomLeft = m_bottomLeft;
CBC_ResultPoint* newTopRight = m_topRight;
CBC_ResultPoint* newBottomRight = m_bottomRight;
- CBC_ResultPoint* newTop = NULL;
- CBC_ResultPoint* newBottom = NULL;
+ CBC_ResultPoint* newTop = nullptr;
+ CBC_ResultPoint* newBottom = nullptr;
if (missingStartRows > 0) {
CBC_ResultPoint* top = isLeft ? m_topLeft : m_topRight;
int32_t newMinY = (int32_t)top->GetY() - missingStartRows;
@@ -110,7 +109,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows,
m_image, newTopLeft, newBottomLeft, newTopRight, newBottomRight, e);
delete newTop;
delete newBottom;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
return boundingBox;
}
void CBC_BoundingBox::setTopRight(CBC_ResultPoint topRight) {
@@ -156,10 +155,10 @@ void CBC_BoundingBox::init(CBC_CommonBitMatrix* image,
CBC_ResultPoint* bottomLeft,
CBC_ResultPoint* topRight,
CBC_ResultPoint* bottomRight) {
- m_topLeft = NULL;
- m_bottomLeft = NULL;
- m_topRight = NULL;
- m_bottomRight = NULL;
+ m_topLeft = nullptr;
+ m_bottomLeft = nullptr;
+ m_topRight = nullptr;
+ m_bottomRight = nullptr;
m_image = image;
if (topLeft) {
m_topLeft = new CBC_ResultPoint(topLeft->GetX(), topLeft->GetY());
@@ -177,10 +176,10 @@ void CBC_BoundingBox::init(CBC_CommonBitMatrix* image,
calculateMinMaxValues();
}
void CBC_BoundingBox::calculateMinMaxValues() {
- if (m_topLeft == NULL) {
+ if (!m_topLeft) {
m_topLeft = new CBC_ResultPoint(0, m_topRight->GetY());
m_bottomLeft = new CBC_ResultPoint(0, m_bottomRight->GetY());
- } else if (m_topRight == NULL) {
+ } else if (!m_topRight) {
m_topRight = new CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1,
(FX_FLOAT)m_topLeft->GetY());
m_bottomRight = new CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1,
« no previous file with comments | « xfa/fxbarcode/pdf417/BC_PDF417.cpp ('k') | xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698