Replaced ancient K&R function declarations to be C23 compatible

This commit is contained in:
Sean McBride 2023-11-06 21:06:15 -05:00
parent 002e2869ab
commit 56844001f5
19 changed files with 83 additions and 160 deletions

View File

@ -260,10 +260,7 @@ local const z_crc_t FAR * ZEXPORT get_crc_table()
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
/* ========================================================================= */
local unsigned long ZEXPORT crc32_z(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
z_size_t len;
local unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
{
if (buf == Z_NULL) return 0UL;

View File

@ -150,8 +150,7 @@ variables:
RESULT. Return 1 if the difference is negative, otherwise 0. This
function from the GNU documentation. */
static int
timeval_subtract (result, x, y)
struct timeval *result, *x, *y;
timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating Y. */
if (x->tv_usec < y->tv_usec) {

View File

@ -21,8 +21,7 @@ See \ref copyright file for more info.
RESULT. Return 1 if the difference is negative, otherwise 0. This
function from the GNU documentation. */
int
nc4_timeval_subtract (result, x, y)
struct timeval *result, *x, *y;
nc4_timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating Y. */
if (x->tv_usec < y->tv_usec) {

View File

@ -23,9 +23,7 @@ struct netcdf test; /*
*/
void
add_dim (test, idim) /* add the dimension idim to the netcdf test */
struct netcdf *test;
struct cdfdim *idim;
add_dim (struct netcdf *test, struct cdfdim *idim) /* add the dimension idim to the netcdf test */
{
static char pname[] = "add_dim";
@ -43,9 +41,7 @@ add_dim (test, idim) /* add the dimension idim to the netcdf test */
}
void
add_var (test, ivar) /* add the variable ivar to the netcdf test */
struct netcdf *test;
struct cdfvar *ivar;
add_var (struct netcdf *test, struct cdfvar *ivar) /* add the variable ivar to the netcdf test */
{
static char pname[] = "add_var";
int i;
@ -68,10 +64,7 @@ add_var (test, ivar) /* add the variable ivar to the netcdf test */
}
void
add_att (test, varid, iatt) /* add attribute iatt to the netcdf test */
struct netcdf *test;
int varid; /* variable id */
struct cdfatt *iatt;
add_att (struct netcdf *test, int varid, struct cdfatt *iatt) /* add attribute iatt to the netcdf test */
{
static char pname[] = "add_att";
int ia; /* attribute number */
@ -108,8 +101,7 @@ add_att (test, varid, iatt) /* add attribute iatt to the netcdf test */
void
add_reset(test) /* reset in-memory netcdf test to empty */
struct netcdf *test;
add_reset(struct netcdf *test) /* reset in-memory netcdf test to empty */
{
test->ndims = 0;
test->nvars = 0;
@ -120,10 +112,7 @@ add_reset(test) /* reset in-memory netcdf test to empty */
void
del_att (test, varid, iatt) /* delete attribute iatt in the netcdf test */
struct netcdf *test;
int varid; /* variable id */
struct cdfatt *iatt;
del_att (struct netcdf *test, int varid, struct cdfatt *iatt) /* delete attribute iatt in the netcdf test */
{
static char pname[] = "del_att";
int ia, ib; /* attribute number */
@ -153,11 +142,7 @@ del_att (test, varid, iatt) /* delete attribute iatt in the netcdf test */
}
void
add_data(test, varid, start, edges) /* keep max record written updated */
struct netcdf *test;
int varid;
long start[];
long edges[];
add_data(struct netcdf *test, int varid, long start[], long edges[]) /* keep max record written updated */
{
if (varid != test->xdimid) /* not a record variable */
return;
@ -167,9 +152,7 @@ add_data(test, varid, start, edges) /* keep max record written updated */
void
errvar(cdfp, varp)
struct netcdf *cdfp;
struct cdfvar *varp;
errvar(struct netcdf *cdfp, struct cdfvar *varp)
{
const char *types;
int id;

View File

@ -41,8 +41,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncattput(path)
const char *path; /* name of writable netcdf file to open */
test_ncattput(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattput";
@ -341,8 +340,7 @@ test_ncattput(path)
* try with bad netCDF handle, check error
*/
int
test_ncattinq(path)
const char *path; /* name of writable netcdf file to open */
test_ncattinq(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattinq";
@ -456,8 +454,7 @@ test_ncattinq(path)
* try with bad netCDF handle, check error
*/
int
test_ncattget(path)
const char *path; /* name of writable netcdf file to open */
test_ncattget(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
int cdfid; /* netcdf id */
@ -627,10 +624,10 @@ test_ncattget(path)
* try with bad source or target netCDF handles, check error
* try with bad source or target variable handle, check error
*/
/* path1: name of input netcdf file to open */
/* path2: name of output netcdf file to create */
int
test_ncattcopy(path1, path2)
const char *path1; /* name of input netcdf file to open */
const char *path2; /* name of output netcdf file to create */
test_ncattcopy(const char *path1, const char *path2)
{
int nerrs = 0;
static char pname[] = "test_ncattcopy";
@ -905,8 +902,7 @@ test_ncattcopy(path1, path2)
* try with bad attribute number, check error
*/
int
test_ncattname(path)
const char *path; /* name of writable netcdf file to open */
test_ncattname(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattname";
@ -1091,8 +1087,7 @@ test_ncattname(path)
* try with bad netCDF handle, check error
*/
int
test_ncattrename(path)
const char *path; /* name of writable netcdf file to open */
test_ncattrename(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattrename";
@ -1234,8 +1229,7 @@ test_ncattrename(path)
* try in data mode, check error
*/
int
test_ncattdel(path)
const char *path; /* name of writable netcdf file to open */
test_ncattdel(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncattdel";

View File

@ -28,8 +28,7 @@
* Uses: nccreate, ncendef, ncclose, ncopen.
*/
int
test_nccreate(path)
const char *path; /* name of netCDF file to create */
test_nccreate(const char *path) /* name of netCDF file to create */
{
int nerrs = 0;
static char pname[] = "test_nccreate";
@ -94,8 +93,7 @@ test_nccreate(path)
#define DATA_LEN 32
#define TEMP_FILE_NAME "temp.tmp"
int
test_ncopen(path)
const char *path; /* name of writable netcdf file to open */
test_ncopen(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncopen";
@ -240,8 +238,7 @@ test_ncopen(path)
* Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncclose
*/
int
test_ncredef(path)
const char *path; /* name of writable netcdf file to open */
test_ncredef(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncredef";
@ -328,8 +325,7 @@ test_ncredef(path)
* Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncendef, ncclose
*/
int
test_ncendef(path)
const char *path; /* name of writable netcdf file to open */
test_ncendef(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncendef";
@ -422,8 +418,7 @@ test_ncendef(path)
* On exit netcdf files are closed.
*/
int
test_ncclose(path)
const char *path; /* name of writable netcdf file to open */
test_ncclose(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncclose";
@ -476,8 +471,7 @@ test_ncclose(path)
* On exit netcdf files are closed.
*/
int
test_ncinquire(path)
const char *path; /* name of writable netcdf file to open */
test_ncinquire(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncinquire";
@ -640,8 +634,7 @@ test_ncinquire(path)
* On exit netcdf files are closed.
*/
int
test_ncsync(path)
const char *path; /* name of writable netcdf file to open */
test_ncsync(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncsync";
@ -781,8 +774,7 @@ test_ncsync(path)
* On exit netcdf files are closed.
*/
int
test_ncabort(path)
const char *path; /* name of writable netcdf file to open */
test_ncabort(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncabort";

View File

@ -25,8 +25,7 @@
* try to define a second unlimited dimension, check error
*/
int
test_ncdimdef(path)
const char *path; /* name of writable netcdf to open */
test_ncdimdef(const char *path) /* name of writable netcdf to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimdef";
@ -129,8 +128,7 @@ test_ncdimdef(path)
* try with bad handle, check error
*/
int
test_ncdimid(path)
const char *path; /* name of writable netcdf file to open */
test_ncdimid(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimid";
@ -206,8 +204,7 @@ test_ncdimid(path)
* try with bad netCDF handle, check error
*/
int
test_ncdiminq(path)
const char *path; /* name of writable netcdf file to open */
test_ncdiminq(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdiminq";
@ -303,8 +300,7 @@ test_ncdiminq(path)
* try with bad netCDF handle, check error
*/
int
test_ncdimrename(path)
const char *path; /* name of writable netcdf file to open */
test_ncdimrename(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncdimrename";

View File

@ -12,8 +12,7 @@
#include "emalloc.h"
void *
emalloc (size) /* check return from malloc */
size_t size;
emalloc (size_t size) /* check return from malloc */
{
void *p;
@ -32,9 +31,7 @@ emalloc (size) /* check return from malloc */
}
void *
erealloc (ptr, size) /* check return from realloc */
void *ptr;
size_t size;
erealloc (void *ptr, size_t size) /* check return from realloc */
{
void *p;

View File

@ -20,9 +20,7 @@
* error.
*/
static int
numrecvars(ncid, recvarids)
int ncid;
int *recvarids;
numrecvars(int ncid, int *recvarids)
{
int ndims, iv, nvars;
int nrecvars;
@ -52,9 +50,7 @@ numrecvars(ncid, recvarids)
* variable id. Returns 0 if not a record variable. Returns -1 on error.
*/
static long
ncrecsize(ncid,vid)
int ncid;
int vid;
ncrecsize(int ncid,int vid)
{
int recdimid;
nc_type type;
@ -87,11 +83,7 @@ ncrecsize(ncid,vid)
* errors better.
*/
static int
recinq(ncid, nrecvars, recvarids, recsizes)
int ncid;
int *nrecvars;
int *recvarids;
long *recsizes;
recinq(int ncid, int *nrecvars, int *recvarids, long *recsizes)
{
int iv;
int rvarids[MAX_NC_VARS];
@ -119,8 +111,7 @@ recinq(ncid, nrecvars, recvarids, recsizes)
* try with bad netCDF handle, check error
*/
int
test_ncrecinq(path)
const char *path; /* name of netcdf file to open */
test_ncrecinq(const char *path) /* name of netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncrecinq";
@ -225,10 +216,7 @@ test_ncrecinq(path)
* an open netCDF file. Returns -1 on error.
*/
static int
dimsizes(ncid, varid, sizes)
int ncid;
int varid;
long *sizes;
dimsizes(int ncid, int varid, long *sizes)
{
int ndims;
int id;
@ -251,10 +239,7 @@ dimsizes(ncid, varid, sizes)
* better.
*/
static int
recput(ncid, recnum, datap)
int ncid;
long recnum;
void **datap;
recput(int ncid, long recnum, void **datap)
{
int iv;
int rvids[MAX_NC_VARS];
@ -288,10 +273,7 @@ recput(ncid, recnum, datap)
* better.
*/
static int
recget(ncid, recnum, datap)
int ncid;
long recnum;
void **datap;
recget(int ncid, long recnum, void **datap)
{
int iv;
int rvids[MAX_NC_VARS];
@ -327,8 +309,7 @@ recget(ncid, recnum, datap)
* try with bad netCDF handle, check error
*/
int
test_ncrecput(path)
const char *path; /* name of writable netcdf file to open */
test_ncrecput(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncrecput";
@ -485,8 +466,7 @@ test_ncrecput(path)
* try with bad netCDF handle, check error
*/
int
test_ncrecget(path)
const char *path; /* name of netcdf file to open */
test_ncrecget(const char *path) /* name of netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncrecget";

View File

@ -30,12 +30,12 @@
*
* v[ii] = val;
*/
/* type: netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
/* v: array of specified type */
/* ii: it's v[ii] we want to store into */
/* val: value to store */
static void
val_stuff(type, v, ii, val) /* v[ii] = val */
nc_type type; /* netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
void *v; /* array of specified type */
int ii; /* it's v[ii] we want to store into */
long val; /* value to store */
val_stuff(nc_type type, void *v, int ii, long val) /* v[ii] = val */
{
static char pname[] = "val_stuff";
@ -70,12 +70,12 @@ val_stuff(type, v, ii, val) /* v[ii] = val */
* returns 0 if equal, 1 if not equal
*/
/* type: netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
/* v: array of specified type */
/* ii: it's v[ii] we want to compare */
/* val: value to compare with */
static int
val_diff(type, v, ii, val) /* v[ii] != val */
nc_type type; /* netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
void *v; /* array of specified type */
int ii; /* it's v[ii] we want to compare */
long val; /* value to compare with */
val_diff(nc_type type, void *v, int ii, long val) /* v[ii] != val */
{
static char pname[] = "val_diff";
@ -109,8 +109,7 @@ val_diff(type, v, ii, val) /* v[ii] != val */
*/
int
test_slabs(cdfid)
int cdfid; /* handle of netcdf open and in data mode */
test_slabs(int cdfid) /* handle of netcdf open and in data mode */
{
int nerrs = 0;
static char pname[] = "test_slabs";

View File

@ -13,11 +13,11 @@
/* fill typed value block with values of specified type */
/* type: netcdf type, NC_BYTE, ..., NC_DOUBLE */
/* len: number of elements to fill with */
/* vals: start of first block of values */
void
val_fill(type, len, vals)
nc_type type; /* netcdf type, NC_BYTE, ..., NC_DOUBLE */
long len; /* number of elements to fill with */
void *vals; /* start of first block of values */
val_fill(nc_type type, long len, void *vals)
{
static char pname[] = "val_fill";
long half = len/2;
@ -64,11 +64,11 @@ val_fill(type, len, vals)
/* fill typed value block with zeros of specified type */
/* type: netcdf type, NC_BYTE, ..., NC_DOUBLE */
/* len: number of elements to fill with */
/* vals: start of first block of values */
void
val_fill_zero(type, len, vals)
nc_type type; /* netcdf type, NC_BYTE, ..., NC_DOUBLE */
long len; /* number of elements to fill with */
void *vals; /* start of first block of values */
val_fill_zero(nc_type type, long len, void *vals)
{
static char pname[] = "val_fill_zero";
int iel;
@ -118,12 +118,12 @@ val_fill_zero(type, len, vals)
* compare two typed value blocks, return 0 if equal, 1+n otherwise,
* where n is the index of the first differing element.
*/
/* type: netcdf type, NC_BYTE, ..., NC_DOUBLE */
/* len: number of elements of type to compare */
/* v1: start of first block of values */
/* v2: start of second block of values */
int
val_cmp (type, len, v1, v2)
nc_type type; /* netcdf type, NC_BYTE, ..., NC_DOUBLE */
long len; /* number of elements of type to compare */
void *v1; /* start of first block of values */
void *v2; /* start of second block of values */
val_cmp (nc_type type, long len, void *v1, void *v2)
{
static char pname[] = "val_cmp";
int iel;
@ -195,11 +195,11 @@ val_cmp (type, len, v1, v2)
/* print typed value block with values of specified type */
/* type: netcdf type, NC_BYTE, ..., NC_DOUBLE */
/* len: number of elements to fill with */
/* vals: start of first block of values */
void
val_out(type, len, vals)
nc_type type; /* netcdf type, NC_BYTE, ..., NC_DOUBLE */
long len; /* number of elements to fill with */
void *vals; /* start of first block of values */
val_out(nc_type type, long len, void *vals)
{
static char pname[] = "val_oout";
int iel;

View File

@ -105,8 +105,7 @@ init_epsilons()
* try in data mode, check error
*/
int
test_ncvardef(path)
const char *path; /* name of writable netcdf file to open */
test_ncvardef(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
int cdfid; /* netcdf id */

View File

@ -24,8 +24,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncvarget(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarget(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarget";

View File

@ -25,8 +25,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncvargetg(path)
const char *path; /* name of writable netcdf file to open */
test_ncvargetg(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvargetg";

View File

@ -25,8 +25,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncvarput(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarput(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarput";

View File

@ -25,8 +25,7 @@
* try with bad netCDF handle, check error
*/
int
test_ncvarputg(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarputg(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarputg";

View File

@ -25,8 +25,7 @@
* try with bad handle, check error
*/
int
test_ncvarid(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarid(const char *path) /* name of writable netcdf file to open */
{
static char pname[] = "test_ncvarid";
int cdfid; /* netcdf id */
@ -104,8 +103,7 @@ test_ncvarid(path)
* try with bad netCDF handle, check error
*/
int
test_ncvarinq(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarinq(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarinq";
@ -249,8 +247,7 @@ struct cdfelm { /* coordinates and generic value */
* get values and compare with put values
*/
static int
test_varputget1(cdfid)
int cdfid; /* handle of netcdf open and in data mode */
test_varputget1(int cdfid) /* handle of netcdf open and in data mode */
{
int nerrs = 0;
static char pname[] = "test_varputget1";
@ -380,8 +377,7 @@ test_varputget1(cdfid)
* try with bad netCDF handle, check error
*/
int
test_ncvarput1(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarput1(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarput1";
@ -468,8 +464,7 @@ test_ncvarput1(path)
* try with bad netCDF handle, check error
*/
int
test_ncvarget1(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarget1(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarget1";
@ -556,8 +551,7 @@ test_ncvarget1(path)
* try renaming to existing variable name, check error
*/
int
test_ncvarrename(path)
const char *path; /* name of writable netcdf file to open */
test_ncvarrename(const char *path) /* name of writable netcdf file to open */
{
int nerrs = 0;
static char pname[] = "test_ncvarrename";

View File

@ -34,8 +34,7 @@
*/
int
test_varputget(cdfid)
int cdfid; /* handle of netcdf open and in data mode */
test_varputget(int cdfid) /* handle of netcdf open and in data mode */
{
int nerrs = 0;
static char pname[] = "test_varputget";

View File

@ -34,8 +34,7 @@
*/
int
test_varputgetg(cdfid)
int cdfid; /* handle of netcdf open and in data mode */
test_varputgetg(int cdfid) /* handle of netcdf open and in data mode */
{
int nerrs = 0;
static char pname[] = "test_varputgetg";