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-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org