Skip to content

Commit

Permalink
Updated code, location of variable declarations in support of #304
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF committed Jan 9, 2017
1 parent a31a2c0 commit 7d75fd3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.4.2 - TBD

* [Bug] Addressed an issue where netCDF wouldn't build on Windows systems using MSVC 2012. See [GitHub #304](https://github.com/Unidata/netcdf-c/issues/304) for more information.
* [Bug] Fixed an issue related to potential type punning, see [GitHub #344](https://github.com/Unidata/netcdf-c/issues/344) for more information.
* [Enhancement] Incorporated an enhancement provided by Greg Sjaardema, which may improve read/write times for some complex files. Basically, linked lists were replaced in some locations where it was safe to use an array/table. See [Pull request #328](https://github.com/Unidata/netcdf-c/pull/328) for more information.

Expand Down
25 changes: 14 additions & 11 deletions libdispatch/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,20 @@ static int NC_check_file_type(const char *path, int flags, void *parameters,

/* Windows and fstat have some issues, this will work around that. */
#ifdef HAVE_FILE_LENGTH_I64
__int64 file_len = 0;
if((file_len = _filelengthi64(fileno(fp))) < 0) {
fclose(fp);
status = errno;
goto done;
}

if(file_len < MAGIC_NUMBER_LEN) {
fclose(fp);
status = NC_ENOTNC;
goto done;
{
__int64 file_len = 0;
if((file_len = _filelengthi64(fileno(fp))) < 0) {
fclose(fp);
status = errno;
goto done;
}


if(file_len < MAGIC_NUMBER_LEN) {
fclose(fp);
status = NC_ENOTNC;
goto done;
}
}
#else

Expand Down
18 changes: 9 additions & 9 deletions libsrc/dim.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ NC3_def_dim(int ncid, const char *name, size_t size, int *dimidp)
int dimid;
NC_dim *dimp;

status = NC_check_id(ncid, &nc);
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
ncp = NC3_DATA(nc);
Expand Down Expand Up @@ -362,7 +362,7 @@ NC3_def_dim(int ncid, const char *name, size_t size, int *dimidp)
dimid = NC_finddim(&ncp->dims, name, &dimp);
if(dimid != -1)
return NC_ENAMEINUSE;

dimp = new_NC_dim(name, size);
if(dimp == NULL)
return NC_ENOMEM;
Expand All @@ -387,7 +387,7 @@ NC3_inq_dimid(int ncid, const char *name, int *dimid_ptr)
NC3_INFO* ncp;
int dimid;

status = NC_check_id(ncid, &nc);
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
ncp = NC3_DATA(nc);
Expand All @@ -410,7 +410,7 @@ NC3_inq_dim(int ncid, int dimid, char *name, size_t *sizep)
NC3_INFO* ncp;
NC_dim *dimp;

status = NC_check_id(ncid, &nc);
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
ncp = NC3_DATA(nc);
Expand All @@ -421,7 +421,7 @@ NC3_inq_dim(int ncid, int dimid, char *name, size_t *sizep)

if(name != NULL)
{
(void)strncpy(name, dimp->name->cp,
(void)strncpy(name, dimp->name->cp,
dimp->name->nchars);
name[dimp->name->nchars] = 0;
}
Expand All @@ -430,7 +430,7 @@ NC3_inq_dim(int ncid, int dimid, char *name, size_t *sizep)
if(dimp->size == NC_UNLIMITED)
*sizep = NC_get_numrecs(ncp);
else
*sizep = dimp->size;
*sizep = dimp->size;
}
return NC_NOERR;
}
Expand All @@ -444,8 +444,10 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname)
int existid;
NC_dim *dimp;
char *newname; /* normalized */
NC_string *old = dimp->name;
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);

status = NC_check_id(ncid, &nc);
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
ncp = NC3_DATA(nc);
Expand All @@ -465,8 +467,6 @@ NC3_rename_dim( int ncid, int dimid, const char *unewname)
if(dimp == NULL)
return NC_EBADDIM;

NC_string *old = dimp->name;
newname = (char *)utf8proc_NFC((const unsigned char *)unewname);
if(newname == NULL)
return NC_ENOMEM;
if(NC_indef(ncp))
Expand Down

0 comments on commit 7d75fd3

Please sign in to comment.