Use arrays

This commit is contained in:
badaix 2025-02-09 21:20:45 +01:00
parent b6e4480e2e
commit fd7802c6fc
3 changed files with 10 additions and 7 deletions

View file

@ -578,10 +578,10 @@ ssl_websocket& ClientConnectionWss::getWs()
// certificate authority.
// In this example we will simply print the certificate's subject name.
char subject_name[256];
std::array<char, 256> subject_name;
X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256);
LOG(INFO, LOG_TAG) << "Verifying cert: '" << subject_name << "', pre verified: " << preverified << "\n";
X509_NAME_oneline(X509_get_subject_name(cert), subject_name.data(), subject_name.size());
LOG(INFO, LOG_TAG) << "Verifying cert: '" << subject_name.data() << "', pre verified: " << preverified << "\n";
return preverified;
});

View file

@ -38,11 +38,13 @@ namespace decoder
namespace callback
{
// NOLINTBEGIN
FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder* decoder, FLAC__byte buffer[], size_t* bytes, void* client_data);
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* decoder, const FLAC__Frame* frame, const FLAC__int32* const buffer[],
void* client_data);
void metadata_callback(const FLAC__StreamDecoder* decoder, const FLAC__StreamMetadata* metadata, void* client_data);
void error_callback(const FLAC__StreamDecoder* decoder, FLAC__StreamDecoderErrorStatus status, void* client_data);
// NOLINTEND
} // namespace callback
namespace
@ -130,6 +132,7 @@ SampleFormat FlacDecoder::setHeader(msg::CodecHeader* chunk)
namespace callback
{
// NOLINTNEXTLINE
FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder* /*decoder*/, FLAC__byte buffer[], size_t* bytes, void* client_data)
{
if (flacHeader != nullptr)
@ -156,7 +159,7 @@ FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder* /*decoder
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
// NOLINTNEXTLINE
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* /*decoder*/, const FLAC__Frame* frame, const FLAC__int32* const buffer[],
void* client_data)
{

View file

@ -92,10 +92,10 @@ ControlServer::ControlServer(boost::asio::io_context& io_context, const ServerSe
// certificate authority.
// In this example we will simply print the certificate's subject name.
char subject_name[256];
std::array<char, 256> subject_name;
X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 256);
LOG(INFO, LOG_TAG) << "Verifying cert: '" << subject_name << "', pre verified: " << preverified << "\n";
X509_NAME_oneline(X509_get_subject_name(cert), subject_name.data(), subject_name.size());
LOG(INFO, LOG_TAG) << "Verifying cert: '" << subject_name.data() << "', pre verified: " << preverified << "\n";
return preverified;
});