From a94d1af193ac1601a1725266dbb0dd51195af98b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Wed, 12 Feb 2020 19:25:10 +0330 Subject: [PATCH] [fuzz] minor style fixes --- test/fuzzing/hb-set-fuzzer.cc | 51 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/test/fuzzing/hb-set-fuzzer.cc b/test/fuzzing/hb-set-fuzzer.cc index 30b60797f..d5e5d0e6f 100644 --- a/test/fuzzing/hb-set-fuzzer.cc +++ b/test/fuzzing/hb-set-fuzzer.cc @@ -21,12 +21,11 @@ struct instructions_t uint32_t first_set_size; }; -static hb_set_t* create_set (const uint32_t* value_array, int count) +static hb_set_t *create_set (const uint32_t *value_array, int count) { - hb_set_t* set = hb_set_create (); - for (int i = 0; i < count; i++) { + hb_set_t *set = hb_set_create (); + for (int i = 0; i < count; i++) hb_set_add (set, value_array[i]); - } return set; } @@ -36,38 +35,38 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) if (size < sizeof (instructions_t)) return 0; - const instructions_t* instructions = reinterpret_cast (data); + const instructions_t &instructions = reinterpret_cast (data); data += sizeof (instructions_t); size -= sizeof (instructions_t); - const uint32_t* values = reinterpret_cast (data); + const uint32_t *values = reinterpret_cast (data); size = size / sizeof (uint32_t); - if (size < instructions->first_set_size) + if (size < instructions.first_set_size) return 0; - hb_set_t* set_a = create_set (values, instructions->first_set_size); + hb_set_t *set_a = create_set (values, instructions.first_set_size); - values += instructions->first_set_size; - size -= instructions->first_set_size; - hb_set_t* set_b = create_set (values, size); + values += instructions.first_set_size; + size -= instructions.first_set_size; + hb_set_t *set_b = create_set (values, size); - switch (instructions->operation) + switch (instructions.operation) { - case INTERSECT: - hb_set_intersect (set_a, set_b); - break; - case UNION: - hb_set_union (set_a, set_b); - break; - case SUBTRACT: - hb_set_subtract (set_a, set_b); - break; - case SYMMETRIC_DIFFERENCE: - hb_set_symmetric_difference (set_a, set_b); - break; - default: - break; + case INTERSECT: + hb_set_intersect (set_a, set_b); + break; + case UNION: + hb_set_union (set_a, set_b); + break; + case SUBTRACT: + hb_set_subtract (set_a, set_b); + break; + case SYMMETRIC_DIFFERENCE: + hb_set_symmetric_difference (set_a, set_b); + break; + default: + break; } hb_set_destroy (set_a);