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

version» Context lines:

pike.git/src/post_modules/Shuffler/d_source_pikestream.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: d_source_pikestream.c,v 1.7 2004/10/16 07:27:29 agehall Exp $ + || $Id: d_source_pikestream.c,v 1.8 2007/11/10 21:23:02 nilsson Exp $   */      #include "global.h"   #include "bignum.h"   #include "object.h"   #include "interpret.h"      #include "fdlib.h"   #include "fd_control.h"   
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:65:    pop_stack();    push_int(0);    apply( s->obj, "set_close_callback", 1 );    pop_stack();   }         static struct data get_data( struct source *_s, off_t len )   {    struct pf_source *s = (struct pf_source *)_s; -  struct data res; +  struct data res = { 0, 0, 0, NULL };    char *buffer = NULL;       if( s->str )    {    len = s->str->len;    if( s->skip )    {    if( s->skip >= (size_t)s->str->len )    {    s->skip -= (size_t)s->str->len; -  res.do_free = 0; -  res.data = 0; +     res.len = -2; -  res.off = 0; +     return res;    }    len -= s->skip;    buffer = malloc( len );    MEMCPY( buffer, s->str->str+s->skip, len);    }    else    {    if( s->len > 0 )    {
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:102:    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;    res.do_free = 1; -  res.off = 0; +     free_string( s->str );    s->str = 0;    setup_callbacks( _s );    }    else if( !s->len )    s->s.eof = 1;    else    /* No data available, but there should be in the future (no EOF, nor    * out of the range of data to send as specified by the arguments to    * source_stream_make)