> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 11:07:59 up 1:21, 1 user, load average: 0.35, 0.20, 0.12
This commit is contained in:
@ -47,13 +47,14 @@ int vsnprintf(char *out, size_t n, const char *fmt, va_list ap) {
|
||||
}
|
||||
|
||||
__attribute__((noinline))
|
||||
static int print_fmt(char **out, int n, const char** fmt, va_list ap) {
|
||||
static int print_fmt(char **out, int n, const char** fmt, va_list* ap) {
|
||||
int ret = 0;
|
||||
switch (**fmt) {
|
||||
case 'd':
|
||||
//
|
||||
(*fmt) ++;
|
||||
int num = va_arg(ap, int), i = 0;
|
||||
int num = va_arg(*ap, int);
|
||||
int i = 0;
|
||||
char buf[sizeof(num) * 3];
|
||||
if (num == 0) {
|
||||
buf[i++] = '0';
|
||||
@ -76,7 +77,7 @@ static int print_fmt(char **out, int n, const char** fmt, va_list ap) {
|
||||
break;
|
||||
case 's':
|
||||
(*fmt) ++;
|
||||
const char* str = va_arg(ap, const char*);
|
||||
const char* str = va_arg(*ap, const char*);
|
||||
int n = 999; // FIXME
|
||||
if (ret > n) break; // error buffer overflow
|
||||
for (; *str; str ++, (*out) ++ ) {
|
||||
@ -96,7 +97,7 @@ static int rvsnprintf(char* out, size_t n, const char* fmt, va_list ap) {
|
||||
if (*fmt == '%') {
|
||||
// FIXME
|
||||
fmt++;
|
||||
print_fmt(&out, 123, &fmt, ap);
|
||||
print_fmt(&out, 123, &fmt, &ap);
|
||||
continue;
|
||||
}
|
||||
*out = *fmt;
|
||||
|
Reference in New Issue
Block a user