emacs-devel
[Top][All Lists]
Advanced

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

Re: Preview: portable dumper


From: Daniel Colascione
Subject: Re: Preview: portable dumper
Date: Mon, 19 Feb 2018 12:16:03 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 02/19/2018 12:03 PM, Andy Moreton wrote:
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.

Is the return value int too? Or is it a ssize_t that can hold UINT_MAX? If the former, agreed.



reply via email to

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