mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
some workarounds for a potential libc++ bug
This commit is contained in:
@@ -61,7 +61,26 @@ public:
|
||||
throw processor::exception("Message payload was too large.",processor::error::MESSAGE_TOO_BIG);
|
||||
}
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
i = 0;
|
||||
while(input.good() && i < size) {
|
||||
c = input.get();
|
||||
|
||||
if (input.good()) {
|
||||
if (m_masking_index >= 0) {
|
||||
c = c ^ m_masking_key[(m_masking_index++)%4];
|
||||
}
|
||||
|
||||
m_payload.push_back(c);
|
||||
i++;
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
throw processor::exception("istream read error 2",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/*for (i = 0; i < size; ++i) {
|
||||
if (input.good()) {
|
||||
c = input.get();
|
||||
|
||||
@@ -81,7 +100,7 @@ public:
|
||||
} else {
|
||||
throw processor::exception("istream read error",processor::error::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// successfully read all bytes
|
||||
return i;
|
||||
|
||||
@@ -62,23 +62,44 @@ uint64_t data::process_payload(std::istream& input,uint64_t size) {
|
||||
));
|
||||
}
|
||||
|
||||
for (i = 0; i < size; ++i) {
|
||||
// extract characters until size have been extracted or eof. return num ext
|
||||
i = 0;
|
||||
while(input.good() && i < size) {
|
||||
c = input.get();
|
||||
|
||||
if (input.good()) {
|
||||
c = input.get();
|
||||
|
||||
if (input.fail()) {
|
||||
throw processor::exception("istream read error",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
process_character(c);
|
||||
i++;
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
throw processor::exception("istream read error",
|
||||
throw processor::exception("istream read error 2",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/*for (i = 0; i < size; ++i) {
|
||||
if (input.good()) {
|
||||
c = input.get();
|
||||
process_character(c);
|
||||
|
||||
if (input.eof()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input.fail()) {
|
||||
throw processor::exception("istream read error 1",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
|
||||
} else if (input.eof()) {
|
||||
break;
|
||||
} else {
|
||||
throw processor::exception("istream read error 2",
|
||||
processor::error::FATAL_ERROR);
|
||||
}
|
||||
}*/
|
||||
|
||||
// successfully read all bytes
|
||||
return i;
|
||||
}
|
||||
@@ -138,7 +159,7 @@ void data::set_prepared(bool b) {
|
||||
}
|
||||
|
||||
bool data::get_prepared() const {
|
||||
return m_prepared;
|
||||
return m_prepared;
|
||||
}
|
||||
|
||||
// This could be further optimized using methods that write directly into the
|
||||
|
||||
Reference in New Issue
Block a user