diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2024-02-15 02:59:32 +0300 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2024-02-15 11:06:01 +0000 |
commit | 2cba90fecac266f90d26a3f7bf5602761f4028df (patch) | |
tree | 1f76652b3782ed716c0240c679134e89c4876946 | |
parent | b93f3ad87e75910e640dbe6a3dd5f6ec4f265731 (diff) |
json: use snprintf
Brew clang complains about deprecated sprintf.
Change-Id: I814b2ba4bf37616ff98aeef81efd6965ee680073
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/shared/json/json.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/json/json.cpp b/src/shared/json/json.cpp index 7ab85cba5..0ea6e8fd0 100644 --- a/src/shared/json/json.cpp +++ b/src/shared/json/json.cpp @@ -3757,7 +3757,7 @@ static void valueToJson(const Base *b, const Value &v, std::string &json, int in // +2 to format to ensure the expected precision const int n = std::numeric_limits<double>::digits10 + 2; char buf[30] = {0}; - std::sprintf(buf, "%.*g", n, d); + std::snprintf(buf, sizeof(buf), "%.*g", n, d); // Hack: if (buf[0] == '-' && buf[1] == '0' && buf[2] == '\0') json += "0"; |