mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Added fixes for Visual Studio 10
This commit is contained in:
parent
9a1f1a92cd
commit
34161aab69
@ -3651,7 +3651,7 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
NC_DIM_INFO_T *dim;
|
||||
int retval = NC_NOERR;
|
||||
int i;
|
||||
|
||||
|
||||
assert(grp && grp->name);
|
||||
LOG((4, "%s: grp->name %s", __func__, grp->name));
|
||||
|
||||
@ -3664,11 +3664,12 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp)
|
||||
* try and find a dimension for them. */
|
||||
for (i=0; i < grp->vars.nelems; i++)
|
||||
{
|
||||
int ndims;
|
||||
int d;
|
||||
var = grp->vars.value[i];
|
||||
if (!var) continue;
|
||||
/* Check all vars and see if dim[i] != NULL if dimids[i] valid. */
|
||||
int ndims = var->ndims;
|
||||
int d;
|
||||
ndims = var->ndims;
|
||||
for (d = 0; d < ndims; d++)
|
||||
{
|
||||
if (var->dim[d] == NULL) {
|
||||
|
@ -600,6 +600,7 @@ computesize(Symbol* tsym)
|
||||
{
|
||||
int i;
|
||||
int offset = 0;
|
||||
int largealign;
|
||||
unsigned long totaldimsize;
|
||||
if(tsym->touched) return;
|
||||
tsym->touched=1;
|
||||
@ -627,29 +628,29 @@ computesize(Symbol* tsym)
|
||||
break;
|
||||
case NC_COMPOUND: /* keep if all fields are primitive*/
|
||||
/* First, compute recursively, the size and alignment of fields*/
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
ASSERT(field->subclass == NC_FIELD);
|
||||
ASSERT(field->subclass == NC_FIELD);
|
||||
computesize(field);
|
||||
/* alignment of struct is same as alignment of first field*/
|
||||
if(i==0) tsym->typ.alignment = field->typ.alignment;
|
||||
}
|
||||
/* now compute the size of the compound based on*/
|
||||
/* what user specified*/
|
||||
offset = 0;
|
||||
int largealign = 1;
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
/* only support 'c' alignment for now*/
|
||||
int alignment = field->typ.alignment;
|
||||
int padding = getpadding(offset,alignment);
|
||||
offset += padding;
|
||||
field->typ.offset = offset;
|
||||
offset += field->typ.size;
|
||||
if (alignment > largealign) {
|
||||
largealign = alignment;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* now compute the size of the compound based on*/
|
||||
/* what user specified*/
|
||||
offset = 0;
|
||||
largealign = 1;
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
/* only support 'c' alignment for now*/
|
||||
int alignment = field->typ.alignment;
|
||||
int padding = getpadding(offset,alignment);
|
||||
offset += padding;
|
||||
field->typ.offset = offset;
|
||||
offset += field->typ.size;
|
||||
if (alignment > largealign) {
|
||||
largealign = alignment;
|
||||
}
|
||||
}
|
||||
tsym->typ.cmpdalign = largealign; /* total structure size alignment */
|
||||
offset += (offset % largealign);
|
||||
tsym->typ.size = offset;
|
||||
|
Loading…
Reference in New Issue
Block a user