Fix return type on a couple of internal utility functions

This commit is contained in:
Peter Hill 2024-01-15 13:28:19 +00:00
parent b94199874d
commit 409ca579ab
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE
6 changed files with 13 additions and 10 deletions

View File

@ -196,7 +196,7 @@ dimchunkspec_size(int indimid) {
/* Return number of dimensions for which chunking was specified in
* chunkspec string on command line, 0 if no chunkspec string was
* specified. */
int
size_t
dimchunkspec_ndims(void) {
return dimchunkspecs.ndims;
}

View File

@ -6,6 +6,9 @@
#ifndef _CHUNKSPEC_H_
#define _CHUNKSPEC_H_
#include <stddef.h>
#include "utils.h"
/* Parse chunkspec string and convert into internal data structure,
* associating dimids from open file or group specified by ncid with
* corresponding chunk sizes */
@ -25,7 +28,7 @@ dimchunkspec_exists(int indimid);
/* Return number of dimensions for which chunking was specified in
* chunkspec string on command line, 0 if no chunkspec string was
* specified. */
extern int
extern size_t
dimchunkspec_ndims(void);
/* Return whether chunking should be omitted, due to explicit

View File

@ -1806,7 +1806,7 @@ print_type_name(int locid, int typeid) {
static int
init_is_unlim(int ncid, int **is_unlim_p)
{
int num_grps; /* total number of groups */
size_t num_grps; /* total number of groups */
int max_dimid = -1; /* maximum dimid across whole dataset */
int *grpids = NULL; /* temporary list of all grpids */
int igrp;
@ -1822,7 +1822,7 @@ init_is_unlim(int ncid, int **is_unlim_p)
return NC_EBADGRPID;
/* Now ncid is root group. Get total number of groups and their ids */
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, NULL) );
grpids = emalloc((size_t)(num_grps + 1) * sizeof(int));
grpids = emalloc((num_grps + 1) * sizeof(int));
NC_CHECK( nc_inq_grps_full(ncid, &num_grps, grpids) );
#define DONT_INCLUDE_PARENTS 0
/* Get all dimensions in groups and info about which ones are unlimited */

View File

@ -681,14 +681,14 @@ static int
copy_groups(int iroot, int oroot)
{
int stat = NC_NOERR;
int numgrps;
size_t numgrps;
int *grpids;
int i;
/* get total number of groups and their ids, including all descendants */
NC_CHECK(nc_inq_grps_full(iroot, &numgrps, NULL));
if(numgrps > 1) { /* there's always 1 root group */
grpids = emalloc((size_t)numgrps * sizeof(int));
grpids = emalloc(numgrps * sizeof(int));
NC_CHECK(nc_inq_grps_full(iroot, NULL, grpids));
/* create corresponding new groups in ogrp, except for root group */
for(i = 1; i < numgrps; i++) {

View File

@ -520,7 +520,7 @@ nc_inq_grpname_count(int ncid, int igrp, char **lgrps, idnode_t *grpids) {
/* Check if any group names specified with "-g grp1,...,grpn" are
* missing. Returns total number of matching groups if no missing
* groups detected, otherwise exits. */
int
size_t
grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids) {
int ig;
size_t total = 0;
@ -883,7 +883,7 @@ nc_free_giter(ncgiter_t *iterp)
* for the group ids, then call again to get them.
*/
int
nc_inq_grps_full(int rootid, int *numgrps, int *grpids)
nc_inq_grps_full(int rootid, size_t *numgrps, int *grpids)
{
int stat = NC_NOERR;
ncgiter_t *giter; /* pointer to group iterator */

View File

@ -128,7 +128,7 @@ extern bool_t idmember ( const idnode_t* idlist, int id );
extern bool_t group_wanted ( int grpid, int nlgrps, const idnode_t* grpids );
/* Check group list for missing groups */
extern int grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids);
extern size_t grp_matches(int ncid, int nlgrps, char** lgrps, idnode_t *grpids);
/* Returns 1 if string s1 ends with string s2, 0 otherwise. */
extern int strendswith(const char *s1, const char *s2);
@ -162,7 +162,7 @@ extern void freeidlist(idnode_t *idlist);
* loses information about subgroup relationships, just flattening all
* groups into a serial list.
*/
extern int nc_inq_grps_full(int ncid, int *numgrps, int *ncids);
extern int nc_inq_grps_full(int ncid, size_t *numgrps, int *ncids);
/*
* More complex iterator interface: get group iterator for start group