[PATCH #55-1] Fixed some compiler warnings added by Visual Studio 2019

This commit is contained in:
Jim Monte 2019-05-29 22:57:40 +02:00 committed by Holger Vogt
parent 8a6c9a29e5
commit 3d77a32be1
7 changed files with 21 additions and 17 deletions

View File

@ -163,7 +163,7 @@ com_print(wordlist *wl)
if (width < 60)
width = 60;
if (width > BSIZE_SP - 2)
buf = TREALLOC(char, buf, width + 1);
buf = TREALLOC(char, buf, (size_t) width + 1);
for (v = vecs; v; v = v->v_link2) {
char *basename = vec_basename(v);
if (plotnames)
@ -239,8 +239,8 @@ com_print(wordlist *wl)
if (width < 40)
width = 40;
if (width > BSIZE_SP - 2) {
buf = TREALLOC(char, buf, width + 1);
buf2 = TREALLOC(char, buf2, width + 1);
buf = TREALLOC(char, buf, (size_t) width + 1);
buf2 = TREALLOC(char, buf2, (size_t) width + 1);
}
if (cp_getvar("height", CP_NUM, &i, 0))
height = i;

View File

@ -129,7 +129,7 @@ outbufputc(void)
{
if (ourbuf.count != BUFSIZ) {
fputs(staticbuf, cp_out);
memset(staticbuf, 0, (size_t) (BUFSIZ - ourbuf.count));
memset(staticbuf, 0, (size_t) BUFSIZ - ourbuf.count);
ourbuf.count = BUFSIZ;
ourbuf.ptr = staticbuf;
}

View File

@ -275,8 +275,9 @@ cp_setparse(wordlist *wl)
while (wl) {
if (name)
tfree(name);
if (name) {
txfree(name);
}
name = cp_unquote(wl->wl_word);

View File

@ -1140,9 +1140,11 @@ vec_mkfamily(struct dvec *v) {
d->v_dims[0] = size;
if (isreal(v)) {
memcpy(d->v_realdata, v->v_realdata + size*i, (size_t) size * sizeof(double));
memcpy(d->v_realdata, v->v_realdata + (size_t) size * i,
(size_t) size * sizeof(double));
} else {
memcpy(d->v_compdata, v->v_compdata + size*i, (size_t) size * sizeof(ngcomplex_t));
memcpy(d->v_compdata, v->v_compdata + (size_t) size * i,
(size_t) size * sizeof(ngcomplex_t));
}
/* Add one to the counter. */
(void) incindex(count, v->v_numdims - 1, v->v_dims, v->v_numdims);

View File

@ -332,7 +332,7 @@ cx_avg(void *data, short int type, int length, int *newlength, short int *newtyp
for (i = 0; i < length; i++) {
sum_real += dd[i];
d[i] = sum_real / (double)(i+1);
d[i] = sum_real / ((double) i + 1.0);
}
return ((void *) d);
@ -347,10 +347,10 @@ cx_avg(void *data, short int type, int length, int *newlength, short int *newtyp
for (i = 0; i < length; i++) {
sum_real += realpart(cc[i]);
realpart(c[i]) = sum_real / (double)(i+1);
realpart(c[i]) = sum_real / ((double) i + 1.0);
sum_imag += imagpart(cc[i]);
imagpart(c[i]) = sum_imag / (double)(i+1);
imagpart(c[i]) = sum_imag / ((double) i + 1.0);
}
return ((void *) c);
@ -412,7 +412,7 @@ cx_stddev(void *data, short int type, int length, int *newlength, short int *new
*newtype = VF_REAL;
for (i = 0; i < length; i++)
sum += (dd[i] - *mean) * (dd[i] - *mean);
*d = sqrt(sum / (length - 1));
*d = sqrt(sum / ((double) length - 1.0));
tfree(mean);
return ((void *)d);
}
@ -429,7 +429,7 @@ cx_stddev(void *data, short int type, int length, int *newlength, short int *new
b = imagpart(cc[i]) - imagpart(*cmean);
sum += a * a + b * b;
}
*d = sqrt(sum / (length - 1));
*d = sqrt(sum / ((double) length - 1.0));
tfree(cmean);
return ((void *)d);
}

View File

@ -131,7 +131,7 @@ char **
wl_mkvec(const wordlist *wl)
{
int len = wl_length(wl);
char **vec = TMALLOC(char *, len + 1);
char **vec = TMALLOC(char *, (size_t) len + 1);
int i;

View File

@ -258,7 +258,7 @@ SetAnalyse(char *Analyse, /* in: analysis type */
OldPercent = DecaPercent;
/* output only into hwAnalyse window and if time elapsed is larger than
DELTATIME given value, or if analysis has changed, else return */
if (hwAnalyse && ((diffsec > 0) || (diffmillisec > DELTATIME) || strcmp(OldAn, Analyse))) {
if (((diffsec > 0) || (diffmillisec > DELTATIME) || strcmp(OldAn, Analyse))) {
if (DecaPercent < 0) {
sprintf(s, "--ready--");
sprintf(t, "%s", PACKAGE_STRING);
@ -313,7 +313,7 @@ AdjustScroller(void)
if (MyFirstLine < 0 )
MyFirstLine = 0;
Edit_Scroll(twText, MyFirstLine - FirstLine, 0);
Edit_Scroll(twText, (WPARAM) MyFirstLine - FirstLine, 0);
// Das wars
DoUpdate = FALSE;
}
@ -1034,7 +1034,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCm
/* terminate */
return nReturnCode;
}
} /* end of function WinMain */
// -----------------------------------<User-IO>--------------------------------