bytebuffer.c#38  Bytebufferbb = (Bytebuffer*)emalloc(sizeof(Bytebuffer));
#39  if(bb == NULL) return (Bytebuffer*)bbFail();
#40  bb->alloc=0;
#41  bb->length=0;
#42  bb->content=NULL;
#43  bb->nonextendible = 0;
#44  return bb;
#48bbSetalloc(Bytebufferbb, const unsigned int sz0)
#52  if(bb == NULL) return bbFail();
#53  if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
#54  else if(bb->alloc >= sz) return TRUE;
#55  else if(bb->nonextendible) return bbFail();
#57  if(bb->alloc > 0 && bb->length > 0 && bb->content != NULL) {
#58    memcpy((void*)newcontent,(void*)bb->content,sizeof(char)*bb->length);
#60  if(bb->content != NULLefree(bb->content);
#61  bb->content=newcontent;
#62  bb->alloc=sz;
#67bbFree(Bytebufferbb)
#69  if(bb == NULL) return;
#70  if(bb->content != NULLefree(bb->content);
#71  efree(bb);
#75bbSetlength(Bytebufferbb, const unsigned int sz)
#77  if(bb == NULL) return bbFail();
#78  if(bb->length < sz) {
#79      if(!bbSetalloc(bb,sz)) return bbFail();
#81  bb->length = sz;
#86bbFill(Bytebufferbb, const char fill)
#89  if(bb == NULL) return bbFail();
#90  for(i=0;i<bb->length;i++) bb->content[i] = fill;
#95bbGet(Bytebufferbb, unsigned int index)
#97  if(bb == NULL) return -1;
#98  if(index >= bb->length) return -1;
#99  return bb->content[index];
#103bbSet(Bytebufferbb, unsigned int index, char elem)
#105  if(bb == NULL) return bbFail();
#106  if(index >= bb->length) return bbFail();
#107  bb->content[index] = elem;
#112bbAppend(Bytebufferbb, char elem)
#114  if(bb == NULL) return bbFail();
#116  while(bb->length+1 >= bb->alloc) {
#117    if(!bbSetalloc(bb,0))
#120  bb->content[bb->length] = elem;
#121  bb->length++;
#122  bb->content[bb->length] = '\0';
#128bbCat(Bytebufferbb, const char* s)
#130    bbAppendn(bb,(void*)s,strlen(s)+1); /* include trailing null*/
#132    if(bb->length == 0) return bbFail();
#133    bb->length--;
#138bbCatbuf(Bytebufferbb, const Bytebuffers)
#141 bbAppendn(bb,bbContents(s),bbLength(s));
#142    bbNull(bb);
#147bbAppendn(Bytebufferbb, const void* elem, const unsigned int n0)
#150  if(bb == NULL || elem == NULL) return bbFail();
#152  while(!bbNeed(bb,(n+1))) {if(!bbSetalloc(bb,0)) return bbFail();}
#153  memcpy((void*)&bb->content[bb->length],(void*)elem,n);
#154  bb->length += n;
#155  bb->content[bb->length] = '\0';
#160bbInsert(Bytebufferbb, const unsigned int index, const char elem)
#164  return bbInsertn(bb,index,tmp,1);
#168bbInsertn(Bytebufferbb, const unsigned int index, const char* elem, const unsigned int n)
#174  if(bb == NULL) return bbFail();
#176  newlen = bb->length + n;
#178  if(newlen >= bb->alloc) {
#179    if(!bbExtend(bb,n)) return bbFail();
#195  for(j=newlen-1,i=index;i<bb->length;i++) {
#196    bb->content[j]=bb->content[j-n];
#198  memcpy((void*)(bb->content+index),(void*)elem,n);
#199  bb->length += n;
#210int bbHeadpop(Bytebufferbb, char* pelem)
#212  if(bb == NULL) return bbFail();
#213  if(bb->length == 0) return bbFail();
#214  *pelem = bb->content[0];
#215  memmove((void*)&bb->content[0],
#216          (void*)&bb->content[1],
#217          sizeof(char)*(bb->length - 1));
#218  bb->length--;
#223bbTailpop(Bytebufferbb, char* pelem)
#225  if(bb == NULL) return bbFail();
#226  if(bb->length == 0) return bbFail();
#227  *pelem = bb->content[bb->length-1];
#228  bb->length--;
#233bbHeadpeek(Bytebufferbb, char* pelem)
#235  if(bb == NULL) return bbFail();
#236  if(bb->length == 0) return bbFail();
#237  *pelem = bb->content[0];
#242bbTailpeek(Bytebufferbb, char* pelem)
#244  if(bb == NULL) return bbFail();
#245  if(bb->length == 0) return bbFail();
#246  *pelem = bb->content[bb->length - 1];
#251bbDup(const Bytebufferbb)
#253    char* result = (char*)emalloc(bb->length+1);
#254    memcpy((void*)result,(const void*)bb->content,bb->length);
#255    result[bb->length] = '\0'; /* just in case it is a string*/
#260bbSetcontents(Bytebufferbb, char* contents, const unsigned int alloc)
#262    if(bb == NULL) return bbFail();
#263    bbClear(bb);
#264    if(!bb->nonextendible && bb->content != NULLefree(bb->content);
#265    bb->content = contents;
#266    bb->length = 0;
#267    bb->alloc = alloc;
#268    bb->nonextendible = 1;
#274bbNull(Bytebufferbb)
#276    bbAppend(bb,'\0');
#277    bb->length--;
bytebuffer.h#48#define bbLength(bb) ((bb)?(bb)->length:0U)
#49#define bbAlloc(bb) ((bb)?(bb)->alloc:0U)
#50#define bbContents(bb) ((bb && bb->content)?(bb)->content:(char*)"")
#51#define bbExtend(bb,lenbbSetalloc((bb),(len)+(bb->alloc))
#52#define bbClear(bb) ((void)((bb)?(bb)->length=0:0U))
#53#define bbNeed(bb,n) ((bb)?((bb)->alloc - (bb)->length) > (n):0U)
#54#define bbAvail(bb) ((bb)?((bb)->alloc - (bb)->length):0U)
cdftests.c#342    static struct cdfvar bb = /* variable */
#369    bb.dims = (int *) emalloc(sizeof(int) * bb.ndims);
#370    bb.dims[0] = kk_dim;
#371    bb.dims[1] = jj_dim;
#372    if ((bb_id = ncvardef(ncidbb.namebb.type,
#373    bb.ndimsbb.dims)) == -1) {
#377    add_var(&test, &bb); /* keep in-memory netcdf in sync */
#410    free(bb.dims);
ncbytes.c#35  NCbytesbb = (NCbytes*)malloc(sizeof(NCbytes));
#36  if(bb == NULL) return (ncbytesfail(),NULL);
#37  bb->alloc=0;
#38  bb->length=0;
#39  bb->content=NULL;
#40  bb->nonextendible = 0;
#41  return bb;
#45ncbytessetalloc(NCbytesbb, unsigned long sz)
#48  if(bb == NULL) return ncbytesfail();
#49  if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
#50  if(bb->alloc >= sz) return TRUE;
#51  if(bb->nonextendible) return ncbytesfail();
#54  if(bb->alloc > 0 && bb->length > 0 && bb->content != NULL) {
#55    memcpy((void*)newcontent,(void*)bb->content,sizeof(char)*bb->length);
#57  if(bb->content != NULL) free(bb->content);
#58  bb->content=newcontent;
#59  bb->alloc=sz;
#64ncbytesfree(NCbytesbb)
#66  if(bb == NULL) return;
#67  if(!bb->nonextendible && bb->content != NULL) free(bb->content);
#68  free(bb);
#72ncbytessetlength(NCbytesbb, unsigned long sz)
#74  if(bb == NULL) return ncbytesfail();
#75  if(bb->length < sz) {
#76      if(sz > bb->alloc) {if(!ncbytessetalloc(bb,sz)) return ncbytesfail();}
#78  bb->length = sz;
#83ncbytesfill(NCbytesbb, char fill)
#86  if(bb == NULL) return ncbytesfail();
#87  for(i=0;i<bb->length;i++) bb->content[i] = fill;
#92ncbytesget(NCbytesbb, unsigned long index)
#94  if(bb == NULL) return -1;
#95  if(index >= bb->length) return -1;
#96  return bb->content[index];
#100ncbytesset(NCbytesbb, unsigned long index, char elem)
#102  if(bb == NULL) return ncbytesfail();
#103  if(index >= bb->length) return ncbytesfail();
#104  bb->content[index] = elem;
#109ncbytesappend(NCbytesbb, char elem)
#111  if(bb == NULL) return ncbytesfail();
#113  while(bb->length+1 >= bb->alloc) {
#114 if(!ncbytessetalloc(bb,0)) return ncbytesfail();
#116  bb->content[bb->length] = (char)(elem & 0xFF);
#117  bb->length++;
#118  bb->content[bb->length] = '\0';
#124ncbytescat(NCbytesbb, const char* s)
#129  ncbytesappendn(bb,(void*)s,strlen(s)+1); /* include trailing null*/
#131  if(bb->length == 0) return ncbytesfail();
#132  bb->length--;
#137ncbytesappendn(NCbytesbb, const void* elem, unsigned long n)
#139  if(bb == NULL || elem == NULL) return ncbytesfail();
#141  while(!ncbytesavail(bb,n+1)) {
#142    if(!ncbytessetalloc(bb,0)) return ncbytesfail();
#144  memcpy((void*)&bb->content[bb->length],(void*)elem,n);
#145  bb->length += n;
#146  bb->content[bb->length] = '\0';
#151ncbytesprepend(NCbytesbb, char elem)
#154  if(bb == NULL) return ncbytesfail();
#155  if(bb->length >= bb->alloc) if(!ncbytessetalloc(bb,0)) return ncbytesfail();
#157  for(i=(int)bb->alloc;i>=1;i--) {bb->content[i]=bb->content[i-1];}
#158  bb->content[0] = elem;
#159  bb->length++;
#164ncbytesdup(NCbytesbb)
#166    char* result = (char*)malloc(bb->length+1);
#167    memcpy((void*)result,(const void*)bb->content,bb->length);
#168    result[bb->length] = '\0'; /* just in case it is a string*/
#173ncbytesextract(NCbytesbb)
#175    char* result = bb->content;
#176    bb->alloc = 0;
#177    bb->length = 0;
#178    bb->content = NULL;
#183ncbytessetcontents(NCbytesbb, char* contents, unsigned long alloc)
#185    if(bb == NULL) return ncbytesfail();
#186    ncbytesclear(bb);
#187    if(!bb->nonextendible && bb->content != NULL) free(bb->content);
#188    bb->content = contents;
#189    bb->length = 0;
#190    bb->alloc = alloc;
#191    bb->nonextendible = 1;
#198ncbytesnull(NCbytesbb)
#200    ncbytesappend(bb,'\0');
#201    bb->length--;
ncbytes.h#51#define ncbyteslength(bb) ((bb)!=NULL?(bb)->length:0)
#52#define ncbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0)
#53#define ncbytescontents(bb) (((bb)!=NULL && (bb)->content!=NULL)?(bb)->content:(char*)"")
#54#define ncbytesextend(bb,lenncbytessetalloc((bb),(len)+(bb->alloc))
#55#define ncbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0)
#56#define ncbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0)
ocbytes.c#35  OCbytesbb = (OCbytes*)malloc(sizeof(OCbytes));
#36  if(bb == NULL) return (OCbytes*)ocbytesfail();
#37  bb->alloc=0;
#38  bb->length=0;
#39  bb->content=NULL;
#40  bb->nonextendible = 0;
#41  return bb;
#45ocbytessetalloc(OCbytesbb, size_t sz)
#48  if(bb == NULL) return ocbytesfail();
#49  if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
#50  if(bb->alloc >= sz) return TRUE;
#51  if(bb->nonextendible) return ocbytesfail();
#54  if(bb->alloc > 0 && bb->length > 0 && bb->content != NULL) {
#55    memcpy((void*)newcontent,(void*)bb->content,sizeof(char)*bb->length);
#57  if(bb->content != NULL) free(bb->content);
#58  bb->content=newcontent;
#59  bb->alloc=sz;
#64ocbytesfree(OCbytesbb)
#66  if(bb == NULL) return;
#67  if(!bb->nonextendible && bb->content != NULL) free(bb->content);
#68  free(bb);
#72ocbytessetlength(OCbytesbb, size_t sz)
#74  if(bb == NULL) return ocbytesfail();
#75  if(bb->length < sz) {
#76      if(sz > bb->alloc) {if(!ocbytessetalloc(bb,sz)) return ocbytesfail();}
#78  bb->length = sz;
#83ocbytesfill(OCbytesbb, char fill)
#86  if(bb == NULL) return ocbytesfail();
#87  for(i=0;i<bb->length;i++) bb->content[i] = fill;
#92ocbytesget(OCbytesbb, size_t index)
#94  if(bb == NULL) return -1;
#95  if(index >= bb->length) return -1;
#96  return bb->content[index];
#100ocbytesset(OCbytesbb, size_t index, char elem)
#102  if(bb == NULL) return ocbytesfail();
#103  if(index >= bb->length) return ocbytesfail();
#104  bb->content[index] = elem;
#109ocbytesappend(OCbytesbb, int elem)
#111  if(bb == NULL) return ocbytesfail();
#113  while(bb->length+1 >= bb->alloc) {
#114 if(!ocbytessetalloc(bb,0)) return ocbytesfail();
#116  bb->content[bb->length] = (char)elem;
#117  bb->length++;
#118  bb->content[bb->length] = '\0';
#124ocbytescat(OCbytesbb, const char* s)
#126    ocbytesappendn(bb,(void*)s,strlen(s)+1); /* include trailing null*/
#128    if(bb->length == 0) return ocbytesfail();
#129    bb->length--;
#134ocbytesappendn(OCbytesbb, const void* elem, size_t n)
#136  if(bb == NULL || elem == NULL) return ocbytesfail();
#138  while(!ocbytesavail(bb,n+1)) {
#139    if(!ocbytessetalloc(bb,0)) return ocbytesfail();
#141  memcpy((void*)&bb->content[bb->length],(void*)elem,n);
#142  bb->length += n;
#143  bb->content[bb->length] = '\0';
#148ocbytesprepend(OCbytesbb, char elem)
#151  if(bb == NULL) return ocbytesfail();
#152  if(bb->length >= bb->alloc) if(!ocbytessetalloc(bb,0)) return ocbytesfail();
#154  for(i=bb->alloc;i>=1;i--) {bb->content[i]=bb->content[i-1];}
#155  bb->content[0] = elem;
#156  bb->length++;
#161ocbytesdup(OCbytesbb)
#163    char* result = (char*)malloc(bb->length+1);
#164    memcpy((void*)result,(const void*)bb->content,bb->length);
#165    result[bb->length] = '\0'; /* just in case it is a string*/
#170ocbytesextract(OCbytesbb)
#172    char* result = bb->content;
#173    bb->alloc = 0;
#174    bb->length = 0;
#175    bb->content = NULL;
#180ocbytessetcontents(OCbytesbb, char* contents, size_t alloc)
#182    if(bb == NULL) return ocbytesfail();
#183    ocbytesclear(bb);
#184    if(!bb->nonextendible && bb->content != NULL) free(bb->content);
#185    bb->content = contents;
#186    bb->length = 0;
#187    bb->alloc = alloc;
#188    bb->nonextendible = 1;
#195ocbytesnull(OCbytesbb)
#197    ocbytesappend(bb,'\0');
#198    bb->length--;
ocbytes.h#51#define ocbyteslength(bb) ((bb)!=NULL?(bb)->length:0)
#52#define ocbytesalloc(bb) ((bb)!=NULL?(bb)->alloc:0)
#53#define ocbytescontents(bb) (((bb)!=NULL && (bb)->content!=NULL)?(bb)->content:(char*)"")
#54#define ocbytesextend(bb,lenocbytessetalloc((bb),(len)+(bb->alloc))
#55#define ocbytesclear(bb) ((bb)!=NULL?(bb)->length=0:0)
#56#define ocbytesavail(bb,n) ((bb)!=NULL?((bb)->alloc - (bb)->length) >= (n):0)
tst_opaque_data.c#40       {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa},


HyperKWIC - Version 7.20DA executed at 11:37 on 27 Oct 2017 | Polyhedron Solutions - INTERNAL USE | COMMERCIAL (Any O/S) SN 4AKIed