Skip to content

Commit 4a8e004

Browse files
authored
Merge pull request #3201 from DennisHeimbigner/ncdumpfixes.dmh
Fix Issue with Numcodecs encoding problems
2 parents 4e3e531 + 93f6246 commit 4a8e004

File tree

23 files changed

+128
-51
lines changed

23 files changed

+128
-51
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
77

88
## 4.10.0 - TBD
99

10+
* Fix Issue with Numcodecs encoding problems where integer filter parameters are being encoded as strings. See [Github 3201](https://github.com/Unidata/netcdf-c/issues/3201) for more information.
1011
* Clean up minor problems with DAP2/DAP4 code. See [Github #3215](https://github.com/Unidata/netcdf-c/pull/3215) for more information.
1112
* Cleanup RELEASE_NOTES.md. See [Github 3190](https://github.com/Unidata/netcdf-c/issues/3190) for more information.
1213
* Rebuild the S3-related code and other changes necessary to build cleanly on github actions. See [Github #3159](https://github.com/Unidata/netcdf-c/pull/3159) for more information.

dap4_test/Makefile.am

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ include $(top_srcdir)/lib_flags.am
88
LDADD = ${top_builddir}/liblib/libnetcdf.la
99

1010
# Un comment to use a more verbose test driver
11-
#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
12-
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
13-
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
14-
#TESTS_ENVIRONMENT = export SETX=1;
11+
SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
12+
LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
13+
TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
14+
TESTS_ENVIRONMENT = export SETX=1;
1515

1616
# Note which tests depend on other tests. Necessary for make -j check.
1717
TEST_EXTENSIONS = .sh

dap4_test/test_data.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
44
. ../test_common.sh
55

6+
set -x
67
set -e
78

89
. ${top_srcdir}/dap4_test/d4test_common.sh

include/ncconfigure.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ unsigned long long int strtoull(const char*, char**, int);
9898
#endif
9999
#endif
100100

101+
#ifndef HAVE_MEMMOVE
102+
#ifndef memmove
103+
void* memmove(void *dest, const void *src, size_t count);
104+
#endif
105+
#endif
106+
101107
#if defined(__cplusplus)
102108
}
103109
#endif

libdap4/d4bytes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ d4bytesconcat(D4bytes* dst, D4bytes* src)
6767
{
6868
if(dst == NULL && src != NULL && src->used > 0) {
6969
void* target = d4bytesalloc(dst,src->used);
70-
d4memmove(target,src->memory,src->used);
70+
memmove(target,src->memory,src->used);
7171
}
7272
return dst;
7373
}

libdap4/d4chunk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ NCD4_dechunk(NCD4response* resp)
118118
return processerrchunk(resp, (void*)pchunk, hdr.count);
119119
/* data chunk; possibly last; possibly empty */
120120
if(hdr.count > 0)
121-
d4memmove(pappend,pchunk,hdr.count); /* overwrite the header; this the heart of dechunking */
121+
memmove(pappend,pchunk,hdr.count); /* overwrite the header; this the heart of dechunking */
122122
pappend += hdr.count; /* next append point */
123123
phdr = pchunk + hdr.count; /* point to header of next chunk */
124124
if(hdr.flags & NCD4_LAST_CHUNK) break;

libdap4/d4meta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ savevarbyid(NCD4node* group, NCD4node* var)
607607
{
608608
if(group->group.varbyid == NULL)
609609
group->group.varbyid = nclistnew();
610-
nclistsetalloc(group->group.varbyid, (size_t)var->meta.id);
610+
nclistsetlength(group->group.varbyid, (size_t)var->meta.id+1);
611611
nclistinsert(group->group.varbyid, (size_t)var->meta.id,var);
612612
}
613613

libdap4/d4util.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
#ifndef D4UTIL_H
77
#define D4UTIL_H 1
88

9-
#ifdef HAVE_MEMMOVE
10-
#define d4memmove(dst,src,n) memmove(dst,src,n)
11-
#else
12-
#define d4memmove(dst,src,n) localmemmove(dst,src,n)
13-
#endif
14-
159
/* This is intended to be big enough to work as
1610
an offset/position/size for a file or a memory block.
1711
*/

libdispatch/dmissing.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,31 @@ NC_strcasestr(const char *s, const char *find)
160160
return ((char *)s);
161161
}
162162
#endif
163+
164+
#ifndef HAVE_MEMMOVE
165+
/**
166+
Define an implementation of memmove
167+
in the event that it is not available.
168+
@param dst target of the move
169+
@param src source of the move
170+
@param count number of bytes to move.
171+
Note: dst and src can overlap
172+
*/
173+
void*
174+
memmove(void *dst, const void *src, size_t count)
175+
{
176+
char *d = dst;
177+
const char *s = src;
178+
179+
if (d < s) {
180+
while (count--) {*d++ = *s++;}
181+
} else {
182+
d += count; /* Point to one past the end of destination */
183+
s += count; /* Point to one past the end of source */
184+
while (count--) {*(--d) = *(--s);} /* Decrement pointers and copy */
185+
}
186+
return dst;
187+
}
188+
189+
#endif /*HAVE_MEMMOVE*/
190+

libdispatch/ds3util.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,20 @@ NC_s3urlrebuild(NCURI* url, NCS3INFO* s3, NCURI** newurlp)
178178
/* bucket is unknown at this point */
179179
svc = NCS3GS;
180180
} else { /* Presume Formats (8),(9),(10) */
181-
if (nclistlength(hostsegments) > 3 && strcasecmp(nclistget(hostsegments, 1), "s3") == 0){
182-
bucket = nclistremove(hostsegments, 0);
183-
region = nclistremove(hostsegments, 2);
184-
host = strdup(url->host + sizeof(bucket) + 1);
185-
}else{
186-
if (nclistlength(hostsegments) > 2 && strcasecmp(nclistget(hostsegments, 0), "s3") == 0){
187-
region = nclistremove(hostsegments, 1);
188-
}
189-
if ((host = strdup(url->host)) == NULL){
190-
stat = NC_ENOMEM;
191-
goto done;
192-
}
181+
if (nclistlength(hostsegments) > 3 && strcasecmp(nclistget(hostsegments, 1), "s3") == 0){
182+
bucket = nclistremove(hostsegments, 0);
183+
region = nclistremove(hostsegments, 2);
184+
host = strdup(url->host + sizeof(bucket) + 1);
185+
}else{
186+
if (nclistlength(hostsegments) > 2 && strcasecmp(nclistget(hostsegments, 0), "s3") == 0){
187+
region = nclistremove(hostsegments, 1);
188+
}
189+
if ((host = strdup(url->host)) == NULL){
190+
stat = NC_ENOMEM;
191+
goto done;
193192
}
194193
}
194+
}
195195

196196
/* region = (1) from url, (2) s3->region, (3) default */
197197
if(region == NULL && s3 != NULL)

0 commit comments

Comments
 (0)