format() (and its alias vuprintf) return values are uncheck -> void
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28119 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cc6ef19dd9
commit
5a98ad2d7f
3 changed files with 8 additions and 12 deletions
|
@ -29,7 +29,7 @@
|
|||
|
||||
static const char hexdigit[] = "0123456789ABCDEF";
|
||||
|
||||
int format(
|
||||
void format(
|
||||
/* call 'push()' for each output letter */
|
||||
int (*push)(void *userp, unsigned char data),
|
||||
void *userp,
|
||||
|
@ -220,7 +220,6 @@ int format(
|
|||
else
|
||||
ok=push(userp, ch);
|
||||
}
|
||||
return ok; /* true means good */
|
||||
}
|
||||
|
||||
struct for_fprintf {
|
||||
|
@ -244,7 +243,6 @@ static int fprfunc(void *pr, unsigned char letter)
|
|||
|
||||
int fdprintf(int fd, const char *fmt, ...)
|
||||
{
|
||||
bool ok;
|
||||
va_list ap;
|
||||
struct for_fprintf fpr;
|
||||
|
||||
|
@ -252,13 +250,13 @@ int fdprintf(int fd, const char *fmt, ...)
|
|||
fpr.bytes=0;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ok = format(fprfunc, &fpr, fmt, ap);
|
||||
format(fprfunc, &fpr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return fpr.bytes; /* return 0 on error */
|
||||
}
|
||||
|
||||
int vuprintf(int (*push)(void *userp, unsigned char data), void *userp, const char *fmt, va_list ap)
|
||||
void vuprintf(int (*push)(void *userp, unsigned char data), void *userp, const char *fmt, va_list ap)
|
||||
{
|
||||
return format(push, userp, fmt, ap);
|
||||
format(push, userp, fmt, ap);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __FORMAT_H__
|
||||
#define __FORMAT_H__
|
||||
|
||||
int format(
|
||||
void format(
|
||||
/* call 'push()' for each output letter */
|
||||
int (*push)(void *userp, unsigned char data),
|
||||
void *userp,
|
||||
|
@ -31,7 +31,7 @@ int format(
|
|||
|
||||
/* callback function is called for every output character (byte) with userp and
|
||||
* should return 0 when ch is a char other than '\0' that should stop printing */
|
||||
int vuprintf(int (*push)(void *userp, unsigned char data),
|
||||
void vuprintf(int (*push)(void *userp, unsigned char data),
|
||||
void *userp, const char *fmt, va_list ap);
|
||||
|
||||
#endif /* __FORMAT_H__ */
|
||||
|
|
|
@ -57,7 +57,6 @@ static int sprfunc(void *ptr, unsigned char letter)
|
|||
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
{
|
||||
bool ok;
|
||||
va_list ap;
|
||||
struct for_snprintf pr;
|
||||
|
||||
|
@ -66,7 +65,7 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
|
|||
pr.max = size;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ok = format(sprfunc, &pr, fmt, ap);
|
||||
format(sprfunc, &pr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
/* make sure it ends with a trailing zero */
|
||||
|
@ -77,14 +76,13 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
|
|||
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
|
||||
{
|
||||
bool ok;
|
||||
struct for_snprintf pr;
|
||||
|
||||
pr.ptr = (unsigned char *)buf;
|
||||
pr.bytes = 0;
|
||||
pr.max = size;
|
||||
|
||||
ok = format(sprfunc, &pr, fmt, ap);
|
||||
format(sprfunc, &pr, fmt, ap);
|
||||
|
||||
/* make sure it ends with a trailing zero */
|
||||
pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0';
|
||||
|
|
Loading…
Reference in a new issue