Fix few missing comparisons to NULL

Change-Id: I0d2ff8e8b507d17e80669b2b59fd5b017af995ed
This commit is contained in:
Pascal Massimino 2013-04-11 00:57:31 -07:00
parent b66caee410
commit 1579989e7b
5 changed files with 9 additions and 10 deletions

View File

@ -179,7 +179,7 @@ static int FinishRow(VP8Decoder* const dec, VP8Io* const io) {
FilterRow(dec);
}
if (io->put) {
if (io->put != NULL) {
if (!first_row) {
y_start -= extra_y_rows;
io->y = ydst;
@ -288,7 +288,7 @@ int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io) {
VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io) {
// Call setup() first. This may trigger additional decoding features on 'io'.
// Note: Afterward, we must call teardown() not matter what.
if (io->setup && !io->setup(io)) {
if (io->setup != NULL && !io->setup(io)) {
VP8SetError(dec, VP8_STATUS_USER_ABORT, "Frame setup failed");
return dec->status_;
}
@ -346,7 +346,7 @@ int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io) {
ok = WebPWorkerSync(&dec->worker_);
}
if (io->teardown) {
if (io->teardown != NULL) {
io->teardown(io);
}
return ok;

View File

@ -268,7 +268,7 @@ static void RestoreContext(const MBContext* context, VP8Decoder* const dec,
static VP8StatusCode IDecError(WebPIDecoder* const idec, VP8StatusCode error) {
if (idec->state_ == STATE_VP8_DATA) {
VP8Io* const io = &idec->io_;
if (io->teardown) {
if (io->teardown != NULL) {
io->teardown(io);
}
}
@ -574,7 +574,8 @@ WebPIDecoder* WebPINewDecoder(WebPDecBuffer* output_buffer) {
VP8InitIo(&idec->io_);
WebPResetDecParams(&idec->params_);
idec->params_.output = output_buffer ? output_buffer : &idec->output_;
idec->params_.output = (output_buffer != NULL) ? output_buffer
: &idec->output_;
WebPInitCustomIo(&idec->params_, &idec->io_); // Plug the I/O functions.
return idec;

View File

@ -601,7 +601,7 @@ static int CustomPut(const VP8Io* io) {
return 0;
}
num_lines_out = p->emit(io, p);
if (p->emit_alpha) {
if (p->emit_alpha != NULL) {
p->emit_alpha(io, p);
}
p->last_y += num_lines_out;

View File

@ -766,9 +766,7 @@ void VP8Clear(VP8Decoder* const dec) {
if (dec->use_threads_) {
WebPWorkerEnd(&dec->worker_);
}
if (dec->mem_) {
free(dec->mem_);
}
free(dec->mem_);
dec->mem_ = NULL;
dec->mem_size_ = 0;
memset(&dec->br_, 0, sizeof(dec->br_));

View File

@ -397,7 +397,7 @@ VP8StatusCode WebPParseHeaders(WebPHeaderStructure* const headers) {
// WebPDecParams
void WebPResetDecParams(WebPDecParams* const params) {
if (params) {
if (params != NULL) {
memset(params, 0, sizeof(*params));
}
}