mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-23 15:40:28 +00:00
Fix const-correctness bugs in uniq_ptr and code that uses it
This commit is contained in:
parent
0fa406dbb7
commit
fabadaad2a
@ -54,7 +54,7 @@ namespace cbs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
util::buffer_t<std::uint8_t>
|
util::buffer_t<std::uint8_t>
|
||||||
write(const cbs::ctx_t &cbs_ctx, std::uint8_t nal, void *uh, AVCodecID codec_id) {
|
write(cbs::ctx_t &cbs_ctx, std::uint8_t nal, void *uh, AVCodecID codec_id) {
|
||||||
cbs::frag_t frag;
|
cbs::frag_t frag;
|
||||||
auto err = ff_cbs_insert_unit_content(&frag, -1, nal, uh, nullptr);
|
auto err = ff_cbs_insert_unit_content(&frag, -1, nal, uh, nullptr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -401,7 +401,7 @@ namespace crypto {
|
|||||||
sign(const pkey_t &pkey, const std::string_view &data, const EVP_MD *md) {
|
sign(const pkey_t &pkey, const std::string_view &data, const EVP_MD *md) {
|
||||||
md_ctx_t ctx { EVP_MD_CTX_create() };
|
md_ctx_t ctx { EVP_MD_CTX_create() };
|
||||||
|
|
||||||
if (EVP_DigestSignInit(ctx.get(), nullptr, md, nullptr, pkey.get()) != 1) {
|
if (EVP_DigestSignInit(ctx.get(), nullptr, md, nullptr, (EVP_PKEY *) pkey.get()) != 1) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ namespace crypto {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
verify(const x509_t &x509, const std::string_view &data, const std::string_view &signature, const EVP_MD *md) {
|
verify(const x509_t &x509, const std::string_view &data, const std::string_view &signature, const EVP_MD *md) {
|
||||||
auto pkey = X509_get_pubkey(x509.get());
|
auto pkey = X509_get0_pubkey(x509.get());
|
||||||
|
|
||||||
md_ctx_t ctx { EVP_MD_CTX_create() };
|
md_ctx_t ctx { EVP_MD_CTX_create() };
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ namespace platf::dxgi {
|
|||||||
struct encoder_img_ctx_t {
|
struct encoder_img_ctx_t {
|
||||||
// Used to determine if the underlying texture changes.
|
// Used to determine if the underlying texture changes.
|
||||||
// Not safe for actual use by the encoder!
|
// Not safe for actual use by the encoder!
|
||||||
texture2d_t::pointer capture_texture_p;
|
texture2d_t::const_pointer capture_texture_p;
|
||||||
|
|
||||||
texture2d_t encoder_texture;
|
texture2d_t encoder_texture;
|
||||||
shader_res_t encoder_input_res;
|
shader_res_t encoder_input_res;
|
||||||
|
@ -490,6 +490,7 @@ namespace util {
|
|||||||
public:
|
public:
|
||||||
using element_type = T;
|
using element_type = T;
|
||||||
using pointer = element_type *;
|
using pointer = element_type *;
|
||||||
|
using const_pointer = element_type const *;
|
||||||
using deleter_type = D;
|
using deleter_type = D;
|
||||||
|
|
||||||
constexpr uniq_ptr() noexcept:
|
constexpr uniq_ptr() noexcept:
|
||||||
@ -563,12 +564,12 @@ namespace util {
|
|||||||
return _p;
|
return _p;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pointer
|
const_pointer
|
||||||
get() const {
|
get() const {
|
||||||
return _p;
|
return _p;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::add_lvalue_reference_t<element_type>
|
std::add_lvalue_reference_t<element_type const>
|
||||||
operator*() const {
|
operator*() const {
|
||||||
return *_p;
|
return *_p;
|
||||||
}
|
}
|
||||||
@ -576,7 +577,7 @@ namespace util {
|
|||||||
operator*() {
|
operator*() {
|
||||||
return *_p;
|
return *_p;
|
||||||
}
|
}
|
||||||
const pointer
|
const_pointer
|
||||||
operator->() const {
|
operator->() const {
|
||||||
return _p;
|
return _p;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user