file size primitive bug?

John M McIntosh johnmci at smalltalkconsulting.com
Fri Feb 27 04:57:21 UTC 2004


Well I took a peek at a Dec 17, 1996 sqFilePrims.c file and noticed in  
the Squeak source file V1:
"From Smalltalk-80 version 1.03 of July 31, 1996 on 20 September 1996  
at 10:50:05 am"
the code isn't there, but it was added in the change log some time  
before
"----SNAPSHOT----(23 September 1996 8:36:00 pm )"

So as you can see the code has been there a long time. If we could wait  
another 2 years, then it will be 10 years old and we
can retire it eh?

I doubt this was done as a limitation of the mac os, remember we didn't  
even support file truncation until just a few years back.

So this call should have been used
Determines the current logical size of an open file.
OSErr GetEOF (
    short refNum,
    long * logEOF
);

Parameter Descriptions
refNum The file reference number of an open file.
logEOF On return, a pointer to the logical size (the logical  
end-of-file) of the given file.
function result A result code. See “File Manager Result Codes”.

This won't fly now, because it only works for files < 2GB.
besides we're using unix calls now...


On Feb 26, 2004, at 6:30 PM, tim Rowledge wrote:

> Julian Fitzell wrote:
>
>> So the fix I originally had seems problematic.  I noticed it when  
>> filing in.  I think what's going on is that for each method change:
>> 1. we call #setToEnd
>> 2. #setToEnd gets the file size and sets the position to that
>> 3. we write out data
> There's also the problem of a #readOnlyCopy leaving you with the last  
> byte index being different to that held by the writable original. So  
> if one were using a file as a pipe-sort-of-thing you'd be utterly SOL.
>
> Is there noone around that knows why this strange process was chosen?  
> Was it perhaps some artifact of an old Mac OS release that no longer  
> needs to concern us?
>
> tim
>
>
>
>
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list