mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
Fail on errors when building fuzzers
Fails on errors when building fuzzers with `fuzz.py` (adds `Werror`). Currently allows `declaration-after-statement`, `c++-compat` and `deprecated` as they are abundant in code (some fixes to `declaration-after-statement` are presented in this commit).
This commit is contained in:
@ -28,12 +28,12 @@ void FUZZ_dataProducer_free(FUZZ_dataProducer_t *producer) { free(producer); }
|
||||
|
||||
uint32_t FUZZ_dataProducer_uint32Range(FUZZ_dataProducer_t *producer, uint32_t min,
|
||||
uint32_t max) {
|
||||
FUZZ_ASSERT(min <= max);
|
||||
|
||||
uint32_t range = max - min;
|
||||
uint32_t rolling = range;
|
||||
uint32_t result = 0;
|
||||
|
||||
FUZZ_ASSERT(min <= max);
|
||||
|
||||
while (rolling > 0 && producer->size > 0) {
|
||||
uint8_t next = *(producer->data + producer->size - 1);
|
||||
producer->size -= 1;
|
||||
@ -79,11 +79,11 @@ int FUZZ_dataProducer_empty(FUZZ_dataProducer_t *producer) {
|
||||
|
||||
size_t FUZZ_dataProducer_contract(FUZZ_dataProducer_t *producer, size_t newSize)
|
||||
{
|
||||
newSize = newSize > producer->size ? producer->size : newSize;
|
||||
const size_t effectiveNewSize = newSize > producer->size ? producer->size : newSize;
|
||||
|
||||
size_t remaining = producer->size - newSize;
|
||||
size_t remaining = producer->size - effectiveNewSize;
|
||||
producer->data = producer->data + remaining;
|
||||
producer->size = newSize;
|
||||
producer->size = effectiveNewSize;
|
||||
return remaining;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user