Replace dcp::Data with dcp::ArrayData
[dcpomatic.git] / test / test.cc
index a576ee0c01219ce7950c90922d8e52103508602c..9ac202b8051c11a305c058fcbc8dd417b7162414 100644 (file)
@@ -71,6 +71,9 @@ using std::abs;
 using boost::shared_ptr;
 using boost::scoped_array;
 using boost::dynamic_pointer_cast;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 
 
 boost::filesystem::path
@@ -684,7 +687,7 @@ write_image (shared_ptr<const Image> image, boost::filesystem::path file)
        png_destroy_write_struct (&png_ptr, &info_ptr);
        png_free (png_ptr, row_pointers);
 
-       dcp::Data(state.data, state.size).write(file);
+       dcp::ArrayData(state.data, state.size).write(file);
 }
 
 
@@ -762,24 +765,13 @@ subtitle_file (shared_ptr<Film> film)
 void
 make_random_file (boost::filesystem::path path, size_t size)
 {
-       size_t const chunk = 128 * 1024;
-       uint8_t* buffer = static_cast<uint8_t*> (malloc(chunk));
-       BOOST_REQUIRE (buffer);
-       FILE* r = fopen("/dev/urandom", "rb");
-       BOOST_REQUIRE (r);
        FILE* t = fopen_boost(path, "wb");
        BOOST_REQUIRE (t);
-       while (size) {
-               size_t this_time = min (size, chunk);
-               size_t N = fread (buffer, 1, this_time, r);
-               BOOST_REQUIRE (N == this_time);
-               N = fwrite (buffer, 1, this_time, t);
-               BOOST_REQUIRE (N == this_time);
-               size -= this_time;
+       for (size_t i = 0; i < size; ++i) {
+               uint8_t r = rand() & 0xff;
+               fwrite (&r, 1, 1, t);
        }
        fclose (t);
-       fclose (r);
-       free (buffer);
 }