Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows (mingw64) fixes #12

Merged
merged 10 commits into from
Feb 6, 2023
Merged
11 changes: 7 additions & 4 deletions harminv-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static int eat_whitespace(FILE *f, int echo_comments)
} while (c != EOF && c != '\n');
}
} while (isspace (c));
if (c == -1) return -1;
stevengj marked this conversation as resolved.
Show resolved Hide resolved
ungetc(c, f); /* put back the last character read */
newlines -= c == '\n';
return newlines;
Expand Down Expand Up @@ -87,10 +88,12 @@ static cmplx *read_input_data(FILE *f, int *n, int verbose)
*n = 0;

do {
double re, im;
double re=0.0, im=0.0;
int nread;

line += eat_whitespace(f, verbose);
int whitespace_lines = eat_whitespace(f, verbose);
if (whitespace_lines == -1) break; /* eof */
line += whitespace_lines;

nread = fscanf(f, "%lg", &re);
if (nread == 1 && eat_plus(f)) {
nread = fscanf(f, "%lg", &im);
Expand Down Expand Up @@ -251,7 +254,7 @@ static int mode_ok(harminv_data d, int k, void *ok_d_)

ok = ((!ok_d->only_f_inrange || (f >= ok_d->fmin && f <= ok_d->fmax))
&& errk <= ok_d->err_thresh
&& errk <= ok_d->min_err * ok_d->rel_err_thresh
&& (!isfinite(ok_d->rel_err_thresh) || errk <= ok_d->min_err * ok_d->rel_err_thresh)
&& ampk >= ok_d->amp_thresh
&& ampk >= ok_d->rel_amp_thresh * ok_d->max_amp
&& fabs(harminv_get_Q(d,k)) >= ok_d->Q_thresh);
Expand Down