pike.git / src / post_modules / Shuffler / a_source_pikestring.c

version» Context lines:

pike.git/src/post_modules/Shuffler/a_source_pikestring.c:23:    struct pike_string*str;    char *data;    size_t len;   };      static struct data get_data( struct source *src, off_t len )   {    struct ps_source *s = (struct ps_source *)src;    struct data res;    -  if( len > s->len ) { +  if (len > s->len) {    len = s->len;    s->s.eof = 1; /* next read will be done from the next source */    }       res.data = s->data;    s->data += len;    s->len -= res.len = len;       return res;   }
pike.git/src/post_modules/Shuffler/a_source_pikestring.c:59:       if (!(res = calloc(1, sizeof(struct ps_source))))    return 0;       debug_malloc_touch(res);       res->s.free_source = free_source;    res->s.get_data = get_data;       copy_shared_string(res->str, s->u.string); +  slen = res->str->len; +  if (start > slen) +  start = slen;    res->data = res->str->str + start; -  +  slen -= start;    -  slen = res->str->len - start; -  if (len >= 0 && slen < len) -  slen = len; -  if (slen < 0) -  slen = 0; +  if (len < 0) +  len = slen; +  if (len > slen) +  len = slen;    -  res->len = slen; +  res->len = len;    return (struct source *)res;   }      void source_pikestring_init( )   {    /* nothing to do here */   }      void source_pikestring_exit( )   {    /* nothing to do here */   }