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/14 20:16:41 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #4828: lib/stdio: Handle 64bits off_t correctly

xiaoxiang781216 opened a new pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828


   ## Summary
   
   ## Impact
   Minor
   
   ## Testing
   Pass CI and ostest
   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
hartmannathan commented on a change in pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828#discussion_r750356184



##########
File path: libs/libc/stdio/lib_fseek.c
##########
@@ -22,66 +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"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
-/****************************************************************************
- * Name: fseek
- *
- * Description:
- *   The fseek() function sets the file position indicator for the stream
- *   pointed to by stream. The new position, measured in bytes, is obtained
- *   by adding offset bytes to the position specified by whence. If whence is
- *   set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the
- *   start of the file, the current position indicator, or end-of-file,
- *   respectively. A successful call to the fseek() function clears the
- *   end-of-file indicator for the stream and undoes any effects of the
- *   ungetc(3) function on the same stream.
- *
- * Returned Value:
- *   Zero on success; -1 on failure with errno set appropriately.
- *
- ****************************************************************************/
-

Review comment:
       Should really eliminate this docstring?

##########
File path: libs/libc/stdio/lib_fseeko.c
##########
@@ -22,13 +22,66 @@
  * 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"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: fseeko
+ *
+ * Description:
+ *   The fseeko() function sets the file position indicator for the stream
+ *   pointed to by stream. The new position, measured in bytes, is obtained
+ *   by adding offset bytes to the position specified by whence. If whence is
+ *   set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the
+ *   start of the file, the current position indicator, or end-of-file,
+ *   respectively. A successful call to the fseek() function clears the

Review comment:
       Should be "A successful call to the fseeko() function" -- fseek() -> fseeko()

##########
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:
       Why eliminate this docstring?




-- 
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



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

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828#discussion_r750447910



##########
File path: libs/libc/stdio/lib_fseek.c
##########
@@ -22,66 +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"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
-/****************************************************************************
- * Name: fseek
- *
- * Description:
- *   The fseek() function sets the file position indicator for the stream
- *   pointed to by stream. The new position, measured in bytes, is obtained
- *   by adding offset bytes to the position specified by whence. If whence is
- *   set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the
- *   start of the file, the current position indicator, or end-of-file,
- *   respectively. A successful call to the fseek() function clears the
- *   end-of-file indicator for the stream and undoes any effects of the
- *   ungetc(3) function on the same stream.
- *
- * Returned Value:
- *   Zero on success; -1 on failure with errno set appropriately.
- *
- ****************************************************************************/
-

Review comment:
       Restore

##########
File path: libs/libc/stdio/lib_fseeko.c
##########
@@ -22,13 +22,66 @@
  * 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"
 
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: fseeko
+ *
+ * Description:
+ *   The fseeko() function sets the file position indicator for the stream
+ *   pointed to by stream. The new position, measured in bytes, is obtained
+ *   by adding offset bytes to the position specified by whence. If whence is
+ *   set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the
+ *   start of the file, the current position indicator, or end-of-file,
+ *   respectively. A successful call to the fseek() function clears the

Review comment:
       Done.




-- 
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



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

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828#issuecomment-972914418


   @hartmannathan please merge this PR if there isn't more issue.


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
hartmannathan commented on pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828#issuecomment-972951243


   Done! Thanks


-- 
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



[GitHub] [incubator-nuttx] hartmannathan merged pull request #4828: lib/stdio: Handle 64bits off_t correctly

Posted by GitBox <gi...@apache.org>.
hartmannathan merged pull request #4828:
URL: https://github.com/apache/incubator-nuttx/pull/4828


   


-- 
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