AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
December 2018

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2018.12.11 13:36 "SeekOK and WriteOK", by Emmanuel Cosnard
2018.12.11 14:01 "Re: SeekOK and WriteOK", by Bob Friesenhahn
2018.12.11 14:09 "Re: SeekOK and WriteOK", by Emmanuel Cosnard
2018.12.11 14:24 "Re: SeekOK and WriteOK", by Emmanuel Cosnard
2018.12.11 14:29 "Re: SeekOK and WriteOK", by Nicolas Ruff
2018.12.11 18:54 "Re: SeekOK and WriteOK", by Bob Friesenhahn
2018.12.12 08:53 "Re: SeekOK and WriteOK", by Emmanuel Cosnard
2018.12.13 11:04 "Re: SeekOK and WriteOK", by Emmanuel Cosnard
2018.12.13 13:13 "Re: SeekOK and WriteOK", by Paavo Helde

2018.12.11 14:24 "Re: SeekOK and WriteOK", by Emmanuel Cosnard

It sometimes returns -1 although it seems to have well written what I
wanted, and sometimes returns -1 and hasn't written anything.
________________________________
De : Tiff <tiff-bounces@lists.osgeo.org> de la part de Emmanuel Cosnard
<emmanuel.cosnard@outlook.fr>
Envoyé : mardi 11 décembre 2018 14:09
À : Bob Friesenhahn
Cc : tiff@lists.osgeo.org
Objet : Re: [Tiff] SeekOK and WriteOK

Hello Bob,

Thanks for your answer!

I am using windows 64 bits.

Actually, I created my own TIFFWriteData function and I am now sure that
it's the WriteOK that doesn't work on some occasion, but still have no idea
why.

Best regards,

Emmanuel
________________________________
De : Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Envoyé : mardi 11 décembre 2018 14:01
À : Emmanuel Cosnard
Cc : tiff@lists.osgeo.org
Objet : Re: [Tiff] SeekOK and WriteOK

On Tue, 11 Dec 2018, Emmanuel Cosnard wrote:

> Hello,
>
> I am using the function TIFFWriteData to write some data on a custome
> rationnal tag, and it seems, that on some rare occasion,
> if (SeekOK(tif, dir->tdir_offset) && WriteOK(tif, cp, cc))
> Is there a way to do some intelligent retry here, instead of returning an
> error? Or can we know why the WriteOK or SeekOK didn't work properly?

You did not mention the operating system you are using or the size of
its native off_t type (or equivalent).  It might make a difference if
you are using tif_unix.c or tif_win32.c, and the capabilities of the
compiler and run-time when the library was compiled.

This is the underlying implementation of the check:

int _TIFFSeekOK(TIFF* tif, toff_t off)
{
     /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
     /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
     return off <= (~(uint64)0)/2 && TIFFSeekFile(tif,off,SEEK_SET)==off;
}

One can see that the first check is that the offset must be within the
range of a signed 64-bit type.  The next check actually does the seek
and checks if the requested position was obtained.  This is a case
where the seek position might need to be in the range of a smaller
size.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt


_______________________________________________
Tiff mailing list
Tiff@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/tiff