Skip to content

Commit 40dc0bc

Browse files
fix ByteStreamBuffer
1 parent fe21487 commit 40dc0bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/imgcodecs/src/loadsave.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@ class ByteStreamBuffer: public std::streambuf
7070
std::ios_base::seekdir dir,
7171
std::ios_base::openmode )
7272
{
73-
// get absolute offset
74-
off_type off = offset;
73+
char* whence = eback();
7574
if (dir == std::ios_base::cur)
7675
{
77-
off += gptr() - eback();
76+
whence = gptr();
7877
}
7978
else if (dir == std::ios_base::end)
8079
{
81-
off += egptr() - eback();
80+
whence = egptr();
8281
}
82+
char* to = whence + offset;
8383

8484
// check limits
85-
if (off >= (off_type)0 && off <= egptr() - eback())
85+
if (to >= eback() && to <= egptr())
8686
{
87-
setg(eback(), gptr() + off, egptr());
87+
setg(eback(), to, egptr());
8888
return gptr() - eback();
8989
}
9090

0 commit comments

Comments
 (0)