add typecast to avoid (unlikely but possible) integer overflows.

this will silence a lot of static code analysis warnings
This commit is contained in:
Axel Kohlmeyer
2021-02-02 17:27:04 -05:00
parent 5196926c28
commit e2e6639013
155 changed files with 566 additions and 576 deletions

View File

@ -597,6 +597,6 @@ int FixOrientBCC::compare(const void *pi, const void *pj)
double FixOrientBCC::memory_usage()
{
double bytes = nmax * sizeof(Nbr);
bytes += 2*nmax * sizeof(double);
bytes += (double)2*nmax * sizeof(double);
return bytes;
}

View File

@ -595,6 +595,6 @@ int FixOrientFCC::compare(const void *pi, const void *pj)
double FixOrientFCC::memory_usage()
{
double bytes = nmax * sizeof(Nbr);
bytes += 2*nmax * sizeof(double);
bytes += (double)2*nmax * sizeof(double);
return bytes;
}

View File

@ -558,8 +558,8 @@ void FixTTM::end_of_step()
double FixTTM::memory_usage()
{
double bytes = 0.0;
bytes += 5*total_nnodes * sizeof(int);
bytes += 14*total_nnodes * sizeof(double);
bytes += (double)5*total_nnodes * sizeof(int);
bytes += (double)14*total_nnodes * sizeof(double);
return bytes;
}