summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-23 16:06:18 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-23 16:06:18 +0100
commitd746b1b16f4aa093ecdad80376bf90456a7708d3 (patch)
tree91ec6005a3679e1e5a664d8700daffc39d510a1d
parent5a31b47bc7523a522f9c6c3588133004ba4c578c (diff)
memset() buffers to keep tests repeatable.
-rw-r--r--src/stl_binary_writer.cc3
-rw-r--r--test/dcp_to_stl_binary_test.cc5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/stl_binary_writer.cc b/src/stl_binary_writer.cc
index 74e26ea..4453332 100644
--- a/src/stl_binary_writer.cc
+++ b/src/stl_binary_writer.cc
@@ -111,6 +111,7 @@ sub::write_stl_binary (
assert (editor_contact_details.size() <= 32);
char* buffer = new char[1024];
+ memset (buffer, 0, 1024);
ofstream output (file_name.string().c_str ());
STLBinaryTables tables;
@@ -201,6 +202,8 @@ sub::write_stl_binary (
int N = 0;
for (list<Subtitle>::const_iterator i = subtitles.begin(); i != subtitles.end(); ++i) {
+ memset (buffer, 0, 1024);
+
/* Subtitle group number */
put_int_as_int (buffer + 0, 1, 1);
/* Subtitle number */
diff --git a/test/dcp_to_stl_binary_test.cc b/test/dcp_to_stl_binary_test.cc
index 3f191d5..2d82645 100644
--- a/test/dcp_to_stl_binary_test.cc
+++ b/test/dcp_to_stl_binary_test.cc
@@ -75,4 +75,9 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test2)
"", "",
"build/test/93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl"
);
+
+ check_file (
+ private_test / "93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl",
+ "build/test/93e8a6bf-499e-4d36-9350-a9bfa2e6758a_sub.stl"
+ );
}