Beispiel #1
0
static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
    NCbytes* buf = data;
    size_t realsize = size * nmemb;

    Trace("WriteMemoryCallback");
    if(realsize == 0)
        nclog(NCLOGWARN,"WriteMemoryCallback: zero sized chunk");
    ncbytesappendn(buf, ptr, realsize);
    return realsize;
}
Beispiel #2
0
/* This assumes s is a null terminated string*/
int
ncbytescat(NCbytes* bb, const char* s)
{
  if(s == NULL) {
    return 1;
  }
  ncbytesappendn(bb,(void*)s,strlen(s)+1); /* include trailing null*/
  /* back up over the trailing null*/
  if(bb->length == 0) return ncbytesfail();
  bb->length--;
  return 1;
}