emacs-devel
[Top][All Lists]
Advanced

[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 20:03:09 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Mon 19 Feb 2018, Daniel Colascione wrote:

> On 02/13/2018 02:28 PM, Angelo Graziosi wrote:
>>
>>> Il 13 febbraio 2018 alle 23.06 Angelo Graziosi <address@hidden> ha scritto:
>>>
>>>
>
>>> Eli Zaretskii wrote:
>>>>
>>>> I'd urge people to try this branch and report any issues they see.
>>>
>>> What should we look for?
>>>
>>
>> Meanwhile... here the build fails (MSYS2/MinGW64):
>>
>> [...]
>> pdumper.c: In function 'dump_read_all':
>> pdumper.c:4723:45: error: conversion to 'unsigned int' from 'size_t {aka 
>> long long unsigned int}' may alter its value [-Werror=conversion]
>>           read (fd, (char*) buf + bytes_read, bytes_to_read - bytes_read);
>>                                               ^~~~~~~~~~~~~
>>    CC       data.o
>> cc1.exe: some warnings being treated as errors
>> ...
>
> Should be fixed.

The patch for this in commit b7da1a5af8f1 is not quite right:

+      /* Some platforms accept only int-sized values to read.  */
+      unsigned chunk_to_read = UINT_MAX;
+      if (bytes_to_read - bytes_read < chunk_to_read)
+        chunk_to_read = (unsigned)(bytes_to_read - bytes_read);

Windows platforms use sys_read from w32.c:
    int sys_read(int fd, char *buffer, unsigned int count);

The limit for a chunk should be INT_MAX (not UINT_MAX) so that it
is representable in the (signed) return value.

    AndyM




reply via email to

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