Clang static analyser warnings

This commit is contained in:
Shahram Najm 2020-02-11 14:39:09 +00:00
parent deac4b3488
commit b9ea2a2eef
3 changed files with 7 additions and 6 deletions

View File

@ -1003,7 +1003,7 @@ static int encode_double_value(grib_context* c, grib_buffer* buff, long* pos, bu
"ECCODES WARNING : encode_double_value: %s. Value (%g) out of range (minAllowed=%g, maxAllowed=%g)."
" Setting it to missing value\n",
bd->shortName, value, minAllowed, maxAllowed);
value = GRIB_MISSING_DOUBLE; /* Ignore the bad value and instead use 'missing' */
/* Ignore the bad value and instead use 'missing' */
grib_set_bits_on(buff->data, pos, modifiedWidth);
}
else {

View File

@ -329,9 +329,10 @@ static int unpack_string(grib_accessor* a, char* buffer, size_t* len)
}
*len = rsize;
Assert(buffer);
memcpy(buffer, start, rsize);
buffer[rsize] = 0;
if (buffer && start) {
memcpy(buffer, start, rsize);
buffer[rsize] = 0;
}
/* grib_trie_delete(dictionary); */

View File

@ -199,9 +199,9 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
}
helper->jpeg_length = jpcstream->rwcnt_;
jaserr = jas_stream_close(istream);
jas_stream_close(istream);
istream = 0;
jaserr = jas_stream_close(jpcstream);
jas_stream_close(jpcstream);
jpcstream = 0;
cleanup: