summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/fgetwc.c2
-rw-r--r--src/stdio/fputwc.c2
-rw-r--r--src/stdio/fputws.c2
-rw-r--r--src/stdio/ungetwc.c2
-rw-r--r--src/stdio/vfwprintf.c2
-rw-r--r--src/stdio/vfwscanf.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/stdio/fgetwc.c b/src/stdio/fgetwc.c
index 8626d54c..b261b44f 100644
--- a/src/stdio/fgetwc.c
+++ b/src/stdio/fgetwc.c
@@ -10,7 +10,7 @@ wint_t __fgetwc_unlocked(FILE *f)
unsigned char b;
size_t l;
- f->mode |= f->mode+1;
+ if (f->mode <= 0) fwide(f, 1);
/* Convert character from buffer if possible */
if (f->rpos < f->rend) {
diff --git a/src/stdio/fputwc.c b/src/stdio/fputwc.c
index 7b621dd2..1bf165bf 100644
--- a/src/stdio/fputwc.c
+++ b/src/stdio/fputwc.c
@@ -8,7 +8,7 @@ wint_t __fputwc_unlocked(wchar_t c, FILE *f)
char mbc[MB_LEN_MAX];
int l;
- f->mode |= f->mode+1;
+ if (f->mode <= 0) fwide(f, 1);
if (isascii(c)) {
c = putc_unlocked(c, f);
diff --git a/src/stdio/fputws.c b/src/stdio/fputws.c
index 5723cbcd..317d65f1 100644
--- a/src/stdio/fputws.c
+++ b/src/stdio/fputws.c
@@ -8,7 +8,7 @@ int fputws(const wchar_t *restrict ws, FILE *restrict f)
FLOCK(f);
- f->mode |= f->mode+1;
+ fwide(f, 1);
while (ws && (l = wcsrtombs((void *)buf, (void*)&ws, sizeof buf, 0))+1 > 1)
if (__fwritex(buf, l, f) < l) {
diff --git a/src/stdio/ungetwc.c b/src/stdio/ungetwc.c
index 394f92ac..d4c7de39 100644
--- a/src/stdio/ungetwc.c
+++ b/src/stdio/ungetwc.c
@@ -11,7 +11,7 @@ wint_t ungetwc(wint_t c, FILE *f)
FLOCK(f);
- f->mode |= f->mode+1;
+ if (f->mode <= 0) fwide(f, 1);
if (!f->rpos) __toread(f);
if (!f->rpos || f->rpos < f->buf - UNGET + l || c == WEOF ||
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index deff9828..f06d5aed 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -359,7 +359,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
}
FLOCK(f);
- f->mode |= f->mode+1;
+ fwide(f, 1);
olderr = f->flags & F_ERR;
f->flags &= ~F_ERR;
ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c
index ac5c2c24..223aad4f 100644
--- a/src/stdio/vfwscanf.c
+++ b/src/stdio/vfwscanf.c
@@ -104,7 +104,7 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
FLOCK(f);
- f->mode |= f->mode+1;
+ fwide(f, 1);
for (p=fmt; *p; p++) {