From 6dc1d7753691c0ff2f390e8ffd95a3182064487e Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 9 Jun 2016 18:39:33 -0700 Subject: Get rid of NULLs in xfa/fxbarcode/ Review-Url: https://codereview.chromium.org/2048983002 --- xfa/fxbarcode/oned/BC_OneDimReader.cpp | 12 ++++++------ xfa/fxbarcode/oned/BC_OneDimWriter.cpp | 27 ++++++++++++++------------- xfa/fxbarcode/oned/BC_OneDimWriter.h | 2 +- xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp | 4 ++-- xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 6 +++--- xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp | 8 ++++---- xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 6 +++--- xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp | 4 ++-- xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp | 18 +++++++++--------- xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 16 ++++++++-------- xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 18 +++++++++--------- xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp | 2 +- xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 16 ++++++++-------- 13 files changed, 70 insertions(+), 69 deletions(-) (limited to 'xfa/fxbarcode/oned') diff --git a/xfa/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/fxbarcode/oned/BC_OneDimReader.cpp index a1cfc9b492..e413adb6a4 100644 --- a/xfa/fxbarcode/oned/BC_OneDimReader.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimReader.cpp @@ -45,7 +45,7 @@ CBC_OneDimReader::~CBC_OneDimReader() {} CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, int32_t& e) { FX_BOOL foundStart = FALSE; - CFX_Int32Array* startRange = NULL; + CFX_Int32Array* startRange = nullptr; CFX_Int32Array startEndPattern; startEndPattern.SetSize(3); startEndPattern[0] = START_END_PATTERN[0]; @@ -55,7 +55,7 @@ CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, while (!foundStart) { delete startRange; startRange = FindGuardPattern(row, nextStart, FALSE, &startEndPattern, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); int32_t start = (*startRange)[0]; nextStart = (*startRange)[1]; if (start <= 1) { @@ -64,7 +64,7 @@ CFX_Int32Array* CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray* row, int32_t quietStart = start - (nextStart - start); if (quietStart >= 0) { FX_BOOL booT = row->IsRange(quietStart, start, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); foundStart = booT; } } @@ -136,7 +136,7 @@ CFX_Int32Array* CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, startEndPattern.Add(START_END_PATTERN[2]); CFX_Int32Array* FindGuard = FindGuardPattern(row, endStart, FALSE, &startEndPattern, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return FindGuard; } CFX_Int32Array* CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray* row, @@ -187,8 +187,8 @@ CFX_Int32Array* CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray* row, } } e = BCExceptionNotFound; - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - return NULL; + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + return nullptr; } int32_t CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray* row, CFX_Int32Array* counters, diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp index 8580650223..7330ae65b7 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp @@ -33,14 +33,14 @@ CBC_OneDimWriter::CBC_OneDimWriter() { m_bPrintChecksum = TRUE; m_iDataLenth = 0; m_bCalcChecksum = FALSE; - m_pFont = NULL; + m_pFont = nullptr; m_fFontSize = 10; m_iFontStyle = 0; m_fontColor = 0xff000000; m_iContentLen = 0; m_bLeftPadding = FALSE; m_bRightPadding = FALSE; - m_output = NULL; + m_output = nullptr; } CBC_OneDimWriter::~CBC_OneDimWriter() { delete m_output; @@ -55,9 +55,9 @@ void CBC_OneDimWriter::SetCalcChecksum(int32_t state) { m_bCalcChecksum = state; } FX_BOOL CBC_OneDimWriter::SetFont(CFX_Font* cFont) { - if (cFont == NULL) { + if (!cFont) return FALSE; - } + m_pFont = cFont; return TRUE; } @@ -82,14 +82,14 @@ uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t hints, int32_t& e) { - uint8_t* ret = NULL; + uint8_t* ret = nullptr; outHeight = 1; if (m_Width >= 20) { ret = Encode(contents, outWidth, e); } else { ret = Encode(contents, outWidth, e); } - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, @@ -98,7 +98,7 @@ uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, @@ -296,9 +296,9 @@ void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, const CFX_WideStringC& contents, int32_t& e) { - if (m_output == NULL) { + if (!m_output) BC_EXCEPTION_CHECK_ReturnVoid(e); - } + pOutBitmap = CreateDIBitmap(m_output->GetWidth(), m_output->GetHeight()); pOutBitmap->Clear(m_backgroundColor); if (!pOutBitmap) { @@ -318,7 +318,8 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap*& pOutBitmap, break; } if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { - ShowChars(contents, pOutBitmap, NULL, NULL, m_barWidth, m_multiple, e); + ShowChars(contents, pOutBitmap, nullptr, nullptr, m_barWidth, m_multiple, + e); BC_EXCEPTION_CHECK_ReturnVoid(e); } CFX_DIBitmap* pStretchBitmap = pOutBitmap->StretchTo(m_Width, m_Height); @@ -330,9 +331,9 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, const CFX_WideStringC& contents, int32_t& e) { - if (m_output == NULL) { + if (!m_output) BC_EXCEPTION_CHECK_ReturnVoid(e); - } + CFX_GraphStateData stateData; CFX_PathData path; path.AppendRect(0, 0, (FX_FLOAT)m_Width, (FX_FLOAT)m_Height); @@ -357,7 +358,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, break; } if (m_locTextLoc != BC_TEXT_LOC_NONE && i < contents.GetLength()) { - ShowChars(contents, NULL, device, matrix, m_barWidth, m_multiple, e); + ShowChars(contents, nullptr, device, matrix, m_barWidth, m_multiple, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } } diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.h b/xfa/fxbarcode/oned/BC_OneDimWriter.h index 15a1a1a6c7..a0a076217a 100644 --- a/xfa/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/fxbarcode/oned/BC_OneDimWriter.h @@ -34,7 +34,7 @@ class CBC_OneDimWriter : public CBC_Writer { virtual uint8_t* Encode(const CFX_ByteString& contents, int32_t& outLength, int32_t& e) { - return NULL; + return nullptr; } virtual void RenderResult(const CFX_WideStringC& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp index f3c39f2491..0fa0e9a29b 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp @@ -148,7 +148,7 @@ CFX_Int32Array* CBC_OnedCodaBarReader::FindAsteriskPattern( FX_BOOL btemp3 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (btemp3) { CFX_Int32Array* result = new CFX_Int32Array(); result->SetSize(2); @@ -172,7 +172,7 @@ CFX_Int32Array* CBC_OnedCodaBarReader::FindAsteriskPattern( } } e = BCExceptionNotFound; - return NULL; + return nullptr; } FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key) { diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 2d9c2e5ad8..59f4d5ea4d 100644 --- a/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -137,7 +137,7 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, @@ -148,11 +148,11 @@ uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODABAR) { e = BCExceptionOnlyEncodeCODEBAR; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp index a0479e7f6d..b868327a37 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Reader.cpp @@ -105,7 +105,7 @@ CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, FX_BOOL btemp2 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (btemp2) { CFX_Int32Array* result = new CFX_Int32Array; result->SetSize(3); @@ -130,7 +130,7 @@ CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, } } e = BCExceptionNotFound; - return NULL; + return nullptr; } int32_t CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray* row, CFX_Int32Array* counters, @@ -176,7 +176,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, if (startPatternInfo) { startPatternInfo->RemoveAll(); delete startPatternInfo; - startPatternInfo = NULL; + startPatternInfo = nullptr; } e = BCExceptionFormatException; return ""; @@ -189,7 +189,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, if (startPatternInfo) { startPatternInfo->RemoveAll(); delete startPatternInfo; - startPatternInfo = NULL; + startPatternInfo = nullptr; } CFX_Int32Array counters; counters.SetSize(6); diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index bc9b14f04e..d5754230b5 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -107,11 +107,11 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODE_128) { e = BCExceptionOnlyEncodeCODE_128; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, @@ -120,7 +120,7 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents, diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp index 0eb4c990b4..331af7e887 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Reader.cpp @@ -141,7 +141,7 @@ CFX_Int32Array* CBC_OnedCode39Reader::FindAsteriskPattern( FX_BOOL bT1 = row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), patternStart, FALSE, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); if (bT1) { CFX_Int32Array* result = new CFX_Int32Array; result->SetSize(2); @@ -165,7 +165,7 @@ CFX_Int32Array* CBC_OnedCode39Reader::FindAsteriskPattern( } } e = BCExceptionNotFound; - return NULL; + return nullptr; } int32_t CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array* counters) { int32_t numCounters = counters->GetSize(); diff --git a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp index efebfe547d..58d9472e25 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -214,7 +214,7 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, @@ -225,11 +225,11 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_CODE_39) { e = BCExceptionOnlyEncodeCODE_39; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t* toReturn) { @@ -271,7 +271,7 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t& e) { FX_CHAR checksum = CalcCheckSum(contents, e); if (checksum == '*') { - return NULL; + return nullptr; } int32_t widths[9] = {0}; int32_t wideStrideNum = 3; @@ -300,13 +300,13 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, int32_t pos = AppendPattern(result, 0, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t narrowWhite[] = {1}; pos += AppendPattern(result, pos, narrowWhite, 1, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (int32_t l = m_iContentLen - 1; l >= 0; l--) { for (int32_t i = 0; i < len; i++) { @@ -315,21 +315,21 @@ uint8_t* CBC_OnedCode39Writer::Encode(const CFX_ByteString& contents, pos += AppendPattern(result, pos, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } } pos += AppendPattern(result, pos, narrowWhite, 1, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[39], widths); pos += AppendPattern(result, pos, widths, 9, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (int32_t i = 0; i < codeWidth / 2; i++) { result[i] ^= result[codeWidth - 1 - i]; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 20b52774e8..933d009a73 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -82,7 +82,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, @@ -96,7 +96,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, @@ -104,7 +104,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (contents.GetLength() != 13) { e = BCExceptionDigitLengthShould13; - return NULL; + return nullptr; } m_iDataLenth = 13; int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str()); @@ -116,7 +116,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t i = 0; for (i = 1; i <= 6; i++) { @@ -128,13 +128,13 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, 4, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::MIDDLE_PATTERN, 5, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (i = 7; i <= 12; i++) { int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); @@ -142,14 +142,14 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } return result; } diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 2aa57d18d1..f4a4dc86e1 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -92,7 +92,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, @@ -103,11 +103,11 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_EAN_8) { e = BCExceptionOnlyEncodeEAN_8; - return NULL; + return nullptr; } uint8_t* ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, @@ -115,7 +115,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, int32_t& e) { if (contents.GetLength() != 8) { e = BCExceptionDigitLengthMustBe8; - return NULL; + return nullptr; } outLength = m_codeWidth; uint8_t* result = FX_Alloc(uint8_t, m_codeWidth); @@ -124,7 +124,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } int32_t i = 0; for (i = 0; i <= 3; i++) { @@ -133,13 +133,13 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::MIDDLE_PATTERN, 5, 0, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } for (i = 4; i <= 7; i++) { int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); @@ -147,14 +147,14 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } } pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e); if (e != BCExceptionNO) { FX_Free(result); - return NULL; + return nullptr; } return result; } diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp index eb197b916c..b8b7c9426a 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAReader.cpp @@ -29,7 +29,7 @@ #include "xfa/fxbarcode/utils.h" CBC_OnedUPCAReader::CBC_OnedUPCAReader() { - m_ean13Reader = NULL; + m_ean13Reader = nullptr; } void CBC_OnedUPCAReader::Init() { m_ean13Reader = new CBC_OnedEAN13Reader; diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index f7900d4195..19cb7ec6de 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -26,7 +26,7 @@ #include "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h" CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() { - m_subWriter = NULL; + m_subWriter = nullptr; m_bLeftPadding = TRUE; m_bRightPadding = TRUE; } @@ -84,7 +84,7 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, int32_t& outHeight, int32_t& e) { uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, @@ -95,13 +95,13 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, int32_t& e) { if (format != BCFORMAT_UPC_A) { e = BCExceptionOnlyEncodeUPC_A; - return NULL; + return nullptr; } CFX_ByteString toEAN13String = '0' + contents; m_iDataLenth = 13; uint8_t* ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e); - BC_EXCEPTION_CHECK_ReturnValue(e, NULL); + BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } @@ -171,9 +171,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, re = rect3.GetOutterRect(); device->FillRect(&re, m_backgroundColor); } - if (pOutBitmap == NULL) { + if (!pOutBitmap) strWidth = strWidth * m_outputHScale; - } + CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank); CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); CFX_FxgeDevice ge; @@ -225,9 +225,9 @@ void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents, tempStr = str.Mid(0, 1); iLen = tempStr.GetLength(); strWidth = (FX_FLOAT)multiple * 7; - if (pOutBitmap == NULL) { + if (!pOutBitmap) strWidth = strWidth * m_outputHScale; - } + CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank); if (pOutBitmap) { delete ge.GetBitmap(); -- cgit v1.2.3