mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
Merge pull request #2017 from DennisHeimbigner/zarrfillv.dmh
NCZarr is outputting fill value as an array instead of a singleton.
This commit is contained in:
commit
1ee604a3a7
@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
|
|||||||
|
|
||||||
## 4.8.1 - TBD
|
## 4.8.1 - TBD
|
||||||
|
|
||||||
|
* [Bug Fix] Store NCZarr fillvalue as a singleton instead of a 1-element array. See [Github #2017](https://github.com/Unidata/netcdf-c/issues/2017).
|
||||||
* [Bug Fixes] The netcdf-c library was incorrectly determining the scope of dimension; similar to the type scope problem. See [Github #2012](https://github.com/Unidata/netcdf-c/pull/2012) for more information.
|
* [Bug Fixes] The netcdf-c library was incorrectly determining the scope of dimension; similar to the type scope problem. See [Github #2012](https://github.com/Unidata/netcdf-c/pull/2012) for more information.
|
||||||
* [Bug Fix] Re-enable DAP2 authorization testing. See [Github #2011](https://github.com/Unidata/netcdf-c/issues/2011).
|
* [Bug Fix] Re-enable DAP2 authorization testing. See [Github #2011](https://github.com/Unidata/netcdf-c/issues/2011).
|
||||||
* [Bug Fix] Fix bug with windows version of mkstemp that causes failure to create more than 26 temp files. See [Github #1998](https://github.com/Unidata/netcdf-c/pull/1998).
|
* [Bug Fix] Fix bug with windows version of mkstemp that causes failure to create more than 26 temp files. See [Github #1998](https://github.com/Unidata/netcdf-c/pull/1998).
|
||||||
|
@ -324,8 +324,12 @@ NCZ_stringconvert(nc_type typeid, size_t len, void* data0, NCjson** jdatap)
|
|||||||
/* Create a string valued json object */
|
/* Create a string valued json object */
|
||||||
if((stat = NCJnewstringn(NCJ_STRING,len,src,&jdata)))
|
if((stat = NCJnewstringn(NCJ_STRING,len,src,&jdata)))
|
||||||
goto done;
|
goto done;
|
||||||
} else { /* for all other values, create an array of values */
|
} else { /* all other cases */
|
||||||
if((stat = NCJnew(NCJ_ARRAY,&jdata))) goto done;
|
if(len == 0) {stat = NC_EINVAL; goto done;}
|
||||||
|
if(len > 1) {
|
||||||
|
if((stat = NCJnew(NCJ_ARRAY,&jdata))) goto done;
|
||||||
|
} else /* return a singletone */
|
||||||
|
jdata = NULL;
|
||||||
for(i=0;i<len;i++) {
|
for(i=0;i<len;i++) {
|
||||||
char* special = NULL;
|
char* special = NULL;
|
||||||
double d;
|
double d;
|
||||||
@ -371,7 +375,10 @@ NCZ_stringconvert(nc_type typeid, size_t len, void* data0, NCjson** jdatap)
|
|||||||
if(special) {nullfree(str); str = strdup(special);}
|
if(special) {nullfree(str); str = strdup(special);}
|
||||||
jvalue->value = str;
|
jvalue->value = str;
|
||||||
str = NULL;
|
str = NULL;
|
||||||
nclistpush(jdata->contents,jvalue);
|
if(len == 1)
|
||||||
|
jdata = jvalue;
|
||||||
|
else
|
||||||
|
nclistpush(jdata->contents,jvalue);
|
||||||
jvalue = NULL;
|
jvalue = NULL;
|
||||||
src += typelen;
|
src += typelen;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ static int ncz_jsonize_atts(NCindex* attlist, NCjson** jattrsp);
|
|||||||
static int load_jatts(NCZMAP* map, NC_OBJ* container, NCjson** jattrsp, NClist** atypes);
|
static int load_jatts(NCZMAP* map, NC_OBJ* container, NCjson** jattrsp, NClist** atypes);
|
||||||
static int zconvert(nc_type typeid, size_t typelen, void* dst, NCjson* src);
|
static int zconvert(nc_type typeid, size_t typelen, void* dst, NCjson* src);
|
||||||
static int computeattrinfo(const char* name, NClist* atypes, NCjson* values,
|
static int computeattrinfo(const char* name, NClist* atypes, NCjson* values,
|
||||||
nc_type* typeidp, size_t* lenp, void** datap);
|
nc_type* typeidp, size_t* typelenp, size_t* lenp, void** datap);
|
||||||
static int parse_group_content(NCjson* jcontent, NClist* dimdefs, NClist* varnames, NClist* subgrps);
|
static int parse_group_content(NCjson* jcontent, NClist* dimdefs, NClist* varnames, NClist* subgrps);
|
||||||
static int parse_group_content_pure(NCZ_FILE_INFO_T* zinfo, NC_GRP_INFO_T* grp, NClist* varnames, NClist* subgrps);
|
static int parse_group_content_pure(NCZ_FILE_INFO_T* zinfo, NC_GRP_INFO_T* grp, NClist* varnames, NClist* subgrps);
|
||||||
static int define_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp);
|
static int define_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp);
|
||||||
@ -28,7 +28,7 @@ static int locategroup(NC_FILE_INFO_T* file, size_t nsegs, NClist* segments, NC_
|
|||||||
static int createdim(NC_FILE_INFO_T* file, const char* name, size64_t dimlen, NC_DIM_INFO_T** dimp);
|
static int createdim(NC_FILE_INFO_T* file, const char* name, size64_t dimlen, NC_DIM_INFO_T** dimp);
|
||||||
static int parsedimrefs(NC_FILE_INFO_T*, NClist* dimnames, size64_t* shape, NC_DIM_INFO_T** dims, int create);
|
static int parsedimrefs(NC_FILE_INFO_T*, NClist* dimnames, size64_t* shape, NC_DIM_INFO_T** dims, int create);
|
||||||
static int decodeints(NCjson* jshape, size64_t* shapes);
|
static int decodeints(NCjson* jshape, size64_t* shapes);
|
||||||
static int computeattrdata(nc_type* typeidp, NCjson* values, size_t* lenp, void** datap);
|
static int computeattrdata(nc_type* typeidp, NCjson* values, size_t* typelenp, size_t* lenp, void** datap);
|
||||||
static int inferattrtype(NCjson* values, nc_type* typeidp);
|
static int inferattrtype(NCjson* values, nc_type* typeidp);
|
||||||
static int mininttype(unsigned long long u64, int negative);
|
static int mininttype(unsigned long long u64, int negative);
|
||||||
static int computedimrefs(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int purezarr, int xarray, int ndims, NClist* dimnames, size64_t* shapes, NC_DIM_INFO_T** dims);
|
static int computedimrefs(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int purezarr, int xarray, int ndims, NClist* dimnames, size64_t* shapes, NC_DIM_INFO_T** dims);
|
||||||
@ -244,6 +244,7 @@ ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var)
|
|||||||
NCjson* jncvar = NULL;
|
NCjson* jncvar = NULL;
|
||||||
NCjson* jdimrefs = NULL;
|
NCjson* jdimrefs = NULL;
|
||||||
NCjson* jtmp = NULL;
|
NCjson* jtmp = NULL;
|
||||||
|
NCjson* jfill = NULL;
|
||||||
size64_t shape[NC_MAX_VAR_DIMS];
|
size64_t shape[NC_MAX_VAR_DIMS];
|
||||||
NCZ_VAR_INFO_T* zvar = var->format_var_info;
|
NCZ_VAR_INFO_T* zvar = var->format_var_info;
|
||||||
|
|
||||||
@ -325,7 +326,6 @@ ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var)
|
|||||||
if(!var->no_fill) {
|
if(!var->no_fill) {
|
||||||
int fillsort;
|
int fillsort;
|
||||||
int atomictype = var->type_info->hdr.id;
|
int atomictype = var->type_info->hdr.id;
|
||||||
NCjson* jfill = NULL;
|
|
||||||
/* A scalar value providing the default value to use for uninitialized
|
/* A scalar value providing the default value to use for uninitialized
|
||||||
portions of the array, or ``null`` if no fill_value is to be used. */
|
portions of the array, or ``null`` if no fill_value is to be used. */
|
||||||
/* Use the defaults defined in netdf.h */
|
/* Use the defaults defined in netdf.h */
|
||||||
@ -339,9 +339,17 @@ ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var)
|
|||||||
if((stat = nc4_get_default_fill_value(atomictype,var->fill_value))) goto done;
|
if((stat = nc4_get_default_fill_value(atomictype,var->fill_value))) goto done;
|
||||||
}
|
}
|
||||||
/* Convert var->fill_value to a string */
|
/* Convert var->fill_value to a string */
|
||||||
if((stat = NCZ_stringconvert(atomictype,1,var->fill_value,&jfill)))
|
if((stat = NCZ_stringconvert(atomictype,1,var->fill_value,&jfill))) goto done;
|
||||||
goto done;
|
if(jfill->sort == NCJ_ARRAY) { /* stringconvert should prevent this from happening */
|
||||||
if((stat = NCJinsert(jvar,"fill_value",jfill))) goto done;
|
assert(NCJlength(jfill) > 0);
|
||||||
|
if((stat = NCJarrayith(jfill,0,&jtmp))) goto done; /* use the 0th element */
|
||||||
|
if((stat = NCJclone(jtmp,&jtmp))) goto done; /* clone so we can free it later */
|
||||||
|
NCJreclaim(jfill);
|
||||||
|
jfill = jtmp;
|
||||||
|
jtmp = NULL;
|
||||||
|
}
|
||||||
|
if((stat = NCJinsert(jvar,"fill_value",jfill))) goto done;
|
||||||
|
jfill = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* order key */
|
/* order key */
|
||||||
@ -463,6 +471,7 @@ done:
|
|||||||
NCJreclaim(jvar);
|
NCJreclaim(jvar);
|
||||||
NCJreclaim(jncvar);
|
NCJreclaim(jncvar);
|
||||||
NCJreclaim(jtmp);
|
NCJreclaim(jtmp);
|
||||||
|
NCJreclaim(jfill);
|
||||||
return THROW(stat);
|
return THROW(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,6 +692,8 @@ done:
|
|||||||
/**
|
/**
|
||||||
@internal Convert a list of attributes to corresponding json.
|
@internal Convert a list of attributes to corresponding json.
|
||||||
Note that this does not push to the file.
|
Note that this does not push to the file.
|
||||||
|
Also note that attributes of length 1 are stored as singletons, not arrays.
|
||||||
|
This is to be more consistent with pure zarr.
|
||||||
@param attlist - [in] the attributes to dictify
|
@param attlist - [in] the attributes to dictify
|
||||||
@param jattrsp - [out] the json'ized att list
|
@param jattrsp - [out] the json'ized att list
|
||||||
@return NC_NOERR
|
@return NC_NOERR
|
||||||
@ -858,11 +869,11 @@ Extract type and data for an attribute
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
computeattrinfo(const char* name, NClist* atypes, NCjson* values,
|
computeattrinfo(const char* name, NClist* atypes, NCjson* values,
|
||||||
nc_type* typeidp, size_t* lenp, void** datap)
|
nc_type* typeidp, size_t* typelenp, size_t* lenp, void** datap)
|
||||||
{
|
{
|
||||||
int stat = NC_NOERR;
|
int stat = NC_NOERR;
|
||||||
int i;
|
int i;
|
||||||
size_t len;
|
size_t len, typelen;
|
||||||
void* data;
|
void* data;
|
||||||
nc_type typeid;
|
nc_type typeid;
|
||||||
|
|
||||||
@ -880,10 +891,11 @@ computeattrinfo(const char* name, NClist* atypes, NCjson* values,
|
|||||||
}
|
}
|
||||||
if(typeid >= NC_STRING)
|
if(typeid >= NC_STRING)
|
||||||
{stat = NC_EINTERNAL; goto done;}
|
{stat = NC_EINTERNAL; goto done;}
|
||||||
if((stat = computeattrdata(&typeid, values, &len, &data))) goto done;
|
if((stat = computeattrdata(&typeid, values, &typelen, &len, &data))) goto done;
|
||||||
|
|
||||||
if(typeidp) *typeidp = typeid;
|
if(typeidp) *typeidp = typeid;
|
||||||
if(lenp) *lenp = len;
|
if(lenp) *lenp = len;
|
||||||
|
if(typelenp) *typelenp = typelen;
|
||||||
if(datap) {*datap = data; data = NULL;}
|
if(datap) {*datap = data; data = NULL;}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -895,7 +907,7 @@ done:
|
|||||||
Extract data for an attribute
|
Extract data for an attribute
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
computeattrdata(nc_type* typeidp, NCjson* values, size_t* lenp, void** datap)
|
computeattrdata(nc_type* typeidp, NCjson* values, size_t* typelenp, size_t* lenp, void** datap)
|
||||||
{
|
{
|
||||||
int stat = NC_NOERR;
|
int stat = NC_NOERR;
|
||||||
size_t datalen;
|
size_t datalen;
|
||||||
@ -911,7 +923,7 @@ computeattrdata(nc_type* typeidp, NCjson* values, size_t* lenp, void** datap)
|
|||||||
|
|
||||||
/* Collect the length of the attribute; might be a singleton */
|
/* Collect the length of the attribute; might be a singleton */
|
||||||
switch (values->sort) {
|
switch (values->sort) {
|
||||||
case NCJ_DICT: stat = NC_EINTERNAL; goto done;
|
case NCJ_DICT: stat = NC_ENCZARR; goto done;
|
||||||
case NCJ_ARRAY:
|
case NCJ_ARRAY:
|
||||||
datalen = nclistlength(values->contents);
|
datalen = nclistlength(values->contents);
|
||||||
break;
|
break;
|
||||||
@ -923,21 +935,22 @@ computeattrdata(nc_type* typeidp, NCjson* values, size_t* lenp, void** datap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate data space */
|
if(datalen > 0) {
|
||||||
if((stat = NC4_inq_atomic_type(typeid, NULL, &typelen)))
|
/* Allocate data space */
|
||||||
goto done;
|
if((stat = NC4_inq_atomic_type(typeid, NULL, &typelen)))
|
||||||
if(typeid == NC_CHAR)
|
goto done;
|
||||||
data = malloc(typelen*(datalen+1));
|
if(typeid == NC_CHAR)
|
||||||
else
|
data = malloc(typelen*(datalen+1));
|
||||||
data = malloc(typelen*datalen);
|
else
|
||||||
if(data == NULL)
|
data = malloc(typelen*datalen);
|
||||||
{stat = NC_ENOMEM; goto done;}
|
if(data == NULL)
|
||||||
|
{stat = NC_ENOMEM; goto done;}
|
||||||
/* convert to target type */
|
/* convert to target type */
|
||||||
if((stat = zconvert(typeid, typelen, data, values)))
|
if((stat = zconvert(typeid, typelen, data, values)))
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
if(lenp) *lenp = datalen;
|
if(lenp) *lenp = datalen;
|
||||||
|
if(typelenp) *typelenp = typelen;
|
||||||
if(datap) {*datap = data; data = NULL;}
|
if(datap) {*datap = data; data = NULL;}
|
||||||
if(typeidp) *typeidp = typeid; /* return possibly inferred type */
|
if(typeidp) *typeidp = typeid; /* return possibly inferred type */
|
||||||
|
|
||||||
@ -982,7 +995,7 @@ inferattrtype(NCjson* value, nc_type* typeidp)
|
|||||||
typeid = NC_CHAR;
|
typeid = NC_CHAR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NC_EINTERNAL;
|
return NC_ENCZARR;
|
||||||
}
|
}
|
||||||
if(typeidp) *typeidp = typeid;
|
if(typeidp) *typeidp = typeid;
|
||||||
return NC_NOERR;
|
return NC_NOERR;
|
||||||
@ -1203,7 +1216,7 @@ ncz_read_atts(NC_FILE_INFO_T* file, NC_OBJ* container)
|
|||||||
/* Create the attribute */
|
/* Create the attribute */
|
||||||
/* Collect the attribute's type and value */
|
/* Collect the attribute's type and value */
|
||||||
if((stat = computeattrinfo(key->value,atypes,value,
|
if((stat = computeattrinfo(key->value,atypes,value,
|
||||||
&typeid,&len,&data)))
|
&typeid,NULL,&len,&data)))
|
||||||
goto done;
|
goto done;
|
||||||
if((stat = ncz_makeattr(container,attlist,key->value,typeid,len,data,&att)))
|
if((stat = ncz_makeattr(container,attlist,key->value,typeid,len,data,&att)))
|
||||||
goto done;
|
goto done;
|
||||||
@ -1430,9 +1443,10 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames)
|
|||||||
if(jvalue == NULL)
|
if(jvalue == NULL)
|
||||||
var->no_fill = 1;
|
var->no_fill = 1;
|
||||||
else {
|
else {
|
||||||
|
size_t fvlen;
|
||||||
typeid = var->type_info->hdr.id;
|
typeid = var->type_info->hdr.id;
|
||||||
var->no_fill = 0;
|
var->no_fill = 0;
|
||||||
if((stat = computeattrdata(&typeid, jvalue, NULL, &var->fill_value)))
|
if((stat = computeattrdata(&typeid, jvalue, NULL, &fvlen, &var->fill_value)))
|
||||||
goto done;
|
goto done;
|
||||||
assert(typeid == var->type_info->hdr.id);
|
assert(typeid == var->type_info->hdr.id);
|
||||||
/* Note that we do not create the _FillValue
|
/* Note that we do not create the _FillValue
|
||||||
|
@ -27,10 +27,11 @@
|
|||||||
/*
|
/*
|
||||||
Synopsis
|
Synopsis
|
||||||
|
|
||||||
pathcvt [-u|-w|-m|-c] [-e] PATH
|
pathcvt [-u|-w|-m|-c] [-e] [-d <driveletter>] PATH
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-e add backslash escapes to '\' and ' '
|
-e add backslash escapes to '\' and ' '
|
||||||
|
-d <driveletter> use driveletter when needed; defaults to 'c'
|
||||||
Output type options:
|
Output type options:
|
||||||
-u convert to Unix form of path
|
-u convert to Unix form of path
|
||||||
-w convert to Windows form of path
|
-w convert to Windows form of path
|
||||||
@ -45,7 +46,8 @@ Default is to convert to the format used by the platform.
|
|||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
int target;
|
int target;
|
||||||
int escape;
|
int escapes;
|
||||||
|
int drive;
|
||||||
int debug;
|
int debug;
|
||||||
} cvtoptions;
|
} cvtoptions;
|
||||||
|
|
||||||
@ -60,11 +62,13 @@ main(int argc, char** argv)
|
|||||||
char* inpath;
|
char* inpath;
|
||||||
|
|
||||||
memset((void*)&cvtoptions,0,sizeof(cvtoptions));
|
memset((void*)&cvtoptions,0,sizeof(cvtoptions));
|
||||||
|
cvtoptions.drive = 'c';
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "cD:ehmuw")) != EOF) {
|
while ((c = getopt(argc, argv, "cD:d:ehmuw")) != EOF) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'c': cvtoptions.target = NCPD_CYGWIN; break;
|
case 'c': cvtoptions.target = NCPD_CYGWIN; break;
|
||||||
case 'e': cvtoptions.escape = 1; break;
|
case 'd': cvtoptions.drive = optarg[0]; break;
|
||||||
|
case 'e': cvtoptions.escapes = 1; break;
|
||||||
case 'h': usage(NULL); break;
|
case 'h': usage(NULL); break;
|
||||||
case 'm': cvtoptions.target = NCPD_MSYS; break;
|
case 'm': cvtoptions.target = NCPD_MSYS; break;
|
||||||
case 'u': cvtoptions.target = NCPD_NIX; break;
|
case 'u': cvtoptions.target = NCPD_NIX; break;
|
||||||
@ -90,8 +94,8 @@ main(int argc, char** argv)
|
|||||||
if(cvtoptions.target == NCPD_UNKNOWN)
|
if(cvtoptions.target == NCPD_UNKNOWN)
|
||||||
cvtpath = NCpathcvt(inpath);
|
cvtpath = NCpathcvt(inpath);
|
||||||
else
|
else
|
||||||
cvtpath = NCpathcvt_test(inpath,cvtoptions.target,'c');
|
cvtpath = NCpathcvt_test(inpath,cvtoptions.target,(char)cvtoptions.drive);
|
||||||
if(cvtpath && cvtoptions.escape) {
|
if(cvtpath && cvtoptions.escapes) {
|
||||||
char* path = cvtpath; cvtpath = NULL;
|
char* path = cvtpath; cvtpath = NULL;
|
||||||
cvtpath = escape(path);
|
cvtpath = escape(path);
|
||||||
free(path);
|
free(path);
|
||||||
@ -116,20 +120,16 @@ escape(const char* path)
|
|||||||
const char* p;
|
const char* p;
|
||||||
char* q;
|
char* q;
|
||||||
char* epath = NULL;
|
char* epath = NULL;
|
||||||
|
const char* escapes = " \\";
|
||||||
|
|
||||||
epath = (char*)malloc((2*slen) + 1);
|
epath = (char*)malloc((2*slen) + 1);
|
||||||
if(epath == NULL) usage("out of memtory");
|
if(epath == NULL) usage("out of memtory");
|
||||||
p = path;
|
p = path;
|
||||||
q = epath;
|
q = epath;
|
||||||
for(;*p;p++) {
|
for(;*p;p++) {
|
||||||
switch (*p) {
|
if(strchr(escapes,*p) != NULL)
|
||||||
case '\\': case ' ':
|
|
||||||
*q++ = '\\';
|
*q++ = '\\';
|
||||||
/* fall thru */
|
*q++ = *p;
|
||||||
default:
|
|
||||||
*q++ = *p;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
return epath;
|
return epath;
|
||||||
|
@ -1,45 +1,36 @@
|
|||||||
path: /xxx/a/b
|
path: -u: |/xxx/x/y| => |/xxx/x/y|
|
||||||
/xxx/a/b
|
path: -c: |/xxx/x/y| => |/cygdrive/c/xxx/x/y|
|
||||||
/cygdrive/c/xxx/a/b
|
path: -m: |/xxx/x/y| => |/c/xxx/x/y|
|
||||||
/c/xxx/a/b
|
path: -w: |/xxx/x/y| => |c:\\xxx\\x\\y|
|
||||||
c:\\xxx\\a\\b
|
path: -u: |d:/x/y| => |/d/x/y|
|
||||||
path: d:/x/y
|
path: -c: |d:/x/y| => |/cygdrive/d/x/y|
|
||||||
/d/x/y
|
path: -m: |d:/x/y| => |/d/x/y|
|
||||||
/cygdrive/d/x/y
|
path: -w: |d:/x/y| => |d:\\x\\y|
|
||||||
/d/x/y
|
path: -u: |/cygdrive/d/x/y| => |/d/x/y|
|
||||||
d:\\x\\y
|
path: -c: |/cygdrive/d/x/y| => |/cygdrive/d/x/y|
|
||||||
path: /cygdrive/d/x/y
|
path: -m: |/cygdrive/d/x/y| => |/d/x/y|
|
||||||
/d/x/y
|
path: -w: |/cygdrive/d/x/y| => |d:\\x\\y|
|
||||||
/cygdrive/d/x/y
|
path: -u: |/d/x/y| => |/d/x/y|
|
||||||
/d/x/y
|
path: -c: |/d/x/y| => |/cygdrive/d/x/y|
|
||||||
d:\\x\\y
|
path: -m: |/d/x/y| => |/d/x/y|
|
||||||
path: /d/x/y
|
path: -w: |/d/x/y| => |d:\\x\\y|
|
||||||
/d/x/y
|
path: -u: |/cygdrive/d| => |/d|
|
||||||
/cygdrive/d/x/y
|
path: -c: |/cygdrive/d| => |/cygdrive/d|
|
||||||
/d/x/y
|
path: -m: |/cygdrive/d| => |/d|
|
||||||
d:\\x\\y
|
path: -w: |/cygdrive/d| => |d:|
|
||||||
path: /cygdrive/d
|
path: -u: |/d| => |/d|
|
||||||
/d
|
path: -c: |/d| => |/cygdrive/d|
|
||||||
/cygdrive/d
|
path: -m: |/d| => |/d|
|
||||||
/d
|
path: -w: |/d| => |d:|
|
||||||
d:
|
path: -u: |/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn| => |/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn|
|
||||||
path: /d
|
path: -c: |/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn| => |/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn|
|
||||||
/d
|
path: -m: |/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn| => |/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn|
|
||||||
/cygdrive/d
|
path: -w: |/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn| => |d:\\git\\netcdf-c\\dap4_test\\test_anon_dim.2.syn|
|
||||||
/d
|
path: -u: |d:\x\y| => |/d/x/y|
|
||||||
d:
|
path: -c: |d:\x\y| => |/cygdrive/d/x/y|
|
||||||
path: /cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn
|
path: -m: |d:\x\y| => |/d/x/y|
|
||||||
/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn
|
path: -w: |d:\x\y| => |d:\\x\\y|
|
||||||
/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn
|
path: -u: |d:\x\y w\z| => |/d/x/y\ w/z|
|
||||||
/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn
|
path: -c: |d:\x\y w\z| => |/cygdrive/d/x/y\ w/z|
|
||||||
d:\\git\\netcdf-c\\dap4_test\\test_anon_dim.2.syn
|
path: -m: |d:\x\y w\z| => |/d/x/y\ w/z|
|
||||||
path: d:\x\y
|
path: -w: |d:\x\y w\z| => |d:\\x\\y\ w\\z|
|
||||||
/d/x/y
|
|
||||||
/cygdrive/d/x/y
|
|
||||||
/d/x/y
|
|
||||||
d:\\x\\y
|
|
||||||
path: d:\x\y w\z
|
|
||||||
/d/x/y w/z
|
|
||||||
/cygdrive/d/x/y w/z
|
|
||||||
/d/x/y w/z
|
|
||||||
d:\\x\\y\\ w\\z
|
|
||||||
|
@ -41,7 +41,7 @@ LOCALRCFILES="$WD/.dodsrc $WD/.daprc $WD/.ncrc $WD/$NETRC $WD/$NETRCIMP"
|
|||||||
HOMERCFILES="$HOME/.dodsrc $HOME/.daprc $HOME/.ncrc $HOME/$NETRC $HOME/$NETRCIMP"
|
HOMERCFILES="$HOME/.dodsrc $HOME/.daprc $HOME/.ncrc $HOME/$NETRC $HOME/$NETRCIMP"
|
||||||
NETRCFILE=$WD/$NETRC
|
NETRCFILE=$WD/$NETRC
|
||||||
DAPRCFILE=$WD/$RC
|
DAPRCFILE=$WD/$RC
|
||||||
if test "x$FP_ISMSVC" = x1 ; then
|
if test "x$FP_ISMSVC" != x ; then
|
||||||
LOCALRCFILES=`${execdir}/pathcvt "$LOCALRCFILES"`
|
LOCALRCFILES=`${execdir}/pathcvt "$LOCALRCFILES"`
|
||||||
HOMERCFILES=`${execdir}/pathcvt "$HOMERCFILES"`
|
HOMERCFILES=`${execdir}/pathcvt "$HOMERCFILES"`
|
||||||
NETRCFILE=`${execdir}/pathcvt "$NETRCFILE"`
|
NETRCFILE=`${execdir}/pathcvt "$NETRCFILE"`
|
||||||
|
@ -8,31 +8,31 @@ set -e
|
|||||||
testcase1() {
|
testcase1() {
|
||||||
T="$1"
|
T="$1"
|
||||||
P="$2"
|
P="$2"
|
||||||
C=`${execdir}/pathcvt $T "$P"`
|
echo -n "path: $T: |$P| => |" >>tmp_pathcvt.txt
|
||||||
echo " $C"
|
${execdir}/pathcvt "$T" -e "$P" >>tmp_pathcvt.txt
|
||||||
|
echo "|" >> tmp_pathcvt.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
testcase() {
|
testcase() {
|
||||||
#X=`echo -n "$1" | sed -e 's/\\\/\\\\\\\/g'`
|
|
||||||
X="$1"
|
|
||||||
echo "path:" "$X"
|
|
||||||
testcase1 "-u" "$1"
|
testcase1 "-u" "$1"
|
||||||
testcase1 "-c" "$1"
|
testcase1 "-c" "$1"
|
||||||
testcase1 "-m" "$1"
|
testcase1 "-m" "$1"
|
||||||
testcase1 "-ew" "$1" | sed -e 's/\\/\\\\/g'
|
testcase1 "-w" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
rm -f tmp_pathcvt.txt
|
rm -f tmp_pathcvt.txt
|
||||||
|
|
||||||
testcase "/xxx/a/b" >> tmp_pathcvt.txt
|
set -x
|
||||||
testcase "d:/x/y" >> tmp_pathcvt.txt
|
|
||||||
testcase "/cygdrive/d/x/y" >> tmp_pathcvt.txt
|
testcase "/xxx/x/y"
|
||||||
testcase "/d/x/y" >> tmp_pathcvt.txt
|
testcase "d:/x/y"
|
||||||
testcase "/cygdrive/d" >> tmp_pathcvt.txt
|
testcase "/cygdrive/d/x/y"
|
||||||
testcase "/d" >> tmp_pathcvt.txt
|
testcase "/d/x/y"
|
||||||
testcase "/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn" >> tmp_pathcvt.txt
|
testcase "/cygdrive/d"
|
||||||
testcase "d:\\x\\y" >> tmp_pathcvt.txt
|
testcase "/d"
|
||||||
testcase "d:\\x\\y w\\z" >> tmp_pathcvt.txt
|
testcase "/cygdrive/d/git/netcdf-c/dap4_test/test_anon_dim.2.syn"
|
||||||
|
testcase "d:\\x\\y"
|
||||||
|
testcase "d:\\x\\y w\\z"
|
||||||
|
|
||||||
diff -w ${srcdir}/ref_pathcvt.txt ./tmp_pathcvt.txt
|
diff -w ${srcdir}/ref_pathcvt.txt ./tmp_pathcvt.txt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user