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

version» Context lines:

pike.git/src/post_modules/Shuffler/d_source_pikestream.c:5:      #include "fdlib.h"   #include "fd_control.h"      #include <sys/types.h>   #include <sys/stat.h>      #include "shuffler.h"      #define CHUNK 8192 - /* $Id: d_source_pikestream.c,v 1.1 2002/05/30 03:55:49 per Exp $ */ + /* $Id: d_source_pikestream.c,v 1.2 2002/07/05 09:55:32 per Exp $ */         /* Source: Pike-Stream    * Argument: Stdio.File lookalike with read    * callback support (set_read_callback)    */   static struct program *callback_program;      struct pf_source   {
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:70:   {    struct pf_source *s = (struct pf_source *)_s;    struct data res;    char *buffer = NULL;       if( s->str )    {    len = s->str->len;    if( s->skip )    { -  if( s->skip >= s->str->len ) +  if( s->skip >= (size_t)s->str->len )    { -  s->skip -= s->str->len; -  return; +  s->skip -= (size_t)s->str->len; +  res.do_free = 0; +  res.data = 0; +  res.len = -2; +  res.off = 0; +  return res;    } -  buffer = malloc( len = s->str->len - s->skip ); +  len -= s->skip; +  buffer = malloc( len );    MEMCPY( buffer, s->str->str+s->skip, len);    }    else    {    if( s->len > 0 )    { -  if( s->len < len ) +  if( s->len < (size_t)len )    len = s->len;    s->len -= len;    if( !s->len )    s->s.eof = 1;    }    buffer = malloc( len );    MEMCPY( buffer, s->str->str, len );    }    res.data = buffer;    res.len = len;