3131#include " ../../toxcore/tox_dispatch.h"
3232#include " ../../toxcore/tox_events.h"
3333#include " ../../toxcore/tox_private.h"
34- #include " ../../toxcore/tox_struct.h"
35- #include " ../../toxcore/util.h"
3634#include " fuzz_support.hh"
3735
3836namespace {
@@ -179,7 +177,7 @@ void dump(std::vector<uint8_t> recording, const char *filename)
179177
180178void RecordBootstrap (const char *init, const char *bootstrap)
181179{
182- Record_System::Global global ;
180+ auto global = std::make_unique< Record_System::Global>() ;
183181
184182 Tox_Options *opts = tox_options_new (nullptr );
185183 assert (opts != nullptr );
@@ -198,9 +196,9 @@ void RecordBootstrap(const char *init, const char *bootstrap)
198196 Tox_Err_New_Testing error_new_testing;
199197 Tox_Options_Testing tox_options_testing;
200198
201- Record_System sys1 ( global, 4 , " tox1" ); // fair dice roll
202- tox_options_set_log_user_data (opts, & sys1);
203- tox_options_testing.operating_system = sys1. sys .get ();
199+ auto sys1 = std::make_unique<Record_System>(* global, 4 , " tox1" ); // fair dice roll
200+ tox_options_set_log_user_data (opts, sys1. get () );
201+ tox_options_testing.operating_system = sys1-> sys .get ();
204202 Tox *tox1 = tox_new_testing (opts, &error_new, &tox_options_testing, &error_new_testing);
205203 assert (tox1 != nullptr );
206204 assert (error_new == TOX_ERR_NEW_OK);
@@ -212,9 +210,9 @@ void RecordBootstrap(const char *init, const char *bootstrap)
212210 std::array<uint8_t , TOX_PUBLIC_KEY_SIZE> dht_key1;
213211 tox_self_get_dht_id (tox1, dht_key1.data ());
214212
215- Record_System sys2 ( global, 5 , " tox2" ); // unfair dice roll
216- tox_options_set_log_user_data (opts, & sys2);
217- tox_options_testing.operating_system = sys2. sys .get ();
213+ auto sys2 = std::make_unique<Record_System>(* global, 5 , " tox2" ); // unfair dice roll
214+ tox_options_set_log_user_data (opts, sys2. get () );
215+ tox_options_testing.operating_system = sys2-> sys .get ();
218216 Tox *tox2 = tox_new_testing (opts, &error_new, &tox_options_testing, &error_new_testing);
219217 assert (tox2 != nullptr );
220218 assert (error_new == TOX_ERR_NEW_OK);
@@ -252,26 +250,26 @@ void RecordBootstrap(const char *init, const char *bootstrap)
252250 Tox_Events *events;
253251
254252 events = tox_events_iterate (tox1, true , &error_iterate);
255- assert (tox_events_equal (sys1. sys .get (), events, events));
253+ assert (tox_events_equal (sys1-> sys .get (), events, events));
256254 tox_dispatch_invoke (dispatch, events, &state1);
257255 tox_events_free (events);
258256
259257 events = tox_events_iterate (tox2, true , &error_iterate);
260- assert (tox_events_equal (sys2. sys .get (), events, events));
258+ assert (tox_events_equal (sys2-> sys .get (), events, events));
261259 tox_dispatch_invoke (dispatch, events, &state2);
262260 tox_events_free (events);
263261
264262 // Move the clock forward a decent amount so all the time-based checks
265263 // trigger more quickly.
266- sys1. clock += clock_increment;
267- sys2. clock += clock_increment;
264+ sys1-> clock += clock_increment;
265+ sys2-> clock += clock_increment;
268266
269267 if (Fuzz_Data::FUZZ_DEBUG) {
270268 printf (" tox1: rng: %d (for clock)\n " , clock_increment);
271269 printf (" tox2: rng: %d (for clock)\n " , clock_increment);
272270 }
273- sys1. push (clock_increment);
274- sys2. push (clock_increment);
271+ sys1-> push (clock_increment);
272+ sys2-> push (clock_increment);
275273 };
276274
277275 while (tox_self_get_connection_status (tox1) == TOX_CONNECTION_NONE
@@ -302,7 +300,7 @@ void RecordBootstrap(const char *init, const char *bootstrap)
302300
303301 std::printf (" tox clients connected\n " );
304302
305- dump (sys1. take_recording (), init);
303+ dump (sys1-> take_recording (), init);
306304
307305 while (state1.done < MESSAGE_COUNT && state2.done < MESSAGE_COUNT) {
308306 if (Fuzz_Data::FUZZ_DEBUG) {
@@ -320,7 +318,7 @@ void RecordBootstrap(const char *init, const char *bootstrap)
320318 tox_kill (tox2);
321319 tox_kill (tox1);
322320
323- dump (sys1. recording (), bootstrap);
321+ dump (sys1-> recording (), bootstrap);
324322}
325323
326324}
0 commit comments