From Oliver Neumann,
"I checked your solution and found one missing point which makes it still produce the tif error: The very first seek_set on the empty stream with zero offset." "This means that the empty stream is seeked again resulting in the fail bit to be set. Your code does not check this case, furthermore you use t_off instead of std::ostream::streampos for the tellp() calls. In this special case (empty stream) tellp() returns -1 which is cast to 0xFFFFFFFFFF as t_off is unsigned. I suggest this addition to your code (within the switch statement)"
This commit is contained in:
parent
b507858240
commit
0a1ecd3272
@ -183,6 +183,14 @@ toff_t libtiffOStreamSeekProc(thandle_t fd, toff_t off, int i)
|
|||||||
{
|
{
|
||||||
case SEEK_SET:
|
case SEEK_SET:
|
||||||
{
|
{
|
||||||
|
if (off==0)
|
||||||
|
{
|
||||||
|
std::ostream::streampos checkEmpty = fout->tellp();
|
||||||
|
if(checkEmpty < 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
pos_required = off;
|
pos_required = off;
|
||||||
|
|
||||||
fout->seekp(0, std::ios::end);
|
fout->seekp(0, std::ios::end);
|
||||||
|
Loading…
Reference in New Issue
Block a user