Skip to content

Commit 850e2f4

Browse files
authored
Merge pull request #2844 from WardF/rebase-gh2812.wif
Rebase #2812
2 parents 359a015 + 16bcb1d commit 850e2f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+396
-298
lines changed

include/nclist.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define NCLIST_H 1
55

66
#include "ncexternl.h"
7+
#include <stddef.h>
78

89
/* Define the type of the elements in the list*/
910

libdap2/cache.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "dapincludes.h"
77
#include "dapdump.h"
8+
#include <stddef.h>
89

910
/*
1011
Grads servers always require a constraint,
@@ -24,7 +25,9 @@ static int iscacheableconstraint(DCEconstraint* con);
2425
int
2526
iscached(NCDAPCOMMON* nccomm, CDFnode* target, NCcachenode** cachenodep)
2627
{
27-
int i,j,found,index;
28+
int i, found;
29+
size_t j;
30+
size_t index;
2831
NCcache* cache;
2932
NCcachenode* cachenode;
3033

@@ -92,7 +95,7 @@ else
9295
NCerror
9396
prefetchdata(NCDAPCOMMON* nccomm)
9497
{
95-
int i;
98+
size_t i;
9699
NCFLAGS flags;
97100
NCerror ncstat = NC_NOERR;
98101
NClist* allvars = nccomm->cdf.ddsroot->tree->varnodes;
@@ -341,7 +344,7 @@ fprintf(stderr,"freecachenode: %s\n",
341344
void
342345
freenccache(NCDAPCOMMON* nccomm, NCcache* cache)
343346
{
344-
int i;
347+
size_t i;
345348
if(cache == NULL) return;
346349
freenccachenode(nccomm,cache->prefetch);
347350
for(i=0;i<nclistlength(cache->nodes);i++) {
@@ -367,7 +370,8 @@ createnccache(void)
367370
static int
368371
iscacheableprojection(DCEprojection* proj)
369372
{
370-
int i,cacheable;
373+
size_t i;
374+
int cacheable;
371375
if(proj->discrim != CES_VAR) return 0;
372376
cacheable = 1; /* assume so */
373377
for(i=0;i<nclistlength(proj->var->segments);i++) {
@@ -380,7 +384,7 @@ iscacheableprojection(DCEprojection* proj)
380384
static int
381385
iscacheableconstraint(DCEconstraint* con)
382386
{
383-
int i;
387+
size_t i;
384388
if(con == NULL) return 1;
385389
if(con->selections != NULL && nclistlength(con->selections) > 0)
386390
return 0; /* can't deal with selections */
@@ -400,7 +404,7 @@ A variable is prefetchable if
400404
NCerror
401405
markprefetch(NCDAPCOMMON* nccomm)
402406
{
403-
int i,j;
407+
size_t i,j;
404408
NClist* allvars = nccomm->cdf.fullddsroot->tree->varnodes;
405409
assert(allvars != NULL);
406410
/* mark those variables of sufficiently small size */

libdap2/cdf.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "dapincludes.h"
77
#include "daputil.h"
88
#include "dapdump.h"
9+
#include <stddef.h>
910

1011
#ifdef DAPDEBUG
1112
extern char* ocfqn(OCddsnode);
@@ -70,7 +71,7 @@ computecdfnodesets(NCDAPCOMMON* nccomm, CDFtree* tree)
7071
NCerror
7172
computevarnodes(NCDAPCOMMON* nccomm, NClist* allnodes, NClist* varnodes)
7273
{
73-
unsigned int i,len;
74+
size_t i, len;
7475
NClist* allvarnodes = nclistnew();
7576
for(i=0;i<nclistlength(allnodes);i++) {
7677
CDFnode* node = (CDFnode*)nclistget(allnodes,i);
@@ -433,7 +434,7 @@ we expected a grid.
433434
static int
434435
restructr(NCDAPCOMMON* ncc, CDFnode* dxdparent, CDFnode* patternparent, NClist* repairlist)
435436
{
436-
int index, i, j, match;
437+
size_t index, i, j, match;
437438

438439
#ifdef DEBUG
439440
fprintf(stderr,"restruct: matched: %s -> %s\n",
@@ -501,7 +502,7 @@ static NCerror
501502
repairgrids(NCDAPCOMMON* ncc, NClist* repairlist)
502503
{
503504
NCerror ncstat = NC_NOERR;
504-
int i;
505+
size_t i;
505506
assert(nclistlength(repairlist) % 2 == 0);
506507
for(i=0;i<nclistlength(repairlist);i+=2) {
507508
CDFnode* node = (CDFnode*)nclistget(repairlist,i);
@@ -541,7 +542,7 @@ structwrap(NCDAPCOMMON* ncc, CDFnode* node, CDFnode* parent, int parentindex,
541542
static int
542543
findin(CDFnode* parent, CDFnode* child)
543544
{
544-
int i;
545+
size_t i;
545546
NClist* subnodes = parent->subnodes;
546547
for(i=0;i<nclistlength(subnodes);i++) {
547548
if(nclistget(subnodes,i) == child)
@@ -674,13 +675,13 @@ dimimprint(NCDAPCOMMON* nccomm)
674675
{
675676
NCerror ncstat = NC_NOERR;
676677
NClist* allnodes;
677-
int i,j;
678+
size_t i,j;
678679
CDFnode* basenode;
679680

680681
allnodes = nccomm->cdf.ddsroot->tree->nodes;
681682
for(i=0;i<nclistlength(allnodes);i++) {
682683
CDFnode* node = (CDFnode*)nclistget(allnodes,i);
683-
int noderank, baserank;
684+
size_t noderank, baserank;
684685
/* Do dimension imprinting */
685686
basenode = node->basenode;
686687
if(basenode == NULL) continue;
@@ -689,7 +690,7 @@ dimimprint(NCDAPCOMMON* nccomm)
689690
if(noderank == 0) continue;
690691
ASSERT(noderank == baserank);
691692
#ifdef DEBUG
692-
fprintf(stderr,"dimimprint %s/%d -> %s/%d\n",
693+
fprintf(stderr,"dimimprint %s/%zu -> %s/%zu\n",
693694
makecdfpathstring(basenode,"."),
694695
noderank,
695696
makecdfpathstring(node,"."),
@@ -725,7 +726,7 @@ static NClist*
725726
clonedimset(NCDAPCOMMON* nccomm, NClist* dimset, CDFnode* var)
726727
{
727728
NClist* result = NULL;
728-
int i;
729+
size_t i;
729730

730731
for(i=0;i<nclistlength(dimset);i++) {
731732
CDFnode *dim = NULL;
@@ -768,7 +769,7 @@ definedimsetplus(NCDAPCOMMON* nccomm/*notused*/, CDFnode* node)
768769
static NCerror
769770
definedimsetall(NCDAPCOMMON* nccomm/*notused*/, CDFnode* node)
770771
{
771-
int i;
772+
size_t i;
772773
int ncstat = NC_NOERR;
773774
NClist* dimsetall = NULL;
774775

@@ -795,7 +796,7 @@ fprintf(stderr,"dimsetall: |%s|=%d\n",node->ocname,(int)nclistlength(dimsetall))
795796
static NCerror
796797
definetransdimset(NCDAPCOMMON* nccomm/*notused*/, CDFnode* node)
797798
{
798-
int i;
799+
size_t i;
799800
int ncstat = NC_NOERR;
800801
NClist* dimsettrans = NULL;
801802

@@ -842,7 +843,7 @@ Recursive helper for definedimsettrans3
842843
static NCerror
843844
definedimsettransR(NCDAPCOMMON* nccomm, CDFnode* node)
844845
{
845-
int i;
846+
size_t i;
846847
int ncstat = NC_NOERR;
847848

848849
definetransdimset(nccomm,node);
@@ -882,7 +883,7 @@ Recursive helper
882883
static NCerror
883884
definedimsetsR(NCDAPCOMMON* nccomm, CDFnode* node)
884885
{
885-
int i;
886+
size_t i;
886887
int ncstat = NC_NOERR;
887888

888889
definedimsetplus(nccomm,node);
@@ -1057,7 +1058,7 @@ buildcdftreer(NCDAPCOMMON* nccomm, OCddsnode ocnode, CDFnode* container,
10571058
void
10581059
freecdfroot(CDFnode* root)
10591060
{
1060-
int i;
1061+
size_t i;
10611062
CDFtree* tree;
10621063
NCDAPCOMMON* nccomm;
10631064
if(root == NULL) return;
@@ -1187,7 +1188,7 @@ fix1node(NCDAPCOMMON* nccomm, CDFnode* node)
11871188
static NCerror
11881189
fixnodes(NCDAPCOMMON* nccomm, NClist* cdfnodes)
11891190
{
1190-
int i;
1191+
size_t i;
11911192
for(i=0;i<nclistlength(cdfnodes);i++) {
11921193
CDFnode* node = (CDFnode*)nclistget(cdfnodes,i);
11931194
NCerror err = fix1node(nccomm,node);

libdap2/constraints.c

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "dceparselex.h"
88
#include "dceconstraints.h"
99
#include "dapdump.h"
10+
#include <stddef.h>
1011

1112
static void completesegments(NClist* fullpath, NClist* segments);
1213
static NCerror qualifyprojectionnames(DCEprojection* proj);
@@ -295,7 +296,7 @@ matchnode->ncfullname,dumpsegments(segments));
295296
break;
296297
default: {
297298
CDFnode* minnode = NULL;
298-
int minpath = 0;
299+
size_t minpath = 0;
299300
int nmin = 0; /* to catch multiple ones with same short path */
300301
/* ok, see if one of the matches has a path that is shorter
301302
then all the others */
@@ -338,7 +339,8 @@ fprintf(stderr,"matchpartialname: choice: %s %s for %s\n",
338339
static int
339340
matchsuffix(NClist* matchpath, NClist* segments)
340341
{
341-
int i,pathstart;
342+
size_t i;
343+
int pathstart;
342344
int nsegs = nclistlength(segments);
343345
int pathlen = nclistlength(matchpath);
344346
int segmatch;
@@ -356,7 +358,7 @@ matchsuffix(NClist* matchpath, NClist* segments)
356358
matching as we go
357359
*/
358360
for(i=0;i<nsegs;i++) {
359-
CDFnode* node = (CDFnode*)nclistget(matchpath,pathstart+i);
361+
CDFnode* node = (CDFnode*)nclistget(matchpath, (size_t)pathstart+i);
360362
DCEsegment* seg = (DCEsegment*)nclistget(segments,i);
361363
int rank = seg->rank;
362364
segmatch = 1; /* until proven otherwise */
@@ -386,12 +388,12 @@ dapbuildvaraprojection(CDFnode* var,
386388
const size_t* startp, const size_t* countp, const ptrdiff_t* stridep,
387389
DCEprojection** projectionp)
388390
{
389-
int i,j;
391+
size_t i,j;
390392
NCerror ncstat = NC_NOERR;
391393
DCEprojection* projection = NULL;
392394
NClist* path = nclistnew();
393395
NClist* segments = NULL;
394-
int dimindex;
396+
size_t dimindex;
395397

396398
/* Build a skeleton projection that has 1 segment for
397399
every cdfnode from root to the variable of interest.
@@ -463,9 +465,10 @@ dapiswholeslice(DCEslice* slice, CDFnode* dim)
463465
int
464466
dapiswholesegment(DCEsegment* seg)
465467
{
466-
int i,whole;
468+
size_t i;
469+
int whole;
467470
NClist* dimset = NULL;
468-
unsigned int rank;
471+
size_t rank;
469472

470473
if(seg->rank == 0) return 1;
471474
if(!seg->slicesdefined) return 0;
@@ -483,7 +486,8 @@ dapiswholesegment(DCEsegment* seg)
483486
int
484487
dapiswholeprojection(DCEprojection* proj)
485488
{
486-
int i,whole;
489+
size_t i;
490+
int whole;
487491

488492
ASSERT((proj->discrim == CES_VAR));
489493

@@ -498,7 +502,7 @@ dapiswholeprojection(DCEprojection* proj)
498502
int
499503
dapiswholeconstraint(DCEconstraint* con)
500504
{
501-
int i;
505+
size_t i;
502506
if(con == NULL) return 1;
503507
if(con->projections != NULL) {
504508
for(i=0;i<nclistlength(con->projections);i++) {
@@ -528,7 +532,7 @@ The term "expanded" means
528532
NCerror
529533
dapfixprojections(NClist* list)
530534
{
531-
int i,j,k;
535+
size_t i,j,k;
532536
NCerror ncstat = NC_NOERR;
533537
NClist* tmp = nclistnew(); /* misc. uses */
534538

@@ -619,12 +623,12 @@ next: continue;
619623
} /*for(;;)*/
620624

621625
/* remove all NULL elements */
622-
for(i=nclistlength(list)-1;i>=0;i--) {
623-
DCEprojection* target = (DCEprojection*)nclistget(list,i);
626+
int n;
627+
for(n=nclistlength(list)-1;n>=0;n--) {
628+
DCEprojection* target = (DCEprojection*)nclistget(list,n);
624629
if(target == NULL)
625-
nclistremove(list,i);
630+
nclistremove(list,n);
626631
}
627-
628632
done:
629633
#ifdef DEBUG
630634
fprintf(stderr,"fixprojection: exploded = %s\n",dumpprojections(list));
@@ -661,7 +665,7 @@ projectify(CDFnode* field, DCEprojection* container)
661665
static int
662666
slicematch(NClist* seglist1, NClist* seglist2)
663667
{
664-
int i,j;
668+
size_t i,j;
665669
if((seglist1 == NULL || seglist2 == NULL) && seglist1 != seglist2)
666670
return 0;
667671
if(nclistlength(seglist1) != nclistlength(seglist2))
@@ -691,7 +695,7 @@ slicematch(NClist* seglist1, NClist* seglist2)
691695
int
692696
dapvar2projection(CDFnode* var, DCEprojection** projectionp)
693697
{
694-
int i,j;
698+
size_t i,j;
695699
int ncstat = NC_NOERR;
696700
NClist* path = nclistnew();
697701
NClist* segments;
@@ -707,7 +711,7 @@ dapvar2projection(CDFnode* var, DCEprojection** projectionp)
707711
for(i=0;i<nclistlength(path);i++) {
708712
DCEsegment* segment = (DCEsegment*)dcecreate(CES_SEGMENT);
709713
CDFnode* n = (CDFnode*)nclistget(path,i);
710-
int localrank;
714+
size_t localrank;
711715
NClist* dimset;
712716

713717
segment->annotation = (void*)n;
@@ -757,7 +761,7 @@ int
757761
daprestrictprojection(NClist* projections, DCEprojection* var, DCEprojection** resultp)
758762
{
759763
int ncstat = NC_NOERR;
760-
int i;
764+
size_t i;
761765
DCEprojection* result = NULL;
762766
#ifdef DEBUG1
763767
fprintf(stderr,"restrictprojection.before: constraints=|%s| vara=|%s|\n",
@@ -817,7 +821,7 @@ int
817821
dapshiftprojection(DCEprojection* projection)
818822
{
819823
int ncstat = NC_NOERR;
820-
int i,j;
824+
size_t i,j;
821825
NClist* segments;
822826

823827
#ifdef DEBUG1
@@ -849,7 +853,7 @@ dapcomputeprojectedvars(NCDAPCOMMON* dapcomm, DCEconstraint* constraint)
849853
{
850854
NCerror ncstat = NC_NOERR;
851855
NClist* vars = NULL;
852-
int i;
856+
size_t i;
853857

854858
vars = nclistnew();
855859

libdap2/dapattr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*********************************************************************/
55

66
#include "dapincludes.h"
7+
#include <stddef.h>
78

89
#define OCCHECK(exp) if((ocstat = (exp))) {THROWCHK(ocstat); goto done;}
910

@@ -18,7 +19,7 @@ and stuff from DODS_EXTRA.
1819
int
1920
dapmerge(NCDAPCOMMON* nccomm, CDFnode* ddsroot, OCddsnode dasroot)
2021
{
21-
int i,j;
22+
size_t i,j;
2223
NCerror ncstat = NC_NOERR;
2324
OCerror ocstat = OC_NOERR;
2425
NClist* allnodes;

0 commit comments

Comments
 (0)