浏览代码

fix failure of wide printf/scanf functions to set wide orientation

in some cases, these functions internally call a byte-based input or
output function before calling getwc/putwc, so they cannot rely on the
latter to set the orientation.

(cherry picked from commit 984c25b74da085c6ae6b44a87bbd5f8afc9be331)
Rich Felker 10 年之前
父节点
当前提交
7bbf7c1254
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. 1 0
      src/stdio/vfwprintf.c
  2. 2 0
      src/stdio/vfwscanf.c

+ 1 - 0
src/stdio/vfwprintf.c

@@ -355,6 +355,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 	}
 	}
 
 
 	FLOCK(f);
 	FLOCK(f);
+	f->mode |= f->mode+1;
 	ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
 	ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
 	FUNLOCK(f);
 	FUNLOCK(f);
 	va_end(ap2);
 	va_end(ap2);

+ 2 - 0
src/stdio/vfwscanf.c

@@ -104,6 +104,8 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
 
 
 	FLOCK(f);
 	FLOCK(f);
 
 
+	f->mode |= f->mode+1;
+
 	for (p=fmt; *p; p++) {
 	for (p=fmt; *p; p++) {
 
 
 		alloc = 0;
 		alloc = 0;