pike.git / src / modules / _Stdio / buffer.cmod

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:55:    if (!sbuf_program)    return 0;    Pike_sp--;    }    return get_storage( o, sbuf_program );   };         /*! @module Stdio    */ + static struct program *buffer_error_program;      /*! @class IOBuffer    *!    *! A buffer to use as input or buffering when doing I/O. It is    *! similar to @[String.Buffer], but can only contain 8bit data and is    *! designed for protocol parsing. It is optimized for reading from    *! the beginning and adding to the end, and will try to minimize the    *! amount of data copying that is done.    *!    *! The class maintains two separate offsets, one for reading and one
pike.git/src/modules/_Stdio/buffer.cmod:176:    io->buffer = xrealloc( io->buffer, new_len );    io->allocated = new_len;    }    return io->buffer+io->len;    }       static void io_range_error( IOBuffer *io, int howmuch )    {    /* throw error if so desired. */    if( io->error_mode ) -  Pike_error("Trying to read %d outside allowed range\n", howmuch); +  { +  push_text("Trying to read %d outside allowed range\n"); +  push_int(howmuch); +  f_sprintf(2); +  push_object(clone_object(buffer_error_program, 1)); +  f_throw(1);    } -  +  }       static int io_avail( IOBuffer *io, int len )    {    if( len < 0 || len + io->offset > io->len )    {    io_range_error( io, len );    return 0;    }    return 1;    }
pike.git/src/modules/_Stdio/buffer.cmod:1332:    io_unlock( get_storage(this->sub,IOBuffer_program ) );    }    if( this->source )    free_object( this->source );    if( this->str )    free_string( this->str );    if( this->malloced )    free( this->buffer );    }   } +    void init_stdio_buffer(void)   {    INIT -  +  start_new_program(); +  low_inherit(generic_error_program,0,0,0,0,0); +  add_integer_constant( "buffer_error", 1, 0 ); +  buffer_error_program = end_program();   }         void exit_stdio_buffer(void)   {    if( shm_program ) free_program( shm_program );    if( sbuf_program ) free_program( sbuf_program ); -  +  free_program( buffer_error_program );    EXIT   }   /*! @endmodule    */