diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-05 19:31:40 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-05 19:33:03 +0100 |
commit | 4352558bf753b9f860df5b8a3b80526c6ba10497 (patch) | |
tree | fe20dd3d95d866b1e9401cc575a8a8614281b72f /DevTools | |
parent | 75cb125e5697625b6da58ab250600b3ab84eec76 (diff) | |
download | serenity-4352558bf753b9f860df5b8a3b80526c6ba10497.zip |
IPCCompiler: Encode String length as i32, with <0 meaning null String()
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/IPCCompiler/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index add0a44817..c119aa42d6 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() << " u32 " << parameter.name << "_length = 0;"; + dbg() << " i32 " << parameter.name << "_length = 0;"; dbg() << " stream >> " << parameter.name << "_length;"; dbg() << " if (" << parameter.name << "_length == 0) {"; dbg() << " " << parameter.name << " = String::empty();"; - dbg() << " } else if ((i32)" << parameter.name << "_length == -1) {"; + dbg() << " } else if (" << parameter.name << "_length < 0) {"; 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 (size_t i = 0; i < " << parameter.name << "_length; ++i) {"; + dbg() << " auto " << parameter.name << "_impl = StringImpl::create_uninitialized(static_cast<size_t>(" << parameter.name << "_length), " << parameter.name << "_buffer);"; + dbg() << " for (size_t i = 0; i < static_cast<size_t>(" << parameter.name << "_length); ++i) {"; dbg() << " stream >> " << parameter.name << "_buffer[i];"; dbg() << " }"; dbg() << " " << parameter.name << " = *" << parameter.name << "_impl;"; @@ -397,7 +397,7 @@ int main(int argc, char** argv) dbg() << " if (m_" << parameter.name << ".is_null()) {"; dbg() << " stream << (i32)-1;"; dbg() << " } else {"; - dbg() << " stream << m_" << parameter.name << ".length();"; + dbg() << " stream << static_cast<i32>(m_" << parameter.name << ".length());"; dbg() << " stream << m_" << parameter.name << ";"; dbg() << " }"; } else if (parameter.type == "Color") { |