emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file sizes shown incorrectly for large files under Windows


From: Eli Zaretskii
Subject: Re: file sizes shown incorrectly for large files under Windows
Date: Wed, 12 Nov 2003 18:12:04 +0200

> From: Chris Moore <address@hidden>
> Date: Wed, 12 Nov 2003 13:34:02 +0100
> 
> # 53 "c:/chris/mingw/2.0.0-3/include/sys/types.h" 3
> typedef long _off_t;
> 
> This program:
> 
>   main() {  printf("%d", sizeof(long)); }
> 
> prints "4"
> 
>  > The interesting part is the declaration of the `st_size' member of
>  > `struct stat'.  You should be able to find that on the sys/stat.h
>  > header.
>  > 
>  > (The DIR command could use native Windows syscalls, which don't have
>  > the 2GB limitation, which would explain why it works while Emacs
>  > doesn't.)
> 
> Sounds like you've found the cause of the problem.

Yup.  Thanks for looking into this.

Looking at w32.c, I see that it already uses Windows-specific system
calls to get file's attributes (thus in effect replacing `stat' from
the Windows runtime), but it puts the results into st_size, and
ignores the high portion of the file's size while at that:

  buf->st_size = wfd.nFileSizeLow;

(I suspect that this goes back to old days when file-attributes didn't
support file sizes in excess of EMACS_INT's size, so there was no
point in retaining the high 32 bits of the size.)

So it sounds like w32.c should be fixed, probably by defining an
Emacs's own `struct stat' replacement, where `st_size' is wide enough
to support 64-bit sizes.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]