mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 19:30:29 +00:00
vcscanf: change buf type to unsigned char *
The data it points to will be accessed directly. Also remove casts which are now unnecessary.
This commit is contained in:
parent
64c883a320
commit
3403b6c604
1 changed files with 4 additions and 4 deletions
|
@ -60,7 +60,7 @@ int __vcscanf(int callback(void *), //
|
||||||
struct FreeMe *next;
|
struct FreeMe *next;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
} *freeme = NULL;
|
} *freeme = NULL;
|
||||||
void *buf = NULL;
|
unsigned char *buf = NULL;
|
||||||
size_t bufsize;
|
size_t bufsize;
|
||||||
const unsigned char *p = (const unsigned char *)fmt;
|
const unsigned char *p = (const unsigned char *)fmt;
|
||||||
int *n_ptr;
|
int *n_ptr;
|
||||||
|
@ -321,7 +321,7 @@ int __vcscanf(int callback(void *), //
|
||||||
}
|
}
|
||||||
if (c != -1 && j + !rawmode < bufsize && (rawmode || !isspace(c))) {
|
if (c != -1 && j + !rawmode < bufsize && (rawmode || !isspace(c))) {
|
||||||
if (charbytes == 1) {
|
if (charbytes == 1) {
|
||||||
((unsigned char *)buf)[j++] = (unsigned char)c;
|
buf[j++] = (unsigned char)c;
|
||||||
c = READ;
|
c = READ;
|
||||||
} else if (tpdecodecb((wint_t *)&c, c, (void *)callback, arg) !=
|
} else if (tpdecodecb((wint_t *)&c, c, (void *)callback, arg) !=
|
||||||
-1) {
|
-1) {
|
||||||
|
@ -343,7 +343,7 @@ int __vcscanf(int callback(void *), //
|
||||||
goto Done;
|
goto Done;
|
||||||
} else if (!rawmode && j < bufsize) {
|
} else if (!rawmode && j < bufsize) {
|
||||||
if (charbytes == sizeof(char)) {
|
if (charbytes == sizeof(char)) {
|
||||||
((unsigned char *)buf)[j] = '\0';
|
buf[j] = '\0';
|
||||||
} else if (charbytes == sizeof(char16_t)) {
|
} else if (charbytes == sizeof(char16_t)) {
|
||||||
((char16_t *)buf)[j] = u'\0';
|
((char16_t *)buf)[j] = u'\0';
|
||||||
} else if (charbytes == sizeof(wchar_t)) {
|
} else if (charbytes == sizeof(wchar_t)) {
|
||||||
|
@ -355,7 +355,7 @@ int __vcscanf(int callback(void *), //
|
||||||
}
|
}
|
||||||
++items;
|
++items;
|
||||||
if (ismalloc) {
|
if (ismalloc) {
|
||||||
*va_arg(va, char **) = buf;
|
*va_arg(va, char **) = (void *) buf;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue