mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Minor fixes to lib_fgets() typing
This commit is contained in:
+11
-1
@@ -69,7 +69,17 @@
|
||||
|
||||
char *fgets(FAR char *buf, int buflen, FILE *stream)
|
||||
{
|
||||
/* Handle negative buffer size */
|
||||
|
||||
if (buflen < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Let lib_fgets() do the heavy lifting */
|
||||
|
||||
return lib_fgets(buf, buflen, stream, true, false);
|
||||
else
|
||||
{
|
||||
return lib_fgets(buf, (size_t)buflen, stream, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,5 +73,5 @@ FAR char *gets(FAR char *s)
|
||||
{
|
||||
/* Let lib_fgets() do the heavy lifting */
|
||||
|
||||
return lib_fgets(s, RSIZE_MAX, stdin, false, false);
|
||||
return lib_fgets(s, (size_t)INT_MAX, stdin, false, false);
|
||||
}
|
||||
|
||||
@@ -92,5 +92,5 @@ FAR char *gets_s(FAR char *s, rsize_t n)
|
||||
|
||||
/* Then let lib_fgets() do the heavy lifting */
|
||||
|
||||
return lib_fgets(s, n, stdin, false, true);
|
||||
return lib_fgets(s, (size_t)n, stdin, false, true);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ static void consume_eol(FILE *stream, bool consume)
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
FAR char *lib_fgets(FAR char *buf, int buflen, FILE *stream,
|
||||
FAR char *lib_fgets(FAR char *buf, size_t buflen, FILE *stream,
|
||||
bool keepnl, bool consume)
|
||||
{
|
||||
int nch = 0;
|
||||
|
||||
Reference in New Issue
Block a user