浏览代码

fix fgetwc when decoding a character that crosses buffer boundary

Update the buffer position according to the bytes consumed into st when
decoding an incomplete character at the end of the buffer.
Szabolcs Nagy 7 年之前
父节点
当前提交
72656157f5
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/stdio/fgetwc.c

+ 1 - 0
src/stdio/fgetwc.c

@@ -22,6 +22,7 @@ static wint_t __fgetwc_unlocked_internal(FILE *f)
 			f->rpos++;
 			return WEOF;
 		}
+		f->rpos = f->rend;
 	} else l = -2;
 
 	/* Convert character byte-by-byte */