mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-28 04:23:38 +01:00
stdio: fix bypassed __scanf_end at end of scanf
This commit is contained in:
parent
0cef8ca891
commit
be4c2b8d33
7 changed files with 18 additions and 9 deletions
|
@ -10,7 +10,9 @@ int fscanf(FILE * restrict fp, char const * restrict fmt, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
|
__scanf_start(&in);
|
||||||
int count = __scanf(&in, fmt, &args);
|
int count = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -10,7 +10,9 @@ int scanf(char const * restrict fmt, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
|
__scanf_start(&in);
|
||||||
int count = __scanf(&in, fmt, &args);
|
int count = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -231,10 +231,6 @@ int __scanf(
|
||||||
/* Number of successful assignments */
|
/* Number of successful assignments */
|
||||||
int validrets = 0;
|
int validrets = 0;
|
||||||
|
|
||||||
__scanf_start( in );
|
|
||||||
|
|
||||||
// TODO: No __scanf_end() in any of the "return validrets"!!
|
|
||||||
|
|
||||||
for(int pos = 0; format[pos]; pos++) {
|
for(int pos = 0; format[pos]; pos++) {
|
||||||
if(format[pos] == ' ') {
|
if(format[pos] == ' ') {
|
||||||
__skip_spaces(in);
|
__skip_spaces(in);
|
||||||
|
@ -366,6 +362,5 @@ int __scanf(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__scanf_end( in );
|
|
||||||
return validrets;
|
return validrets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
int sscanf(const char * restrict str, char const * restrict fmt, ...)
|
int sscanf(const char * restrict str, char const * restrict fmt, ...)
|
||||||
{
|
{
|
||||||
/* This is valid even if str=NULL. */
|
|
||||||
struct __scanf_input in = {
|
struct __scanf_input in = {
|
||||||
.str = str,
|
.str = str,
|
||||||
};
|
};
|
||||||
|
@ -11,7 +10,9 @@ int sscanf(const char * restrict str, char const * restrict fmt, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|
||||||
|
__scanf_start(&in);
|
||||||
int count = __scanf(&in, fmt, &args);
|
int count = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -7,5 +7,8 @@ int vfscanf(FILE * restrict fp, char const * restrict fmt, va_list args)
|
||||||
.fp = fp,
|
.fp = fp,
|
||||||
};
|
};
|
||||||
|
|
||||||
return __scanf(&in, fmt, &args);
|
__scanf_start(&in);
|
||||||
|
int rc = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,8 @@ int vscanf(char const * restrict fmt, va_list args)
|
||||||
.fp = stdin,
|
.fp = stdin,
|
||||||
};
|
};
|
||||||
|
|
||||||
return __scanf(&in, fmt, &args);
|
__scanf_start(&in);
|
||||||
|
int rc = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,8 @@ int vsscanf(const char * restrict str, char const * restrict fmt, va_list args)
|
||||||
.str = str,
|
.str = str,
|
||||||
};
|
};
|
||||||
|
|
||||||
return __scanf(&in, fmt, &args);
|
__scanf_start(&in);
|
||||||
|
int rc = __scanf(&in, fmt, &args);
|
||||||
|
__scanf_end(&in);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue