Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx012.isp.belgacom.be (inmx012.isp.belgacom.be [195.238.3.90])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j0SK0Zwm012019
        for <joris.at.lebbeke@skynet.be>; Fri, 28 Jan 2005 21:00:35 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx012.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j0SK0Txl008722
        for <joris.at.lebbeke@skynet.be>; Fri, 28 Jan 2005 21:00:31 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id A2F34610416; Fri, 28 Jan 2005 14:48:38 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from mail.sidefx.com (tor149-99-58-193.dedicated.sprintdsl.ca
	[149.99.58.193])
	by xserve.flids.com (Postfix) with ESMTP id 62EA960ED3C
	for <tiff@remotesensing.org>; Fri, 28 Jan 2005 11:23:39 -0500 (EST)
Received: from [192.168.237.144] (crete.ithaca.sidefx.com[192.168.237.144])
	by mail.sidefx.com (Smail-3.2.0.111 2000-Feb-17 #5; 2004-May-20)
	(2407 bytes) via sendmail with /P:esmtp/R:inet_hosts/T:smtp
	id <m1CuYtj-004otiC@mail.sidefx.com> (sender <edward@sidefx.com>)
	for <tiff@remotesensing.org>; Fri, 28 Jan 2005 11:23:03 -0500 (EST)
Message-ID: <41FA673D.4090204@sidefx.com>
Date: Fri, 28 Jan 2005 11:24:29 -0500
From: Edward Lam <edward@sidefx.com>
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Michael Rinne <mrinne@viisage.com>
Subject: Re: [Tiff] issues with TIFFStreamOpen
References: <41F69009.1020609@viisage.com> <41F944CA.5040806@sidefx.com>
	<41FA13DE.9050603@viisage.com>
In-Reply-To: <41FA13DE.9050603@viisage.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: tiff@remotesensing.org
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 42af3e592e0713a7e6b654eda33de528

Michael Rinne wrote:
>> If no one has a test case which can prove that the seek is required, I 
>> propose that we scrap the call to TIFFSeekFile() in TIFFClientOpen() 
>> regardless. If the seek is really necessary, I think it should be up 
>> to the caller of TIFFClientOpen() to do it. ReadOK() shouldn't change 
>> the file pointer anyhow, if it does, then it is a bug in the readproc.
> 
> It is probably a good idea to get rid off that seek, if it is really 
> unnecessary.

I've logged this issue as a minor bug under #756.

>> How does anyone expect to treat streams generically? <sigh> We could do 
> 
> I totally agree with that. ;-(
 > ...
 > Hence, one can not use streams within the API of SDKs. ;-(

Not to mention the fact that in gcc 2.96, we had to do ugly hacks so that we 
could seek using ostrstream's. :( We've debated here before whether we should 
just give up on iostreams completely because we've been bitten by poor 
implementations so many times. We've seen cases where streaming a buffer would 
cause a memory reallocation every *single* character!

> With this fix I get a valid TIFF image with the correct size and color 
> depth, but unfortunately it is all black.
> ...
> 
> I patched this to
> 
> 140:    // extend the stream to the expected size
> 141:    os->seekp(0, ios::end);
> 142:    num_fill = origin + off - (toff_t)os->tellp();
> 
> which resulted in a valid TIFF file with my test image.

Excellent! Sorry about the obvious bug. It explains why you get a black image 
doesn't it? :) I don't see anything else wrong with the file now, shall we 
submit your latest version of tif_stream.cxx to bugzilla?

-Edward
_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
