Various changes and bigfixes for problems detected by CppCheck

This commit is contained in:
Gregory Nutt
2013-05-09 14:23:34 -06:00
parent c9fcc7eef4
commit 88c0911fb1
25 changed files with 126 additions and 69 deletions
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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 */
+2 -1
View File
@@ -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;
}
+4 -2
View File
@@ -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;
}
+4 -2
View File
@@ -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;
}
+4 -2
View File
@@ -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);
}