diff --git a/import-fuchsia/src/import-fuchsia.cpp b/import-fuchsia/src/import-fuchsia.cpp index 1e2712f3..9f3cf8f4 100644 --- a/import-fuchsia/src/import-fuchsia.cpp +++ b/import-fuchsia/src/import-fuchsia.cpp @@ -85,20 +85,18 @@ struct DecodeState { // Append a string representation of `val` to `res` void appendArgumentValue(std::string &res, ArgumentValue &val) { + char buf[32]; buf[31]=0; if (std::holds_alternative(val)) { res += std::get(val); } else if (std::holds_alternative(val)) { - char buf[32]; snprintf(buf, 31, "%" PRIu64, std::get(val)); - res += buf; + res.append(buf); } else if (std::holds_alternative(val)) { - char buf[32]; snprintf(buf, 31, "%" PRId64, std::get(val)); - res += buf; + res.append(buf); } else if (std::holds_alternative(val)) { res += std::get(val) ? "true" : "false"; } else if (std::holds_alternative(val)) { - char buf[32]; snprintf(buf, 31, "%.5f", std::get(val)); res += buf; } @@ -284,14 +282,12 @@ void readArgument(std::vector &args, DecodeState &dec, } break; case 7: // pointer - case 8: + case 8: { // koid - { - uint64_t i = r.p[offset]; - offset += 1; - value = i; - } - break; + uint64_t i = r.p[offset]; + offset += 1; + value = i; + } break; case 9: { // bool bool b = (bool)((header >> 32) & 1); @@ -309,7 +305,6 @@ void readArgument(std::vector &args, DecodeState &dec, void readArguments(std::vector &args, DecodeState &dec, Record r, size_t &offset, const int n_args) { args.clear(); - for (int i = 0; i < n_args; ++i) readArgument(args, dec, r, offset); } @@ -317,7 +312,7 @@ void readArguments(std::vector &args, DecodeState &dec, Record r, // text made of arguments void printArgumentsToString(std::string &res, std::vector &args) { for (auto &kv : args) { - res += kv.name; + res += kv.name.data(); res += ": "; appendArgumentValue(res, kv.value); res += "\n";