diff --git a/lib/libimhex/source/helpers/file.cpp b/lib/libimhex/source/helpers/file.cpp index bd5c6eeef..05ddd39c5 100644 --- a/lib/libimhex/source/helpers/file.cpp +++ b/lib/libimhex/source/helpers/file.cpp @@ -90,7 +90,7 @@ namespace hex::fs { return ""; auto cString = reinterpret_cast(bytes.data()); - return { cString, std::min(bytes.size(), std::strlen(cString)) }; + return { cString, std::strnlen(cString, bytes.size()) }; } std::u8string File::readU8String(size_t numBytes) { diff --git a/lib/libimhex/source/helpers/net.cpp b/lib/libimhex/source/helpers/net.cpp index 5793b57f3..42c4991d0 100644 --- a/lib/libimhex/source/helpers/net.cpp +++ b/lib/libimhex/source/helpers/net.cpp @@ -124,7 +124,7 @@ namespace hex { if (result != CURLE_OK) log::error("Net request failed with error {0}: '{1}'", u32(result), curl_easy_strerror(result)); - i32 responseCode = 0; + long responseCode = 0; curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode); curl_slist_free_all(this->m_headers); @@ -135,7 +135,7 @@ namespace hex { if (result != CURLE_OK) return std::nullopt; else - return responseCode; + return i32(responseCode); } std::future> Net::getString(const std::string &url, u32 timeout) {