Branch: Tag:

2017-07-11

2017-07-11 20:35:13 by Arne Goedeke <el@laramies.com>

Stdio.Buffer: return unsigned integers in _sizeof

On 32bit systems we might encounter buffers larger than INT_MAX.
Use push_ulongest() to make sure that we do not accidentally return
negative length.

1177:       PIKEFUN int(0..) _size_object( )    { -  RETURN THIS->malloced ? THIS->allocated : 0; +  Buffer *io = THIS; +  if (io->malloced) +  { +  push_ulongest(THIS->allocated);    } -  +  else +  { +  push_int(0); +  } +  }       /*! @decl Buffer add_padding( int(0..) nbytes, int(0..255)|void byte )    *!
1562:    PIKEFUN int(0..) _sizeof()    flags ID_PROTECTED;    { -  push_int64(io_len(THIS)); +  push_ulongest(io_len(THIS));    }       /*! @decl string cast(string type)