You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/11/16 16:24:26 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #4828: lib/stdio: Handle 64bits off_t correctly

xiaoxiang781216 commented on a change in pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828#discussion_r750447606



##########
File path: libs/libc/stdio/lib_ftell.c
##########
@@ -22,101 +22,13 @@
  * Included Files
  ****************************************************************************/
 
-#include <nuttx/config.h>
-
-#include <sys/types.h>
 #include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include "libc.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lib_getoffset
- *
- * Description:
- *   It is insufficient to simply use the file offset; we must also account
- *   for the data offset in the any buffered data.  This function calculates
- *   that offset.
- *
- * Returned Value:
- *   The file position offset due to buffered data.
- *
- ****************************************************************************/
-
-#ifndef CONFIG_STDIO_DISABLE_BUFFERING
-static off_t lib_getoffset(FAR FILE *stream)
-{
-  off_t offset = 0;
-  lib_take_semaphore(stream);
-
-  if (stream->fs_bufstart !=
-      NULL && stream->fs_bufread !=
-      stream->fs_bufstart)
-    {
-#if CONFIG_NUNGET_CHARS > 0
-      offset = stream->fs_bufread - stream->fs_bufpos +
-                 stream->fs_nungotten;
-#else
-      offset = stream->fs_bufread - stream->fs_bufpos;
-#endif
-    }
-  else
-    {
-      offset = -(stream->fs_bufpos - stream->fs_bufstart);
-    }
-
-  lib_give_semaphore(stream);
-  return offset;
-}
-#else
-#  define lib_getoffset(stream) (0)
-#endif
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
-/****************************************************************************
- * Name: ftell
- *
- * Description:
- *   ftell() returns the current value of the file position indicator for the
- *   stream pointed to by stream.
- *
- * Returned Value:
- *   Zero on success; -1 on failure with errno set appropriately.
- *
- ****************************************************************************/
-

Review comment:
       Restore




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org