OLD | NEW |
1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
2 // | 2 // |
3 /// \file create_compress_files.c | 3 /// \file create_compress_files.c |
4 /// \brief Creates bunch of test files to be compressed | 4 /// \brief Creates bunch of test files to be compressed |
5 /// | 5 /// |
6 /// Using a test file generator program saves space in the source code | 6 /// Using a test file generator program saves space in the source code |
7 /// package considerably. | 7 /// package considerably. |
8 // | 8 // |
9 // Author: Lasse Collin | 9 // Author: Lasse Collin |
10 // | 10 // |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 // File that repeats "abc\n" a few thousand times. This is targeted | 76 // File that repeats "abc\n" a few thousand times. This is targeted |
77 // especially at Subblock filter's run-length encoder. | 77 // especially at Subblock filter's run-length encoder. |
78 static void | 78 static void |
79 write_abc(FILE *file) | 79 write_abc(FILE *file) |
80 { | 80 { |
81 for (size_t i = 0; i < 12345; ++i) | 81 for (size_t i = 0; i < 12345; ++i) |
82 » » fwrite("abc\n", 4, 1, file); | 82 » » if (fwrite("abc\n", 4, 1, file) != 1) |
| 83 » » » exit(1); |
83 } | 84 } |
84 | 85 |
85 | 86 |
86 // File that doesn't compress. We always use the same random seed to | 87 // File that doesn't compress. We always use the same random seed to |
87 // generate identical files on all systems. | 88 // generate identical files on all systems. |
88 static void | 89 static void |
89 write_random(FILE *file) | 90 write_random(FILE *file) |
90 { | 91 { |
91 uint32_t n = 5; | 92 uint32_t n = 5; |
92 | 93 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 | 150 |
150 int | 151 int |
151 main(void) | 152 main(void) |
152 { | 153 { |
153 create_test(abc); | 154 create_test(abc); |
154 create_test(random); | 155 create_test(random); |
155 create_test(text); | 156 create_test(text); |
156 return 0; | 157 return 0; |
157 } | 158 } |
OLD | NEW |