LibRaw_byte_buffer *LibRaw_abstract_datastream::make_byte_buffer(unsigned int sz)
{
  if(sz> 2*1024*1024*1024) // 2GB is enough
      throw LIBRAW_EXCEPTION_ALLOC;

    LibRaw_byte_buffer *ret = new LibRaw_byte_buffer(sz);
    if(!ret) // failed new should throw std::exception
      throw LIBRAW_EXCEPTION_ALLOC;
    read(ret->get_buffer(),sz,1);
    return ret;
}
LibRaw_byte_buffer *LibRaw_abstract_datastream::make_byte_buffer(unsigned int sz)
{
    LibRaw_byte_buffer *ret = new LibRaw_byte_buffer(sz);
    read(ret->get_buffer(),sz,1);
    return ret;
}