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$ +    */      #include "global.h"   #include "bignum.h"   #include "object.h"   #include "interpret.h"      #include "fdlib.h"   #include "fd_control.h"    - #include <sys/types.h> +    #include <sys/stat.h>      #include "shuffler.h"      /* Source: Pike-Stream    * Argument: Stdio.File lookalike with read    * callback support (set_read_callback)    */   static struct program *callback_program;   
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:81:    if( s->skip )    {    if( s->skip >= (size_t)s->str->len )    {    s->skip -= (size_t)s->str->len;    res.len = -2;    return res;    }    len -= s->skip;    buffer = malloc( len ); -  MEMCPY( buffer, s->str->str+s->skip, len); +  memcpy( buffer, s->str->str+s->skip, len);    }    else    {    if( s->len > 0 )    {    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 ); +  memcpy( buffer, s->str->str, len );    }    res.data = buffer;    res.len = len;    res.do_free = 1;    free_string( s->str );    s->str = 0;    setup_callbacks( src );    }    else if( !s->len )    s->s.eof = 1;
pike.git/src/post_modules/Shuffler/d_source_pikestream.c:164:      struct source *source_pikestream_make( struct svalue *s,    INT64 start, INT64 len )   {    struct pf_source *res;       if( (TYPEOF(*s) != PIKE_T_OBJECT) ||    (find_identifier("set_read_callback",s->u.object->prog)==-1) )    return 0;    -  res = malloc( sizeof( struct pf_source ) ); -  MEMSET( res, 0, sizeof( struct pf_source ) ); +  res = calloc( 1, sizeof( struct pf_source ) ); +  if( !res ) return NULL;       res->len = len;    res->skip = start;       res->s.get_data = get_data;    res->s.free_source = free_source;    res->s.set_callback = set_callback;    res->s.setup_callbacks = setup_callbacks;    res->s.remove_callbacks = remove_callbacks;    res->obj = s->u.object;