Minor fixes to lib_fgets() typing
This commit is contained in:
parent
0bdee120a1
commit
a0808e7b6d
@ -186,7 +186,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream);
|
||||
|
||||
/* Defined in lib_libfgets.c */
|
||||
|
||||
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);
|
||||
|
||||
/* Defined in lib_libfflush.c */
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user