From 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:23:44 +1000 Subject: The Formatting String Catastrophe --- source/core/StarJsonPatch.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/core/StarJsonPatch.cpp') diff --git a/source/core/StarJsonPatch.cpp b/source/core/StarJsonPatch.cpp index e1ab6de..34c6a82 100644 --- a/source/core/StarJsonPatch.cpp +++ b/source/core/StarJsonPatch.cpp @@ -12,7 +12,7 @@ Json jsonPatch(Json const& base, JsonArray const& patch) { } return res; } catch (JsonException const& e) { - throw JsonPatchException(strf("Could not apply patch to base. %s", e.what())); + throw JsonPatchException(strf("Could not apply patch to base. {}", e.what())); } } @@ -32,9 +32,9 @@ namespace JsonPatching { auto operation = op.getString("op"); return JsonPatching::functionMap.get(operation)(base, op); } catch (JsonException const& e) { - throw JsonPatchException(strf("Could not apply operation to base. %s", e.what())); + throw JsonPatchException(strf("Could not apply operation to base. {}", e.what())); } catch (MapException const&) { - throw JsonPatchException(strf("Invalid operation: %s", op.getString("op"))); + throw JsonPatchException(strf("Invalid operation: {}", op.getString("op"))); } } @@ -49,7 +49,7 @@ namespace JsonPatching { auto testValue = pointer.get(base); if (!value) { if (inverseTest) - throw JsonPatchTestFail(strf("Test operation failure, expected %s to be missing.", op.getString("path"))); + throw JsonPatchTestFail(strf("Test operation failure, expected {} to be missing.", op.getString("path"))); return base; } @@ -57,11 +57,11 @@ namespace JsonPatching { return base; } - throw JsonPatchTestFail(strf("Test operation failure, expected %s found %s.", value, testValue)); + throw JsonPatchTestFail(strf("Test operation failure, expected {} found {}.", value, testValue)); } catch (JsonPath::TraversalException& e) { if (inverseTest) return base; - throw JsonPatchTestFail(strf("Test operation failure: %s", e.what())); + throw JsonPatchTestFail(strf("Test operation failure: {}", e.what())); } } -- cgit v1.2.3