public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] newlib: ftello{64}: Fix type of returned value
Date: Mon, 18 Dec 2017 19:18:00 -0000	[thread overview]
Message-ID: <20171218191821.82595.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=dc2d175721df8ceb801d50581df95b49c26a6ff7

commit dc2d175721df8ceb801d50581df95b49c26a6ff7
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Dec 18 20:15:27 2017 +0100

    newlib: ftello{64}: Fix type of returned value
    
    Especially don't just use -1L since _off_t/_off64_t are not
    guaranteed to be of type long.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/stdio/ftello.c     | 8 ++++----
 newlib/libc/stdio64/ftello64.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c
index c120c26..0a9bb7b 100644
--- a/newlib/libc/stdio/ftello.c
+++ b/newlib/libc/stdio/ftello.c
@@ -99,7 +99,7 @@ _DEFUN(_ftello_r, (ptr, fp),
     {
       ptr->_errno = ESPIPE;
       _newlib_flockfile_exit (fp);
-      return -1L;
+      return (_off_t) -1;
     }
 
   /* Find offset of underlying I/O object, then adjust for buffered
@@ -113,10 +113,10 @@ _DEFUN(_ftello_r, (ptr, fp),
   else
     {
       pos = fp->_seek (ptr, fp->_cookie, (_fpos_t) 0, SEEK_CUR);
-      if (pos == -1L)
+      if (pos == (_fpos_t) -1)
         {
           _newlib_flockfile_exit (fp);
-          return pos;
+          return (_off_t) -1;
         }
     }
   if (fp->_flags & __SRD)
@@ -141,7 +141,7 @@ _DEFUN(_ftello_r, (ptr, fp),
     }
 
   _newlib_flockfile_end (fp);
-  return pos;
+  return (_off_t) pos;
 }
 
 #ifndef _REENT_ONLY
diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c
index c6226d1..9aca231 100644
--- a/newlib/libc/stdio64/ftello64.c
+++ b/newlib/libc/stdio64/ftello64.c
@@ -96,7 +96,7 @@ _DEFUN (_ftello64_r, (ptr, fp),
     {
       ptr->_errno = ESPIPE;
       _newlib_flockfile_exit(fp);
-      return -1L;
+      return (_off64_t) -1;
     }
 
   /* Find offset of underlying I/O object, then adjust for buffered
@@ -110,10 +110,10 @@ _DEFUN (_ftello64_r, (ptr, fp),
   else
     {
       pos = fp->_seek64 (ptr, fp->_cookie, (_fpos64_t) 0, SEEK_CUR);
-      if (pos == -1L)
+      if (pos == (_fpos64_t) -1)
         {
           _newlib_flockfile_exit(fp);
-          return pos;
+          return (_off64_t) pos;
         }
     }
   if (fp->_flags & __SRD)
@@ -138,7 +138,7 @@ _DEFUN (_ftello64_r, (ptr, fp),
     }
 
   _newlib_flockfile_end(fp);
-  return pos;
+  return (_off64_t) pos;
 }
 
 #ifndef _REENT_ONLY


                 reply	other threads:[~2017-12-18 19:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218191821.82595.qmail@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).