From 79ab5bc24fbcb542deb1a8ee21b5f1c19ab1e7f5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 28 Apr 2025 22:51:33 +0200 Subject: Cleanup: use std::vector rather than a "variable" length array. --- src/lib/scp_uploader.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/scp_uploader.cc b/src/lib/scp_uploader.cc index 78ab1e7a4..faf482a43 100644 --- a/src/lib/scp_uploader.cc +++ b/src/lib/scp_uploader.cc @@ -122,18 +122,17 @@ LIBDCP_ENABLE_WARNINGS throw NetworkError(String::compose(_("Could not open %1 to send"), from)); } - boost::uintmax_t buffer_size = 64 * 1024; - char buffer[buffer_size]; + std::vector buffer(64 * 1024); while (to_do > 0) { - int const t = min(to_do, buffer_size); - size_t const read = f.read(buffer, 1, t); + int const t = min(to_do, buffer.size()); + size_t const read = f.read(buffer.data(), 1, t); if (read != size_t(t)) { throw ReadFileError(from); } LIBDCP_DISABLE_WARNINGS - int const r = ssh_scp_write(_scp, buffer, t); + int const r = ssh_scp_write(_scp, buffer.data(), t); LIBDCP_ENABLE_WARNINGS if (r != SSH_OK) { throw NetworkError(String::compose(_("Could not write to remote file (%1)"), ssh_get_error(_session))); -- cgit v1.2.3