summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-09-30 15:15:10 +0200
committerCarl Hetherington <cth@carlh.net>2025-09-30 15:15:10 +0200
commit22d9015d4788bca8da7113ad187f0b04cfbc4216 (patch)
treee7b8cd1dd19bfb0ea7eef937168cdd2aea29b454
parent63a81274aa1423ebb593cad9dfe0501853e1c1c5 (diff)
Fix some warnings raised by the macOS compiler.
-rw-r--r--src/decrypted_kdm.cc10
-rw-r--r--src/key.cc6
-rw-r--r--src/util.cc6
-rw-r--r--test/combine_test.cc2
-rw-r--r--test/dcp_test.cc4
-rw-r--r--test/mono_mpeg2_picture_write_test.cc1
-rw-r--r--test/test.cc4
7 files changed, 16 insertions, 17 deletions
diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc
index deed232d..c8daeba0 100644
--- a/src/decrypted_kdm.cc
+++ b/src/decrypted_kdm.cc
@@ -378,16 +378,16 @@ DecryptedKDM::encrypt (
/* Encrypt using the projector's public key */
RSA* rsa = recipient.public_key ();
- unsigned char encrypted[RSA_size(rsa)];
- int const encrypted_len = RSA_public_encrypt (p - block, block, encrypted, rsa, RSA_PKCS1_OAEP_PADDING);
+ std::vector<unsigned char> encrypted(RSA_size(rsa));
+ int const encrypted_len = RSA_public_encrypt(p - block, block, encrypted.data(), rsa, RSA_PKCS1_OAEP_PADDING);
if (encrypted_len == -1) {
throw MiscError (String::compose ("Could not encrypt KDM (%1)", ERR_error_string (ERR_get_error(), 0)));
}
/* Lazy overallocation */
- char out[encrypted_len * 2];
- Kumu::base64encode (encrypted, encrypted_len, out, encrypted_len * 2);
- int const N = strlen (out);
+ vector<char> out(encrypted_len * 2);
+ Kumu::base64encode(encrypted.data(), encrypted_len, out.data(), encrypted_len * 2);
+ int const N = strlen(out.data());
string lines;
for (int i = 0; i < N; ++i) {
if (i > 0 && (i % 64) == 0) {
diff --git a/src/key.cc b/src/key.cc
index a5e92aac..f11f6323 100644
--- a/src/key.cc
+++ b/src/key.cc
@@ -108,9 +108,9 @@ Key::operator= (Key const & other)
string
Key::hex () const
{
- char buffer[_length * 2 + 1];
+ std::vector<char> buffer(_length * 2 + 1);
- char* p = buffer;
+ char* p = buffer.data();
for (int i = 0; i < _length; ++i) {
#ifdef LIBDCP_WINDOWS
__mingw_snprintf (p, 3, "%02hhx", _value[i]);
@@ -120,7 +120,7 @@ Key::hex () const
p += 2;
}
- return buffer;
+ return string(buffer.data());
}
diff --git a/src/util.cc b/src/util.cc
index 11fcda27..8ad90dbf 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -200,15 +200,15 @@ dcp::base64_decode (string const & in, unsigned char* out, int out_length)
BIO_set_flags (b64, BIO_FLAGS_BASE64_NO_NL);
/* Copy our input string, removing newlines */
- char in_buffer[in.size() + 1];
- char* p = in_buffer;
+ vector<char> in_buffer(in.size() + 1);
+ char* p = in_buffer.data();
for (size_t i = 0; i < in.size(); ++i) {
if (in[i] != '\n' && in[i] != '\r') {
*p++ = in[i];
}
}
- auto bmem = BIO_new_mem_buf (in_buffer, p - in_buffer);
+ auto bmem = BIO_new_mem_buf(in_buffer.data(), p - in_buffer.data());
bmem = BIO_push (b64, bmem);
int const N = BIO_read (bmem, out, out_length);
BIO_free_all (bmem);
diff --git a/test/combine_test.cc b/test/combine_test.cc
index 4c7528c8..c773907f 100644
--- a/test/combine_test.cc
+++ b/test/combine_test.cc
@@ -540,7 +540,7 @@ BOOST_AUTO_TEST_CASE(combine_ov_with_vf)
}
}
- BOOST_CHECK_EQUAL(sub_files, 1U);
+ BOOST_CHECK_EQUAL(sub_files, 1);
}
diff --git a/test/dcp_test.cc b/test/dcp_test.cc
index 92569430..d0185d76 100644
--- a/test/dcp_test.cc
+++ b/test/dcp_test.cc
@@ -216,7 +216,7 @@ test_rewriting_sound(string name, bool modify)
bool need_to_modify = modify;
for (int i = 0; i < A_sound->asset()->intrinsic_duration(); ++i) {
auto sf = reader->get_frame (i);
- float* out[sf->channels()];
+ vector<float*> out(sf->channels());
for (int j = 0; j < sf->channels(); ++j) {
out[j] = new float[sf->samples()];
}
@@ -229,7 +229,7 @@ test_rewriting_sound(string name, bool modify)
}
}
}
- writer->write(out, sf->channels(), sf->samples());
+ writer->write(out.data(), sf->channels(), sf->samples());
for (int j = 0; j < sf->channels(); ++j) {
delete[] out[j];
}
diff --git a/test/mono_mpeg2_picture_write_test.cc b/test/mono_mpeg2_picture_write_test.cc
index 44ce5ae4..1c561e45 100644
--- a/test/mono_mpeg2_picture_write_test.cc
+++ b/test/mono_mpeg2_picture_write_test.cc
@@ -46,7 +46,6 @@ BOOST_AUTO_TEST_CASE(mpeg_mono_picture_write_test)
{
boost::filesystem::path dir = "build/test/mpeg2_mono_picture_write_test";
- boost::system::error_code ec;
boost::filesystem::remove_all(dir);
boost::filesystem::create_directories(dir);
diff --git a/test/test.cc b/test/test.cc
index 42619683..42e30303 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -315,14 +315,14 @@ simple_sound(boost::filesystem::path path, string suffix, dcp::MXFMetadata mxf_m
int const samples_per_frame = sample_rate / 24;
- float* silence[channels];
+ vector<float*> silence(channels);
for (auto i = 0; i < channels; ++i) {
silence[i] = new float[samples_per_frame];
memset (silence[i], 0, samples_per_frame * sizeof(float));
}
for (auto i = 0; i < frames; ++i) {
- sound_writer->write(silence, channels, samples_per_frame);
+ sound_writer->write(silence.data(), channels, samples_per_frame);
}
sound_writer->finalize ();