mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
Fix pointer assignment errors
Without this patch, the following error is emitted when compiling with the latest LLVM/Clang 8.x: ```text src/stdio/vfwscanf.c:218:9: error: assigning to 'const wchar_t *' (aka 'const unsigned int *') from 'int [1]' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] set = L""; ^ ~~~ 1 error generated. ```
This commit is contained in:
parent
edeb5004e6
commit
ec3ddd809f
@ -215,7 +215,8 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
|
|||||||
if (t == 'c') {
|
if (t == 'c') {
|
||||||
if (width<1) width = 1;
|
if (width<1) width = 1;
|
||||||
invert = 1;
|
invert = 1;
|
||||||
set = L"";
|
static const wchar_t empty[] = { 0 };
|
||||||
|
set = empty;
|
||||||
} else if (t == 's') {
|
} else if (t == 's') {
|
||||||
invert = 1;
|
invert = 1;
|
||||||
static const wchar_t spaces[] = {
|
static const wchar_t spaces[] = {
|
||||||
|
@ -12,8 +12,9 @@ static size_t do_read(FILE *f, unsigned char *buf, size_t len)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const wchar_t *wcs = f->cookie;
|
const wchar_t *wcs = f->cookie;
|
||||||
|
static const wchar_t strudel[] = { '@', 0 };
|
||||||
|
|
||||||
if (!wcs[0]) wcs=L"@";
|
if (!wcs[0]) wcs=strudel;
|
||||||
for (i=0; i<f->buf_size && wcs[i]; i++)
|
for (i=0; i<f->buf_size && wcs[i]; i++)
|
||||||
f->buf[i] = wcs[i] < 128 ? wcs[i] : '@';
|
f->buf[i] = wcs[i] < 128 ? wcs[i] : '@';
|
||||||
f->rpos = f->buf;
|
f->rpos = f->buf;
|
||||||
|
@ -14,8 +14,9 @@ static size_t do_read(FILE *f, unsigned char *buf, size_t len)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
const wchar_t *wcs = f->cookie;
|
const wchar_t *wcs = f->cookie;
|
||||||
|
static const wchar_t strudel[] = { '@', 0 };
|
||||||
|
|
||||||
if (!wcs[0]) wcs=L"@";
|
if (!wcs[0]) wcs=strudel;
|
||||||
for (i=0; i<f->buf_size && wcs[i]; i++)
|
for (i=0; i<f->buf_size && wcs[i]; i++)
|
||||||
f->buf[i] = wcs[i] < 128 ? wcs[i] : '@';
|
f->buf[i] = wcs[i] < 128 ? wcs[i] : '@';
|
||||||
f->rpos = f->buf;
|
f->rpos = f->buf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user