mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
commit
3bf18fbdb8
@ -83,11 +83,7 @@ NC_combinehostport(NCURI* uri)
|
||||
if(port != NULL) len += (1+strlen(port));
|
||||
hp = (char*)malloc(len+1);
|
||||
if(hp == NULL) return NULL;
|
||||
strncpy(hp,host,len);
|
||||
if(port != NULL) {
|
||||
strlcat(hp,":",len+1);
|
||||
strlcat(hp,port,len+1);
|
||||
}
|
||||
snprintf(hp, len+1, "%s%s%s", host, port ? ":" : "", port ? port : "");
|
||||
return hp;
|
||||
}
|
||||
|
||||
|
@ -539,9 +539,7 @@ rcsearch(const char* prefix, const char* rcname, char** pathp)
|
||||
size_t pathlen = plen+rclen+1+1; /*+1 for '/' +1 for nul */
|
||||
path = (char*)malloc(pathlen); /* +1 for nul*/
|
||||
if(path == NULL) {ret = NC_ENOMEM; goto done;}
|
||||
strncpy(path,prefix,pathlen);
|
||||
strlcat(path,"/",pathlen);
|
||||
strlcat(path,rcname,pathlen);
|
||||
snprintf(path, pathlen, "%s/%s", prefix, rcname);
|
||||
/* see if file is readable */
|
||||
f = NCfopen(path,"r");
|
||||
if(f != NULL)
|
||||
|
@ -169,7 +169,9 @@ ncuriparse(const char* uri0, NCURI** durip)
|
||||
uri = (char*)malloc(len0+1+1); /* +2 for nul term and for host section terminator */
|
||||
if(uri == NULL)
|
||||
{THROW(NC_ENOMEM);}
|
||||
strncpy(uri,uri0,len0+1);
|
||||
/* Safe because we allocated enough space right above (and */
|
||||
/* `strdup` isn't usable because we need "one more char"). */
|
||||
strcpy(uri,uri0);
|
||||
|
||||
/* Walk the uri and do the following:
|
||||
1. remove leading and trailing whitespace
|
||||
|
@ -304,7 +304,7 @@ inline static void
|
||||
swapn2b(void *dst, const void *src, IntType nn)
|
||||
{
|
||||
/* it is OK if dst == src */
|
||||
int i;
|
||||
IntType i;
|
||||
uint16_t *op = (uint16_t*) dst;
|
||||
uint16_t *ip = (uint16_t*) src;
|
||||
for (i=0; i<nn; i++) {
|
||||
@ -393,7 +393,7 @@ swap4b(void *dst, const void *src)
|
||||
inline static void
|
||||
swapn4b(void *dst, const void *src, IntType nn)
|
||||
{
|
||||
int i;
|
||||
IntType i;
|
||||
uint32_t *op = (uint32_t*) dst;
|
||||
uint32_t *ip = (uint32_t*) src;
|
||||
for (i=0; i<nn; i++) {
|
||||
@ -506,7 +506,7 @@ inline static void
|
||||
swapn8b(void *dst, const void *src, IntType nn)
|
||||
{
|
||||
#ifdef FLOAT_WORDS_BIGENDIAN
|
||||
int i;
|
||||
IntType i;
|
||||
uint64_t *dst_p = (uint64_t*) dst;
|
||||
uint64_t *src_p = (uint64_t*) src;
|
||||
for (i=0; i<nn; i++) {
|
||||
@ -518,7 +518,7 @@ swapn8b(void *dst, const void *src, IntType nn)
|
||||
*op = SWAP4(*op);
|
||||
}
|
||||
#else
|
||||
int i;
|
||||
IntType i;
|
||||
uint64_t *op = (uint64_t*) dst;
|
||||
uint64_t *ip = (uint64_t*) src;
|
||||
for (i=0; i<nn; i++) {
|
||||
|
@ -1454,7 +1454,7 @@ nc_get_NC(NC3_INFO* ncp)
|
||||
if(extent > 4096)
|
||||
extent = 4096;
|
||||
if(extent > filesize)
|
||||
extent = filesize;
|
||||
extent = (size_t)filesize;
|
||||
}
|
||||
else if(extent > ncp->chunk)
|
||||
extent = ncp->chunk;
|
||||
|
@ -512,7 +512,7 @@ out :
|
||||
*/
|
||||
int
|
||||
NC_check_vlen(NC_var *varp, long long vlen_max) {
|
||||
int ii;
|
||||
size_t ii;
|
||||
long long prod=varp->xsz; /* product of xsz and dimensions so far */
|
||||
|
||||
assert(varp != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user