diff options
Diffstat (limited to 'gl/ftello.c')
| -rw-r--r-- | gl/ftello.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gl/ftello.c b/gl/ftello.c index 64119aab..b0a20bf3 100644 --- a/gl/ftello.c +++ b/gl/ftello.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* An ftello() function that works around platform bugs. | 1 | /* An ftello() function that works around platform bugs. |
| 2 | Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <stdio.h> | 20 | #include <stdio.h> |
| 21 | 21 | ||
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include "intprops.h" | 23 | #include <stdckdint.h> |
| 24 | 24 | ||
| 25 | /* Get lseek. */ | 25 | /* Get lseek. */ |
| 26 | #include <unistd.h> | 26 | #include <unistd.h> |
| @@ -34,7 +34,10 @@ ftello (FILE *fp) | |||
| 34 | # undef ftell | 34 | # undef ftell |
| 35 | # define ftello ftell | 35 | # define ftello ftell |
| 36 | #endif | 36 | #endif |
| 37 | #if _GL_WINDOWS_64_BIT_OFF_T | 37 | #if (defined _WIN32 && !defined __CYGWIN__) \ |
| 38 | /* We need to test _FILE_OFFSET_BITS for mingw-w64 */ \ | ||
| 39 | /* and _GL_WINDOWS_64_BIT_OFF_T for MSVC. */ \ | ||
| 40 | && (_FILE_OFFSET_BITS == 64 || _GL_WINDOWS_64_BIT_OFF_T) | ||
| 38 | # undef ftello | 41 | # undef ftello |
| 39 | # if HAVE__FTELLI64 /* msvc, mingw64 */ | 42 | # if HAVE__FTELLI64 /* msvc, mingw64 */ |
| 40 | # define ftello _ftelli64 | 43 | # define ftello _ftelli64 |
| @@ -97,7 +100,7 @@ ftello (FILE *fp) | |||
| 97 | 100 | ||
| 98 | /* Compute pos + buffered, with overflow check. */ | 101 | /* Compute pos + buffered, with overflow check. */ |
| 99 | off_t sum; | 102 | off_t sum; |
| 100 | if (! INT_ADD_OK (pos, buffered, &sum)) | 103 | if (ckd_add (&sum, pos, buffered)) |
| 101 | { | 104 | { |
| 102 | errno = EOVERFLOW; | 105 | errno = EOVERFLOW; |
| 103 | return -1; | 106 | return -1; |
