From 40dc0bcd6395193d5b859bf28b3f4bd459311ad7 Mon Sep 17 00:00:00 2001 From: Brian Armstrong Date: Mon, 24 Apr 2017 18:03:59 -0700 Subject: [PATCH] fix ByteStreamBuffer --- modules/imgcodecs/src/loadsave.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp index 4ceccd196e..6b15dbe3d6 100644 --- a/modules/imgcodecs/src/loadsave.cpp +++ b/modules/imgcodecs/src/loadsave.cpp @@ -70,21 +70,21 @@ protected: std::ios_base::seekdir dir, std::ios_base::openmode ) { - // get absolute offset - off_type off = offset; + char* whence = eback(); if (dir == std::ios_base::cur) { - off += gptr() - eback(); + whence = gptr(); } else if (dir == std::ios_base::end) { - off += egptr() - eback(); + whence = egptr(); } + char* to = whence + offset; // check limits - if (off >= (off_type)0 && off <= egptr() - eback()) + if (to >= eback() && to <= egptr()) { - setg(eback(), gptr() + off, egptr()); + setg(eback(), to, egptr()); return gptr() - eback(); }