mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
IPCCompiler: Encode/decode string lengths as native size_t, not int
This commit is contained in:
parent
c3a32108b2
commit
519bc758f1
Notes:
sideshowbarker
2024-07-19 09:36:31 +09:00
Author: https://github.com/jcs Commit: https://github.com/SerenityOS/serenity/commit/519bc758f1b Pull-request: https://github.com/SerenityOS/serenity/pull/1177
1 changed files with 4 additions and 4 deletions
|
@ -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 << ";";
|
||||
|
|
Loading…
Reference in a new issue