Branch: Tag:

2014-09-01

2014-09-01 15:48:34 by Per Hedbor <ph@opera.com>

Correctly throw buffer error in error mode

62:      /*! @module Stdio    */ + static struct program *buffer_error_program;      /*! @class IOBuffer    *!
183:    {    /* 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 )    {
1339:    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();   }      
1349:   {    if( shm_program ) free_program( shm_program );    if( sbuf_program ) free_program( sbuf_program ); +  free_program( buffer_error_program );    EXIT   }   /*! @endmodule    */