emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 8553af8 2/3: Fix minor ssize_t / ptrdiff_t confusio


From: Paul Eggert
Subject: [Emacs-diffs] master 8553af8 2/3: Fix minor ssize_t / ptrdiff_t confusion
Date: Fri, 7 Jun 2019 19:49:04 -0400 (EDT)

branch: master
commit 8553af84db8b25918da8f5138dcc34601e3df47e
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix minor ssize_t / ptrdiff_t confusion
    
    * src/fileio.c (Fcopy_file): This limit is because of ssize_t,
    so use TYPE_MAXIMUM (ssize_t) not PTRDIFF_MAX.
---
 src/fileio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/fileio.c b/src/fileio.c
index f7376ce..b141f56 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2125,7 +2125,8 @@ permissions.  */)
          /* Copy at most COPY_MAX bytes at a time; this is min
             (PTRDIFF_MAX, SIZE_MAX) truncated to a value that is
             surely aligned well.  */
-         ptrdiff_t copy_max = min (PTRDIFF_MAX, SIZE_MAX) >> 30 << 30;
+         ssize_t ssize_max = TYPE_MAXIMUM (ssize_t);
+         ptrdiff_t copy_max = min (ssize_max, SIZE_MAX) >> 30 << 30;
          off_t intail = insize - newsize;
          ptrdiff_t len = min (intail, copy_max);
          copied = copy_file_range (ifd, NULL, ofd, NULL, len, 0);



reply via email to

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