Browse Source

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

pre-master-46
Jim Monte 7 years ago
committed by Holger Vogt
parent
commit
ea81da2b01
  1. 6
      src/frontend/postcoms.c
  2. 2
      src/frontend/terminal.c
  3. 5
      src/frontend/variable.c
  4. 6
      src/frontend/vectors.c
  5. 10
      src/maths/cmaths/cmath2.c
  6. 2
      src/misc/wlist.c
  7. 7
      src/winmain.c

6
src/frontend/postcoms.c

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

2
src/frontend/terminal.c

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

5
src/frontend/variable.c

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

6
src/frontend/vectors.c

@ -1140,9 +1140,11 @@ vec_mkfamily(struct dvec *v) {
d->v_dims[0] = size; d->v_dims[0] = size;
if (isreal(v)) { 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 { } 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. */ /* Add one to the counter. */
(void) incindex(count, v->v_numdims - 1, v->v_dims, v->v_numdims); (void) incindex(count, v->v_numdims - 1, v->v_dims, v->v_numdims);

10
src/maths/cmaths/cmath2.c

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

2
src/misc/wlist.c

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

7
src/winmain.c

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

Loading…
Cancel
Save