Commit 124e8b60 authored by ylavic's avatar ylavic

Possibly std::ios::binary helps with streams on Windows

parent 2498c577
...@@ -489,7 +489,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_FileReadStream_Unbuffered ...@@ -489,7 +489,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_FileReadStream_Unbuffered
TEST_F(RapidJson, IStreamWrapper) { TEST_F(RapidJson, IStreamWrapper) {
for (size_t i = 0; i < kTrialCount; i++) { for (size_t i = 0; i < kTrialCount; i++) {
std::ifstream is(filename_); std::ifstream is(filename_, std::ios::in | std::ios::binary);
char buffer[65536]; char buffer[65536];
IStreamWrapper isw(is, buffer, sizeof(buffer)); IStreamWrapper isw(is, buffer, sizeof(buffer));
while (isw.Take() != '\0') while (isw.Take() != '\0')
...@@ -500,7 +500,7 @@ TEST_F(RapidJson, IStreamWrapper) { ...@@ -500,7 +500,7 @@ TEST_F(RapidJson, IStreamWrapper) {
TEST_F(RapidJson, IStreamWrapper_Unbuffered) { TEST_F(RapidJson, IStreamWrapper_Unbuffered) {
for (size_t i = 0; i < kTrialCount; i++) { for (size_t i = 0; i < kTrialCount; i++) {
std::ifstream is(filename_); std::ifstream is(filename_, std::ios::in | std::ios::binary);
IStreamWrapper isw(is); IStreamWrapper isw(is);
while (isw.Take() != '\0') while (isw.Take() != '\0')
; ;
...@@ -513,7 +513,7 @@ TEST_F(RapidJson, IStreamWrapper_Setbuffered) { ...@@ -513,7 +513,7 @@ TEST_F(RapidJson, IStreamWrapper_Setbuffered) {
std::ifstream is; std::ifstream is;
char buffer[65536]; char buffer[65536];
is.rdbuf()->pubsetbuf(buffer, sizeof(buffer)); is.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
is.open(filename_); is.open(filename_, std::ios::in | std::ios::binary);
IStreamWrapper isw(is); IStreamWrapper isw(is);
while (isw.Take() != '\0') while (isw.Take() != '\0')
; ;
...@@ -523,7 +523,7 @@ TEST_F(RapidJson, IStreamWrapper_Setbuffered) { ...@@ -523,7 +523,7 @@ TEST_F(RapidJson, IStreamWrapper_Setbuffered) {
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper)) { TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper)) {
for (size_t i = 0; i < kTrialCount; i++) { for (size_t i = 0; i < kTrialCount; i++) {
std::ifstream is(filename_); std::ifstream is(filename_, std::ios::in | std::ios::binary);
char buffer[65536]; char buffer[65536];
IStreamWrapper isw(is, buffer, sizeof(buffer)); IStreamWrapper isw(is, buffer, sizeof(buffer));
BaseReaderHandler<> h; BaseReaderHandler<> h;
...@@ -535,7 +535,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper)) { ...@@ -535,7 +535,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper)) {
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Unbuffered)) { TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Unbuffered)) {
for (size_t i = 0; i < kTrialCount; i++) { for (size_t i = 0; i < kTrialCount; i++) {
std::ifstream is(filename_); std::ifstream is(filename_, std::ios::in | std::ios::binary);
IStreamWrapper isw(is); IStreamWrapper isw(is);
BaseReaderHandler<> h; BaseReaderHandler<> h;
Reader reader; Reader reader;
...@@ -549,7 +549,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Setbuffere ...@@ -549,7 +549,7 @@ TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Setbuffere
std::ifstream is; std::ifstream is;
char buffer[65536]; char buffer[65536];
is.rdbuf()->pubsetbuf(buffer, sizeof(buffer)); is.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
is.open(filename_); is.open(filename_, std::ios::in | std::ios::binary);
IStreamWrapper isw(is); IStreamWrapper isw(is);
BaseReaderHandler<> h; BaseReaderHandler<> h;
Reader reader; Reader reader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment