Примеры ошибок, обнаруженных с помощью диагностики V555
V555. Expression of the 'A - B > 0' kind will work as 'A != B'.
Trans-Proteomic Pipeline
V555 The expression 'ppw_ref.size() - have_cluster > 0' will work as 'ppw_ref.size() != have_cluster'. proteinprophet.cpp 6767
size_type size() const;
void computeDegenWts()
{
....
int have_cluster = 0;
....
if ( have_cluster > 0 && ppw_ref.size() - have_cluster > 0 )
....
}
Scilab
V555 The expression 'wcslen(dir) - wcslen(DirTmp) > 0' will work as 'wcslen(dir) != wcslen(DirTmp)'. getscilabdirectory.c 44
size_t wcslen(const wchar_t * _Str);
char *getScilabDirectory(BOOL UnixStyle)
{
....
if (wcslen(dir) - wcslen(DirTmp)>0)
{
dir[wcslen(dir) - wcslen(DirTmp)] = L'\0';
}
else return NULL;
....
}
Similar errors can be found in some other places:
- V555 The expression 'nbcharacters - 1 > 0' will work as 'nbcharacters != 1'. checkcsvwriteformat.c 85
OpenSSL
V555 The expression of the 'A - B > 0' kind will work as 'A != B'. bio_ok.c 243
typedef struct ok_struct
{
....
size_t buf_len_save;
size_t buf_off_save;
....
} BIO_OK_CTX;
static int ok_read(BIO *b, char *out, int outl)
{
....
BIO_OK_CTX *ctx;
....
/* copy start of the next block into proper place */
if(ctx->buf_len_save - ctx->buf_off_save > 0)
....
}
Wine Is Not an Emulator
V555 The expression 'This->nStreams - nr > 0' will work as 'This->nStreams != nr'. editstream.c 172
static HRESULT
AVIFILE_RemoveStream(IAVIEditStreamImpl* const This, DWORD nr)
{
....
This->nStreams--;
if (This->nStreams - nr > 0) { // <=
memmove(This->pStreams + nr, This->pStreams + nr + 1,
(This->nStreams - nr) * sizeof(EditStreamTable));
}
....
}
Similar errors can be found in some other places:
- V555 The expression 'This->fInfo.dwStreams - nStream > 0' will work as 'This->fInfo.dwStreams != nStream'. avifile.c 469
PHP:Hypertext Preprocessor
V555 The expression 'out_buf_size - ocnt > 0' will work as 'out_buf_size != ocnt'. filters.c 1702
static int strfilter_convert_append_bucket(
{
size_t out_buf_size;
....
size_t ocnt, icnt, tcnt;
....
if (out_buf_size - ocnt > 0) { // <=
....
php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC);
} else {
pefree(out_buf, persistent);
}
....
}
OpenJPEG
V555 The expression of the 'A - B > 0' kind will work as 'A != B'. itkopenjpeg j2k.c 3421
typedef struct opj_stepsize
{
OPJ_UINT32 expn;
OPJ_UINT32 mant;
};
bool j2k_read_SQcd_SQcc(
opj_j2k_t *p_j2k,
OPJ_UINT32 p_comp_no,
OPJ_BYTE* p_header_data,
OPJ_UINT32 * p_header_size,
struct opj_event_mgr * p_manager
)
{
....
OPJ_UINT32 l_band_no;
....
l_tccp->stepsizes[l_band_no].expn =
((l_tccp->stepsizes[0].expn) - ((l_band_no - 1) / 3) > 0) ?
(l_tccp->stepsizes[0].expn) - ((l_band_no - 1) / 3) : 0;
....
}
K Desktop Environment
V555 The expression 'm_pos - backOffset > 0' will work as 'm_pos != backOffset'. pp-stream.cpp 225
unsigned int rpp::Stream::peekLastOutput(uint backOffset) const {
if(m_pos - backOffset > 0)
return m_string->at(m_pos - backOffset - 1);
return 0;
}
Similar errors can be found in some other places:
- V555 The expression 'nextOffset - currentOffset > 0' will work as 'nextOffset != currentOffset'. pp-location.cpp 211
FreeSWITCH
V555 The expression 'parser->maxlen - parser->minlen > 0' will work as 'parser->maxlen != parser->minlen'. switch_ivr.c 2342
typedef uintptr_t switch_size_t;
switch_size_t maxlen;
switch_size_t buflen;
switch_size_t minlen;
SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(....)
{
....
if (parser->maxlen - parser->minlen > 0 && ....) {
len = 0;
}
....
}