From 1be5be811df9e50629c8d079e312a2ea6db82bcb Mon Sep 17 00:00:00 2001 From: Ole Streicher Date: Sun, 5 Nov 2017 11:40:06 +0100 Subject: [PATCH] Fix type of variable to hold vo_paramNext() return value `vo_paramNext()` returns an `int`, and specifically returns a negative value if there are arguments left after processing the options. Depending on the signedness of `char`, this may be converted to a positive value if the return value is converted to a `char`. This happens f.e. on ARM processors, where the char is `unsigned char` by default. Since the option parsing is stopped when this is `<=0`, additional (non-option) arguments lead to an errornous processing. The correct type to hold the return value is `int`, and this was already set in some VO applications (f.e. `votjoin`). This patch changes this for the remaining apps. This fixes the read problem of VOTables on arm processors. --- vendor/voclient/voapps/task/pkgMain.c | 4 ++-- vendor/voclient/voapps/voatlas.c | 4 ++-- vendor/voclient/voapps/vosamp.c | 4 ++-- vendor/voclient/voapps/vosession.c | 4 ++-- vendor/voclient/voapps/vosloanspec.c | 4 ++-- vendor/voclient/voapps/votcat.c | 4 ++-- vendor/voclient/voapps/votcnv.c | 4 ++-- vendor/voclient/voapps/votget.c | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/vendor/voclient/voapps/task/pkgMain.c b/vendor/voclient/voapps/task/pkgMain.c index 6b616f633..6392b2c39 100644 --- a/vendor/voclient/voapps/task/pkgMain.c +++ b/vendor/voclient/voapps/task/pkgMain.c @@ -51,8 +51,8 @@ static struct option long_opts[] = { */ int main (int argc, char *argv[]) { - char **pargv, optval[SZ_FNAME], ch; - int pos = 0; + char **pargv, optval[SZ_FNAME]; + int pos = 0, ch; /* Process arguments. diff --git a/vendor/voclient/voapps/voatlas.c b/vendor/voclient/voapps/voatlas.c index a72f44224..e2a8f3889 100644 --- a/vendor/voclient/voapps/voatlas.c +++ b/vendor/voclient/voapps/voatlas.c @@ -123,10 +123,10 @@ static void Tests (char *input); int voatlas (int argc, char **argv, size_t *reslen, void **result) { - char **pargv, optval[SZ_FNAME], ch; + char **pargv, optval[SZ_FNAME]; char *iname = NULL, *oname = NULL, *dlname = NULL; char tmp[SZ_FNAME], buf[SZ_FNAME]; - int i=1, status = OK, apos = 0, samp = -1, naxis = 512; + int i=1, status = OK, apos = 0, samp = -1, naxis = 512, ch; /* Initialize. diff --git a/vendor/voclient/voapps/vosamp.c b/vendor/voclient/voapps/vosamp.c index 4cc49d08a..740860691 100644 --- a/vendor/voclient/voapps/vosamp.c +++ b/vendor/voclient/voapps/vosamp.c @@ -253,8 +253,8 @@ static void Tests (char *input); int vosamp (int argc, char **argv, size_t *reslen, void **result) { - char **pargv, optval[SZ_FNAME], ch, *env_proxy = NULL; - int i, pos = 0, len = 0; + char **pargv, optval[SZ_FNAME], *env_proxy = NULL; + int i, pos = 0, len = 0, ch; time_t expiry; diff --git a/vendor/voclient/voapps/vosession.c b/vendor/voclient/voapps/vosession.c index 958f1787b..9f88a2cb1 100644 --- a/vendor/voclient/voapps/vosession.c +++ b/vendor/voclient/voapps/vosession.c @@ -222,8 +222,8 @@ static void sess_printClients (void); int main (int argc, char **argv) { - char **pargv, optval[SZ_FNAME], ch; - int i, rc, pos = 0; + char **pargv, optval[SZ_FNAME]; + int i, rc, pos = 0, ch; diff --git a/vendor/voclient/voapps/vosloanspec.c b/vendor/voclient/voapps/vosloanspec.c index 70fcfbe9b..655490d6f 100644 --- a/vendor/voclient/voapps/vosloanspec.c +++ b/vendor/voclient/voapps/vosloanspec.c @@ -180,9 +180,9 @@ extern char *vo_urlEncode (char *target); int vosloanspec (int argc, char **argv, size_t *reslen, void **result) { - int apos, argnum = 0, status = OK; + int apos, argnum = 0, status = OK, ch; FILE *fd = (FILE *) NULL; - char **pargv, optval[SZ_FNAME], ch, *urlList = NULL;; + char **pargv, optval[SZ_FNAME], *urlList = NULL;; char *tmp = vot_mktemp ("vosloan"); diff --git a/vendor/voclient/voapps/votcat.c b/vendor/voclient/voapps/votcat.c index d1661f8fd..6c9e149df 100644 --- a/vendor/voclient/voapps/votcat.c +++ b/vendor/voclient/voapps/votcat.c @@ -60,9 +60,9 @@ int votcat (int argc, char **argv, size_t *reslen, void **result) { char **pargv, optval[SZ_FNAME]; - char *oname = (char *) NULL, ch; + char *oname = (char *) NULL; char *infile[MAX_FILES]; - int i, verbose = 0, indent = 1, pos = 0; + int i, verbose = 0, indent = 1, pos = 0, ch; if (argc < 3) { diff --git a/vendor/voclient/voapps/votcnv.c b/vendor/voclient/voapps/votcnv.c index 7ba0421d6..420f2dac4 100644 --- a/vendor/voclient/voapps/votcnv.c +++ b/vendor/voclient/voapps/votcnv.c @@ -70,9 +70,9 @@ extern int vot_atoi (char *v); int votcnv (int argc, char **argv, size_t *reslen, void **result) { - int status = OK, pos = 0; + int status = OK, pos = 0, ch; char *iname = NULL, *name = NULL, *oname = NULL, format[SZ_FORMAT]; - char **pargv, ch, optval[SZ_FNAME]; + char **pargv, optval[SZ_FNAME]; /* Parse the argument list. diff --git a/vendor/voclient/voapps/votget.c b/vendor/voclient/voapps/votget.c index 87bef50c0..728128a41 100644 --- a/vendor/voclient/voapps/votget.c +++ b/vendor/voclient/voapps/votget.c @@ -195,8 +195,8 @@ int votget (int argc, char **argv, size_t *reslen, void **result) { char **pargv, optval[SZ_FNAME]; - char *iname = NULL, ch; - int samp = 0, pos = 0, stat = OK; + char *iname = NULL; + int samp = 0, pos = 0, stat = OK, ch; /* Initialize.