From 519bc758f1b213088b7f10b496261c77ad2a4a28 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Sun, 2 Feb 2020 00:56:39 -0600 Subject: [PATCH] IPCCompiler: Encode/decode string lengths as native size_t, not int --- DevTools/IPCCompiler/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index a58fe758a93..fcfcc18422e 100644 --- a/DevTools/IPCCompiler/main.cpp +++ b/DevTools/IPCCompiler/main.cpp @@ -310,16 +310,16 @@ int main(int argc, char** argv) dbg() << " " << parameter.type << " " << parameter.name << " = " << initial_value << ";"; if (parameter.type == "String") { - dbg() << " int " << parameter.name << "_length = 0;"; + dbg() << " size_t " << parameter.name << "_length = 0;"; dbg() << " stream >> " << parameter.name << "_length;"; dbg() << " if (" << parameter.name << "_length == 0) {"; dbg() << " " << parameter.name << " = String::empty();"; - dbg() << " } else if (" << parameter.name << "_length == -1) {"; + dbg() << " } else if ((ssize_t)" << parameter.name << "_length == -1) {"; dbg() << " " << parameter.name << " = String();"; dbg() << " } else {"; dbg() << " char* " << parameter.name << "_buffer = nullptr;"; dbg() << " auto " << parameter.name << "_impl = StringImpl::create_uninitialized(" << parameter.name << "_length, " << parameter.name << "_buffer);"; - dbg() << " for (int i = 0; i < " << parameter.name << "_length; ++i) {"; + dbg() << " for (size_t i = 0; i < " << parameter.name << "_length; ++i) {"; dbg() << " stream >> " << parameter.name << "_buffer[i];"; dbg() << " }"; dbg() << " " << parameter.name << " = *" << parameter.name << "_impl;"; @@ -395,7 +395,7 @@ int main(int argc, char** argv) for (auto& parameter : parameters) { if (parameter.type == "String") { dbg() << " if (m_" << parameter.name << ".is_null()) {"; - dbg() << " stream << (i32)-1;"; + dbg() << " stream << (ssize_t)-1;"; dbg() << " } else {"; dbg() << " stream << m_" << parameter.name << ".length();"; dbg() << " stream << m_" << parameter.name << ";";