[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preview: portable dumper
From: |
Andy Moreton |
Subject: |
Re: Preview: portable dumper |
Date: |
Mon, 19 Feb 2018 22:23:17 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (windows-nt) |
On Sat 17 Feb 2018, Eli Zaretskii wrote:
> Since MAX_RW_COUNT is less than INT_MAX, we have no real problem here
> for MS-Windows, as 'nbyte' will never overflow an unsigned int. We
> could add an eassert there, for Windows only, though, to make this
> assumption explicit.
Comments mentioning MAX_RW_COUNT show that somebody checked an invariant
when writing the comment, but they do not guarantee that the invariant
will continue to be maintained in future versions of emacs. A check that
can be enforced by the compiler is preferable.
> As for pdumper, we could do one of 2 things:
>
> . make a reasonable assumption that no .pdmp file will ever be larger
> than 2GB, change the assertion there which checks against SSIZE_MAX
> to check against UINT_MAX instead, and work internally with
> unsigned int instead of size_t counts; or
This seems perfectly reasonable, and is the current implementation,
albeit checking for INT_MAX.
> . write a separate Windows-specific version of dump_read_all, which
> in the 64-bit build would limit to UINT_MAX the number of bytes we
> read on each iteration through the loop.
This offers more opportunity for divergent implementations, so the other
option is preferable.
> Daniel, which of these 2 alternatives do you prefer? Or does anyone
> have a better proposal? (I already considered rewriting the code in
> w32.c:sys_read so that it accepts a size_t last argument, and decided
> it was unjustified for this single caller, as all the other direct
> calls to 'read' in Emacs either use fixed small byte counts, or are
> not compiled in the Windows build.)
Is there a gnulib replacement for read() that works for emacs, so that
we could use the proper prototype even on Windows ? If so we could get
rid of sys_read etc.
AndyM
- Re: Preview: portable dumper, (continued)
- Re: Preview: portable dumper, andres . ramirez, 2018/02/15
- Re: Preview: portable dumper, Daniele Nicolodi, 2018/02/19
- Re: Preview: portable dumper, Angelo Graziosi, 2018/02/13
- Re: Preview: portable dumper, Angelo Graziosi, 2018/02/13
- Re: Preview: portable dumper, Daniel Colascione, 2018/02/14
- Re: Preview: portable dumper, Eli Zaretskii, 2018/02/14
- Re: Preview: portable dumper, Angelo Graziosi, 2018/02/16
- Re: Preview: portable dumper, Daniel Colascione, 2018/02/16
- Re: Preview: portable dumper, Eli Zaretskii, 2018/02/17
- Re: Preview: portable dumper,
Andy Moreton <=
- Re: Preview: portable dumper, Eli Zaretskii, 2018/02/19
- Re: Preview: portable dumper, Paul Eggert, 2018/02/20
- Re: Preview: portable dumper, Eli Zaretskii, 2018/02/16
- Re: Preview: portable dumper, Daniel Colascione, 2018/02/19
- Re: Preview: portable dumper, Andy Moreton, 2018/02/19
- Re: Preview: portable dumper, Daniel Colascione, 2018/02/19
- Re: Preview: portable dumper, Eli Zaretskii, 2018/02/19
- Re: Preview: portable dumper, Daniel Colascione, 2018/02/19
- Re: Preview: portable dumper, Angelo Graziosi, 2018/02/19
- Re: Preview: portable dumper, Angelo Graziosi, 2018/02/26