mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Various changes and bigfixes for problems detected by CppCheck
This commit is contained in:
@@ -130,7 +130,8 @@ int avsprintf(FAR char **ptr, const char *fmt, va_list ap)
|
||||
|
||||
/* Then let lib_vsprintf do it's real thing */
|
||||
|
||||
nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, fmt, ap);
|
||||
nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
|
||||
fmt, ap);
|
||||
|
||||
/* Return a pointer to the string to the caller. NOTE: the memstream put()
|
||||
* method has already added the NUL terminator to the end of the string (not
|
||||
|
||||
@@ -1526,7 +1526,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const char *src, va_list a
|
||||
|
||||
/* Get the width of the output */
|
||||
|
||||
luwidth = getpsize(FMT_CHAR, flags, p);
|
||||
pwidth = getpsize(FMT_CHAR, flags, p);
|
||||
|
||||
/* Perform left field justification actions */
|
||||
|
||||
|
||||
@@ -93,7 +93,8 @@ int snprintf(FAR char *buf, size_t size, const char *format, ...)
|
||||
/* Then let lib_vsprintf do the real work */
|
||||
|
||||
va_start(ap, format);
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, format, ap);
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
|
||||
format, ap);
|
||||
va_end(ap);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -84,12 +84,14 @@ int sprintf (FAR char *buf, const char *fmt, ...)
|
||||
|
||||
/* Initialize a memory stream to write to the buffer */
|
||||
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, buf, LIB_BUFLEN_UNKNOWN);
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, buf,
|
||||
LIB_BUFLEN_UNKNOWN);
|
||||
|
||||
/* Then let lib_vsprintf do the real work */
|
||||
|
||||
va_start(ap, fmt);
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, fmt, ap);
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
|
||||
fmt, ap);
|
||||
va_end(ap);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -87,10 +87,12 @@ int vsnprintf(FAR char *buf, size_t size, const char *format, va_list ap)
|
||||
|
||||
/* Initialize a memory stream to write to the buffer */
|
||||
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, buf, size);
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream,
|
||||
buf, size);
|
||||
|
||||
/* Then let lib_vsprintf do the real work */
|
||||
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, format, ap);
|
||||
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
|
||||
format, ap);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ int vsprintf(FAR char *dest, const char *src, va_list ap)
|
||||
* libc/stdio/lib_vsprintf do the work.
|
||||
*/
|
||||
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, dest, LIB_BUFLEN_UNKNOWN);
|
||||
return lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, src, ap);
|
||||
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, dest,
|
||||
LIB_BUFLEN_UNKNOWN);
|
||||
return lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public,
|
||||
src, ap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user