hackz.
authorCarl Hetherington <cth@carlh.net>
Thu, 6 Aug 2020 20:36:29 +0000 (22:36 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 6 Aug 2020 20:36:29 +0000 (22:36 +0200)
src/tools/dcpomatic_disk_writer.cc

index 54749691d3b913573b3ee03e681a57e617908bbb..fa0a7bb7e6094dd398faa72cf5f1aaf5d19e1f69 100644 (file)
@@ -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<uint8_t*> (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 ();
 }