Browse Source

Corrected sprintf() prototype & behaviour.

Johny Mattsson 8 years ago
parent
commit
9fd215b028
2 changed files with 5 additions and 3 deletions
  1. 4 2
      app/libc/c_stdio.c
  2. 1 1
      app/libc/c_stdio.h

+ 4 - 2
app/libc/c_stdio.c

@@ -1094,12 +1094,14 @@ exponent(char *p, int exp, int fmtch)
 #endif /* FLOATINGPT */
 
 
-void c_sprintf(char *s, char *fmt, ...)
+int c_sprintf(char *s, const char *fmt, ...)
 {
+    int n;
     va_list arg;
     va_start(arg, fmt);
-    vsprintf(s, fmt, arg);
+    n = vsprintf(s, fmt, arg);
     va_end(arg);
+    return n;
 }
 
 #endif

+ 1 - 1
app/libc/c_stdio.h

@@ -60,7 +60,7 @@ extern void output_redirect(const char *str);
 #define c_sprintf os_sprintf
 #else
 #include "c_stdarg.h"
-void c_sprintf(char* s,char *fmt, ...);
+int c_sprintf(char* s,const char *fmt, ...);
 #endif
 
 // #define c_vsprintf ets_vsprintf