Fix issues detected by clang

This commit is contained in:
Paul A. Patience
2015-09-10 20:59:43 -04:00
parent ed0d480d3e
commit 9f108b7b63
6 changed files with 17 additions and 13 deletions
+7 -1
View File
@@ -94,7 +94,13 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream)
/* Make sure that writing to this stream is allowed */
if (!stream || (stream->fs_oflags & O_WROK) == 0)
if (stream == NULL)
{
set_errno(EBADF);
return ret;
}
if ((stream->fs_oflags & O_WROK) == 0)
{
set_errno(EBADF);
goto errout;
+3 -3
View File
@@ -112,7 +112,7 @@
*
****************************************************************************/
int vasprintf(FAR char **ptr, const char *fmt, va_list ap)
int vasprintf(FAR char **ptr, FAR const char *fmt, va_list ap)
{
struct lib_outstream_s nulloutstream;
struct lib_memoutstream_s memoutstream;
@@ -130,12 +130,12 @@ int vasprintf(FAR char **ptr, const char *fmt, va_list ap)
va_copy(ap2, ap);
#endif
/* First, use a nullstream to get the size of the buffer. The number
/* First, use a nullstream to get the size of the buffer. The number
* of bytes returned may or may not include the null terminator.
*/
lib_nulloutstream(&nulloutstream);
nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&nulloutstream, fmt, ap1);
(void)lib_vsprintf((FAR struct lib_outstream_s *)&nulloutstream, fmt, ap1);
/* Then allocate a buffer to hold that number of characters, adding one
* for the null terminator.