Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas012.isp.belgacom.be (localhost [127.0.0.1])
        by inav029.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id kBQAUhaV000983
        for <joris.at.lebbeke@skynet.be>; Tue, 26 Dec 2006 11:30:43 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx015.isp.belgacom.be (inmx015.isp.belgacom.be [195.238.4.218])
        by inas012.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id kBQAUaQf031721
        for <joris.at.lebbeke@skynet.be>; Tue, 26 Dec 2006 11:30:37 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx015.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id kBQAUO0F002244
        for <joris.at.lebbeke@skynet.be>; Tue, 26 Dec 2006 11:30:24 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id kBQAJDrQ000580;
	Tue, 26 Dec 2006 05:20:32 -0500
Received: from cgp.spb.edu (vlan3.cgp.spb.edu [195.70.196.207])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id kBQAJAok000577
	for <tiff@lists.maptools.org>; Tue, 26 Dec 2006 05:19:10 -0500
Received: from wg.pu.ru ([193.124.85.219] verified)
	by cgp.spb.edu (CommuniGate Pro SMTP 5.0.12)
	with ESMTP id 9905132 for tiff@lists.maptools.org;
	Tue, 26 Dec 2006 13:18:51 +0300
Received: (from uucp@localhost)
	by wg.pu.ru (8.9.1a/8.9.1) with UUCP id KAA20509
	for tiff@lists.maptools.org; Tue, 26 Dec 2006 10:19:09 GMT
Received: from ak4719.spb.edu (localhost.localdomain [127.0.0.1])
	by ak4719.spb.edu (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id
	kBQAA9pQ028838
	for <tiff@lists.maptools.org>; Tue, 26 Dec 2006 13:10:09 +0300
Received: (from dron@localhost)
	by ak4719.spb.edu (8.13.4/8.13.4/Submit) id kBQAA9TU028837
	for tiff@lists.maptools.org; Tue, 26 Dec 2006 13:10:09 +0300
From: Andrey Kiselev <dron@ak4719.spb.edu>
Date: Tue, 26 Dec 2006 13:10:08 +0300
To: tiff@lists.maptools.org
Subject: Re: [Tiff] Interpreting values in tdir_offset of TIFFDirEntry
Message-ID: <20061226101008.GA28808@ak4719.spb.edu>
Mail-Followup-To: tiff@lists.maptools.org
References: <4589399B.6020700@go2.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4589399B.6020700@go2.pl>
X-GnuPG-Key: http://www.srces.spb.org/dron/export.home.key
X-Face: "t+se9s~+y~[XUH]L|pmeO3Pt/Q@DNv**S, d@_1-C=}/,
	c%<3Qp]eu!ok<"2lYJm$!9qVcg F?7o*L; |$`6|Q|>Rt-cU%2_y@6tQ|`!Li}TsvZvEKx;
	>fuY=fc(=sX^`7Wmw8%SsR`AvM$a; 0U/eN\ P?B\FTyqD, 0np$U2!*'z_4D,
	VPlFf?bN0&zYf"zF0s!7Tl7?$we)xD0@lL>[h|8bhys0i.g|zLnu@C
	Ti@d]i=[!:j1CB\5/TF[m]`lfHfaqSN[0qn@T3zeosV/[LAss{@p_?],x*j8P_9t[}uHD^X-;
	j~\M! gyTly;fj`}&Y~i{<#bN.#QmkE}#T`dxP.I1\.)_MEN{@#W
User-Agent: Mutt/1.5.9i
X-Null-Tag: 856639a792e5f6843961cc8f8abb4181
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00001ec3
X-MSP-STORE: Tue, 26 Dec 2006 11:30:49 +0100
Status: RO

On Wed, Dec 20, 2006 at 02:24:43PM +0100, mikk wrote:
> I'm not sure I understand the way of interpreting values stored in the 
> tdir_offset of TIFFDirEntry structure. According to the tiff.h comments 
> for the TIFFDirEntry struct:
> "...If the value is 4 bytes or less, then it is placed in the offset 
> field to save space. If the value is less than 4 bytes, it is 
> left-justified in the offset field."
> When the IFD entry (a tag) is written into a TIFF file, and the data 
> type size is 2 bytes (fe. TIFF_SHORT), and data length is 2, that makes 
> 4 bytes of data. I assume that the data itself is saved in the 
> tdir_offset field. And what if the data type size is 1 byte (fe. 
> TIFF_ASCII or TIFF_BYTE) and data length is less than or equal to 4? I 
> assume that the data itself is saved in the tdir_offset. Am I right?

You are rigt, it works that way. If you interested how it is implemented
in libtiff take a look at the tif_dirread.c module.  TIFFFetch*()
functions always check whether we have values stored in the offset field
itself or we should seek in file to grab them.

Best regards,
Andrey


-- 
Andrey V. Kiselev
ICQ# 26871517
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
