HAL_ChibiOS: wrap sscanf and snprintf methods

This commit is contained in:
Siddharth Purohit 2018-09-19 01:34:35 +05:30 committed by Andrew Tridgell
parent 05539cd93b
commit 6622c9b8fd
3 changed files with 7 additions and 5 deletions

View File

@ -335,6 +335,6 @@ def build(bld):
bld.env.LIB += ['ch']
bld.env.LIBPATH += ['modules/ChibiOS/']
wraplist = ['strerror_r', 'fclose', 'freopen', 'fread', 'fprintf']
wraplist = ['strerror_r', 'fclose', 'freopen', 'fread', 'fprintf', 'sscanf', 'snprintf']
for w in wraplist:
bld.env.LINKFLAGS += ['-Wl,--wrap,%s' % w]

View File

@ -68,7 +68,7 @@ int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
return retval;
}
int snprintf(char *str, size_t size, const char *fmt, ...)
int __wrap_snprintf(char *str, size_t size, const char *fmt, ...)
{
#ifndef HAL_NO_PRINTF
va_list arg;
@ -165,7 +165,7 @@ scanf (const char *fmt, ...)
* sscanf(buf,fmt,va_alist)
*/
int
sscanf (const char *buf, const char *fmt, ...)
__wrap_sscanf (const char *buf, const char *fmt, ...)
{
int count;
va_list ap;

View File

@ -25,7 +25,8 @@ extern "C" {
#endif
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
int snprintf(char *str, size_t size, const char *fmt, ...);
int __wrap_snprintf(char *str, size_t size, const char *fmt, ...);
int snprintf(char *str, size_t size, const char *fmt, ...); //undefined, only used as a placeholder, its replaced by wrap method at link time
int vasprintf(char **strp, const char *fmt, va_list ap);
int asprintf(char **strp, const char *fmt, ...);
int vprintf(const char *fmt, va_list arg);
@ -35,7 +36,8 @@ int fscanf ( FILE * stream, const char * format, ... );
#endif
int scanf (const char *fmt, ...);
int sscanf (const char *buf, const char *fmt, ...);
int __wrap_sscanf (const char *buf, const char *fmt, ...);
int sscanf (const char *buf, const char *fmt, ...); //undefined, only used as a placeholder, its replaced by wrap method at link time
int vsscanf (const char *buf, const char *s, va_list ap);
void *malloc(size_t size);
void *calloc(size_t nmemb, size_t size);