From: Carl Hetherington Date: Thu, 6 Aug 2020 20:36:29 +0000 (+0200) Subject: hackz. X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=297386da04a786df8e291679b887f796d3ae9095 hackz. --- diff --git a/src/tools/dcpomatic_disk_writer.cc b/src/tools/dcpomatic_disk_writer.cc index 54749691d..fa0a7bb7e 100644 --- a/src/tools/dcpomatic_disk_writer.cc +++ b/src/tools/dcpomatic_disk_writer.cc @@ -91,7 +91,7 @@ using boost::optional; #ifdef DCPOMATIC_LINUX static PolkitAuthority* polkit_authority = 0; #endif -static uint64_t const block_size = 4096 * 16384; +static uint64_t const block_size = 4096 * 4096; static Nanomsg* nanomsg = 0; #define SHORT_TIMEOUT 100 @@ -127,10 +127,7 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total throw CopyError (String::compose("Failed to open file %1", from.string()), 0); } - uint8_t* buffer = reinterpret_cast (dcpomatic_aligned_alloc(block_size, 4096)); - if (!buffer) { - throw bad_alloc(); - } + uint8_t* buffer = new uint8_t[block_size]; Digester digester; int progress_frequency = 1; @@ -143,7 +140,7 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total if (read != this_time) { fclose (in); ext4_fclose (&out); - dcpomatic_aligned_free (buffer); + delete[] buffer; throw CopyError (String::compose("Short read; expected %1 but read %2", this_time, read), 0); } @@ -154,13 +151,13 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total if (r != EOK) { fclose (in); ext4_fclose (&out); - dcpomatic_aligned_free (buffer); + delete[] buffer; throw CopyError ("Write failed", r); } if (written != this_time) { fclose (in); ext4_fclose (&out); - dcpomatic_aligned_free (buffer); + delete[] buffer; throw CopyError (String::compose("Short write; expected %1 but wrote %2", this_time, written), 0); } remaining -= this_time; @@ -174,7 +171,7 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total fclose (in); ext4_fclose (&out); - dcpomatic_aligned_free (buffer); + delete[] buffer; return digester.get (); }