projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix use of size_t in printf formats. Patch #5727.
[pspp]
/
src
/
language
/
tests
/
moments-test.c
diff --git
a/src/language/tests/moments-test.c
b/src/language/tests/moments-test.c
index 619f797e0356df49fc18efd8a7c8f03aefd70009..e62a34322b0f78e1359115688c4d973dc4b2c9d6 100644
(file)
--- a/
src/language/tests/moments-test.c
+++ b/
src/language/tests/moments-test.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-26,31
+25,32
@@
#include <math.h>
#include <stdlib.h>
#include "xalloc.h"
#include <math.h>
#include <stdlib.h>
#include "xalloc.h"
+#include <libpspp/compiler.h>
#define _(msgid) gettext (msgid)
#define _(msgid) gettext (msgid)
-static
int
-read_values (double **values, double **weights, size_t *cnt)
+static
bool
+read_values (
struct lexer *lexer,
double **values, double **weights, size_t *cnt)
{
size_t cap = 0;
*values = NULL;
*weights = NULL;
*cnt = 0;
{
size_t cap = 0;
*values = NULL;
*weights = NULL;
*cnt = 0;
- while (lex_is_number ())
+ while (lex_is_number (
lexer
))
{
{
- double value =
tokval
;
+ double value =
lex_tokval (lexer)
;
double weight = 1.;
double weight = 1.;
- lex_get ();
- if (lex_match ('*'))
+ lex_get (
lexer
);
+ if (lex_match (
lexer,
'*'))
{
{
- if (!lex_is_number ())
+ if (!lex_is_number (
lexer
))
{
{
- lex_error (_("expecting weight value"));
- return
0
;
+ lex_error (
lexer,
_("expecting weight value"));
+ return
false
;
}
}
- weight =
tokval
;
- lex_get ();
+ weight =
lex_tokval (lexer)
;
+ lex_get (
lexer
);
}
if (*cnt >= cap)
}
if (*cnt >= cap)
@@
-65,11
+65,11
@@
read_values (double **values, double **weights, size_t *cnt)
(*cnt)++;
}
(*cnt)++;
}
- return
1
;
+ return
true
;
}
int
}
int
-cmd_debug_moments (
void
)
+cmd_debug_moments (
struct lexer *lexer, struct dataset *ds UNUSED
)
{
int retval = CMD_FAILURE;
double *values = NULL;
{
int retval = CMD_FAILURE;
double *values = NULL;
@@
-79,22
+79,22
@@
cmd_debug_moments (void)
size_t cnt;
size_t i;
size_t cnt;
size_t i;
- if (lex_match_id ("ONEPASS"))
+ if (lex_match_id (
lexer,
"ONEPASS"))
two_pass = 0;
two_pass = 0;
- if (
token
!= '/')
+ if (
lex_token (lexer)
!= '/')
{
{
- lex_force_match ('/');
+ lex_force_match (
lexer,
'/');
goto done;
}
goto done;
}
- fprintf (stderr, "%s => ", lex_rest_of_line (NULL));
- lex_get ();
+ fprintf (stderr, "%s => ", lex_rest_of_line (
lexer,
NULL));
+ lex_get (
lexer
);
if (two_pass)
{
struct moments *m = NULL;
m = moments_create (MOMENT_KURTOSIS);
if (two_pass)
{
struct moments *m = NULL;
m = moments_create (MOMENT_KURTOSIS);
- if (!read_values (&values, &weights, &cnt))
+ if (!read_values (
lexer,
&values, &weights, &cnt))
{
moments_destroy (m);
goto done;
{
moments_destroy (m);
goto done;
@@
-111,7
+111,7
@@
cmd_debug_moments (void)
struct moments1 *m = NULL;
m = moments1_create (MOMENT_KURTOSIS);
struct moments1 *m = NULL;
m = moments1_create (MOMENT_KURTOSIS);
- if (!read_values (&values, &weights, &cnt))
+ if (!read_values (
lexer,
&values, &weights, &cnt))
{
moments1_destroy (m);
goto done;
{
moments1_destroy (m);
goto done;
@@
-125,7
+125,7
@@
cmd_debug_moments (void)
fprintf (stderr, "W=%.3f", weight);
for (i = 0; i < 4; i++)
{
fprintf (stderr, "W=%.3f", weight);
for (i = 0; i < 4; i++)
{
- fprintf (stderr, " M%d=", i + 1);
+ fprintf (stderr, " M%d=",
(int)
i + 1);
if (M[i] == SYSMIS)
fprintf (stderr, "sysmis");
else if (fabs (M[i]) <= 0.0005)
if (M[i] == SYSMIS)
fprintf (stderr, "sysmis");
else if (fabs (M[i]) <= 0.0005)
@@
-135,7
+135,7
@@
cmd_debug_moments (void)
}
fprintf (stderr, "\n");
}
fprintf (stderr, "\n");
- retval = lex_end_of_command ();
+ retval = lex_end_of_command (
lexer
);
done:
free (values);
done:
free (values);