|
@@ -24,7 +24,7 @@
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
*/
|
|
|
|
|
|
-#include <AK/BufferStream.h>
|
|
|
+#include <AK/MemoryStream.h>
|
|
|
#include <AK/URL.h>
|
|
|
#include <LibIPC/Decoder.h>
|
|
|
#include <LibIPC/Dictionary.h>
|
|
@@ -34,68 +34,68 @@ namespace IPC {
|
|
|
bool Decoder::decode(bool& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(u8& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(u16& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(u32& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(u64& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(i8& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(i16& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(i32& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(i64& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(float& value)
|
|
|
{
|
|
|
m_stream >> value;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(String& value)
|
|
|
{
|
|
|
i32 length = 0;
|
|
|
m_stream >> length;
|
|
|
- if (m_stream.handle_read_failure())
|
|
|
+ if (m_stream.handle_any_error())
|
|
|
return false;
|
|
|
if (length < 0) {
|
|
|
value = {};
|
|
@@ -107,11 +107,9 @@ bool Decoder::decode(String& value)
|
|
|
}
|
|
|
char* text_buffer = nullptr;
|
|
|
auto text_impl = StringImpl::create_uninitialized(static_cast<size_t>(length), text_buffer);
|
|
|
- for (size_t i = 0; i < static_cast<size_t>(length); ++i) {
|
|
|
- m_stream >> text_buffer[i];
|
|
|
- }
|
|
|
+ m_stream >> Bytes { text_buffer, static_cast<size_t>(length) };
|
|
|
value = *text_impl;
|
|
|
- return !m_stream.handle_read_failure();
|
|
|
+ return !m_stream.handle_any_error();
|
|
|
}
|
|
|
|
|
|
bool Decoder::decode(URL& value)
|
|
@@ -127,7 +125,7 @@ bool Decoder::decode(Dictionary& dictionary)
|
|
|
{
|
|
|
u64 size = 0;
|
|
|
m_stream >> size;
|
|
|
- if (m_stream.handle_read_failure())
|
|
|
+ if (m_stream.handle_any_error())
|
|
|
return false;
|
|
|
if (size >= NumericLimits<i32>::max()) {
|
|
|
ASSERT_NOT_REACHED();
|