Ticket #4209: stream-offset.patch

File stream-offset.patch, 652 bytes (added by SF/tobigun, 16 years ago)
  • common/stream.cpp

     
    6868        switch (whence) {
    6969        case SEEK_END:
    7070                // SEEK_END works just like SEEK_SET, only 'reversed',
    71                 // i.e. from the end.
    72                 offs = _size - offs;
     71                // i.e. from the end (Note: offs is negative).
     72                offs = _size + offs;
    7373                // Fall through
    7474        case SEEK_SET:
    7575                _ptr = _ptrOrig + offs;
     
    204204
    205205        switch(whence) {
    206206        case SEEK_END:
    207                 offset = size() - offset;
     207                offset = size() + offset;
    208208                // fallthrough
    209209        case SEEK_SET:
    210210                _pos = _begin + offset;