Пример #1
0
/* How much space in the header is required for the NC data structure? */
size_t
ncx_len_NC(const NC *ncp, size_t sizeof_off_t)
{
	size_t xlen = sizeof(ncmagic);

	assert(ncp != NULL);
	
	xlen += X_SIZEOF_SIZE_T; /* numrecs */
	xlen += ncx_len_NC_dimarray(&ncp->dims);
	xlen += ncx_len_NC_attrarray(&ncp->attrs);
	xlen += ncx_len_NC_vararray(&ncp->vars, sizeof_off_t);

	return xlen;
}
Пример #2
0
/* How much space in the header is required for the NC data structure? */
size_t
ncx_len_NC(const NC3_INFO* ncp, size_t sizeof_off_t)
{
	int version=1;
	size_t xlen = sizeof(ncmagic);

	assert(ncp != NULL);
	if (fIsSet(ncp->flags, NC_64BIT_DATA)) /* CDF-5 */
		version = 5;
    	else if (fIsSet(ncp->flags, NC_64BIT_OFFSET)) /* CDF-2 */
		version = 2;

	xlen += (version == 5) ? X_SIZEOF_INT64 : X_SIZEOF_SIZE_T; /* numrecs */
	xlen += ncx_len_NC_dimarray(&ncp->dims, version);
	xlen += ncx_len_NC_attrarray(&ncp->attrs, version);
	xlen += ncx_len_NC_vararray(&ncp->vars, sizeof_off_t, version);
	
	return xlen;
}