Skip to content

Commit

Permalink
ckp
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisHeimbigner committed Feb 24, 2024
1 parent 52186c8 commit 16ab2e1
Show file tree
Hide file tree
Showing 18 changed files with 947 additions and 357 deletions.
3 changes: 3 additions & 0 deletions include/ncbytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ EXTERNL int ncbytesremove(NCbytes*,unsigned long);
/* Concatenate a null-terminated string to the end of the buffer */
EXTERNL int ncbytescat(NCbytes*,const char*);

/* Insert n bytes into the buffer at position pos*/
EXTERNL int ncbytesinsert(NCbytes*,size_t pos, size_t n, const char*);

/* Set the contents of the buffer; mark the buffer as non-extendible */
EXTERNL int ncbytessetcontents(NCbytes*, void*, unsigned long);

Expand Down
3 changes: 2 additions & 1 deletion include/netcdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ extern "C" {
0x0002
All upper 16 bits are unused except
0x20000
0x40000
*/

/* Lower 16 bits */
Expand Down Expand Up @@ -162,7 +163,7 @@ Use this in mode flags for both nc_create() and nc_open(). */
#define NC_INMEMORY 0x8000 /**< Read from memory. Mode flag for nc_open() or nc_create() */

/* Upper 16 bits */
#define NC_NOATTCREORD 0x20000 /**< Disable the netcdf-4 (hdf5) attribute creation order tracking */
#define NC_NOATTCREORD 0x20000 /**< Disable the netcdf-4 (hdf5) attribute creation order tracking */
#define NC_NODIMSCALE_ATTACH 0x40000 /**< Disable the netcdf-4 (hdf5) attaching of dimscales to variables (#2128) */

#define NC_MAX_MAGIC_NUMBER_LEN 8 /**< Max len of user-defined format magic number. */
Expand Down
15 changes: 15 additions & 0 deletions libdispatch/ncbytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,18 @@ ncbytesremove(NCbytes* bb, unsigned long pos)
bb->length--;
return TRUE;
}

/* Insert n bytes into the buffer at position pos*/
int
ncbytesinsert(NCbytes* bb, size_t pos, size_t n, const char* s)
{
if(bb == NULL) return ncbytesfail();
if(pos > bb->length) ncbytesfail();
if((bb->length + n) >= bb->alloc) if(!ncbytessetalloc(bb,bb->length+n+1)) return ncbytesfail();
if(bb->length > 0)
memmove(bb->content+pos+n,bb->content+pos,(bb->length - pos));
memcpy(bb->content+pos,s,n);
bb->length += n;
bb->content[bb->length] = '\0';
return TRUE;
}
3 changes: 1 addition & 2 deletions libnczarr/zarr.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ EXTERNL int NCZ_comma_parse(const char* s, NClist* list);
EXTERNL int NCZ_swapatomicdata(size_t datalen, void* data, int typesize);
EXTERNL char** NCZ_clonestringvec(size_t len, const char** vec);
EXTERNL void NCZ_freestringvec(size_t len, char** vec);
EXTERNL void NCZ_clearstringvec(size_t len, char** vec);
EXTERNL int NCZ_ischunkname(const char* name,char dimsep);
EXTERNL char* NCZ_chunkpath(struct ChunkKey key);
EXTERNL int NCZ_reclaim_fill_value(NC_VAR_INFO_T* var);
EXTERNL int NCZ_copy_fill_value(NC_VAR_INFO_T* var, void** dstp);
EXTERNL size_t NCZ_get_maxstrlen(NC_OBJ* obj);
EXTERNL int NCZ_fixed2char(const void* fixed, char** charp, size_t count, size_t maxstrlen);
EXTERNL int NCZ_char2fixed(const char** charp, void* fixed, size_t count, size_t maxstrlen);
Expand Down
Loading

0 comments on commit 16ab2e1

Please sign in to comment.