diff options
author | Chris Robinson <[email protected]> | 2024-01-03 19:10:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2024-01-03 19:10:15 -0800 |
commit | 8c80f29e242dee18cb914d3cdb396bd96e935547 (patch) | |
tree | 1ec189802b81060295edcffa5b77976a6373b9d5 /core | |
parent | 18349e1da2c79d0f41c8c4f12ccd065f91618a6f (diff) |
Avoid some const_casts
Diffstat (limited to 'core')
-rw-r--r-- | core/ambdec.cpp | 2 | ||||
-rw-r--r-- | core/except.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/core/ambdec.cpp b/core/ambdec.cpp index 8242cf02..f3fe7566 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -53,7 +53,7 @@ std::optional<std::string> make_error(size_t linenum, const char *fmt, ...) auto &str = ret.emplace(); str.resize(256); - int printed{std::snprintf(const_cast<char*>(str.data()), str.length(), "Line %zu: ", linenum)}; + int printed{std::snprintf(str.data(), str.length(), "Line %zu: ", linenum)}; if(printed < 0) printed = 0; auto plen = std::min(static_cast<size_t>(printed), str.length()); diff --git a/core/except.cpp b/core/except.cpp index 45fd4eb5..86c7ccca 100644 --- a/core/except.cpp +++ b/core/except.cpp @@ -21,7 +21,7 @@ void base_exception::setMessage(const char* msg, std::va_list args) if(msglen > 0) LIKELY { mMessage.resize(static_cast<size_t>(msglen)+1); - std::vsnprintf(const_cast<char*>(mMessage.data()), mMessage.length(), msg, args2); + std::vsnprintf(mMessage.data(), mMessage.length(), msg, args2); mMessage.pop_back(); } va_end(args2); |