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

Unified Diff: core/src/fxcodec/codec/fx_codec_jpeg.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years 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 | « core/src/fxcodec/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/codec/fx_codec_jpeg.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index 730872363c2df07d3b9263330f954c8552d26f9a..043964f254cd0ff17e42ebbc63ef5d7b99c19066 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -82,7 +82,7 @@ static void _error_do_nothing2(j_common_ptr cinfo, char*) {}
static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo,
const uint8_t* icc_buf_ptr,
FX_DWORD icc_length) {
- if (icc_buf_ptr == NULL || icc_length == 0) {
+ if (!icc_buf_ptr || icc_length == 0) {
return FALSE;
}
FX_DWORD icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN);
@@ -501,7 +501,7 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(
int height,
int nComps,
FX_BOOL ColorTransform) {
- if (src_buf == NULL || src_size == 0) {
+ if (!src_buf || src_size == 0) {
return NULL;
}
CCodec_JpegDecoder* pDecoder = new CCodec_JpegDecoder;
@@ -531,10 +531,9 @@ FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource,
int quality,
const uint8_t* icc_buf,
FX_DWORD icc_length) {
- if (pSource->GetBPP() < 8 || pSource->GetPalette()) {
- ASSERT(pSource->GetBPP() >= 8 && pSource->GetPalette() == NULL);
+ if (pSource->GetBPP() < 8 || pSource->GetPalette())
return FALSE;
- }
+
_JpegEncode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length);
return TRUE;
}
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698