X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fcontainer_bloomfilter.c;h=d6c2cb8b9cddf385d6485c0c67fdcabb7be1186b;hb=72c8645af31896829b674b575c5375706f362a30;hp=8d0852fc93f813397c01d25c6d2484ec8e1fefd5;hpb=6c471eeb15e27f8226492b4860a3c2acb94c5f25;p=oweals%2Fgnunet.git diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 8d0852fc9..d6c2cb8b9 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c @@ -231,7 +231,7 @@ static void decrementBit (char *bitArray, unsigned int bitIdx, const struct GNUNET_DISK_FileHandle *fh) { - OFF_T fileSlot; + OFF_T fileslot; unsigned char value; unsigned int high; unsigned int low; @@ -240,9 +240,13 @@ decrementBit (char *bitArray, unsigned int bitIdx, if (GNUNET_DISK_handle_invalid (fh)) return; /* cannot decrement! */ /* Each char slot in the counter file holds two 4 bit counters */ - fileSlot = bitIdx / 2; + fileslot = bitIdx / 2; targetLoc = bitIdx % 2; - GNUNET_DISK_file_seek (fh, fileSlot, GNUNET_DISK_SEEK_SET); + if (GNUNET_SYSERR == GNUNET_DISK_file_seek (fh, fileslot, GNUNET_DISK_SEEK_SET)) + { + GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "seek"); + return; + } if (1 != GNUNET_DISK_file_read (fh, &value, 1)) value = 0; low = value & 0xF; @@ -268,7 +272,11 @@ decrementBit (char *bitArray, unsigned int bitIdx, } } value = ((high << 4) | low); - GNUNET_DISK_file_seek (fh, fileSlot, GNUNET_DISK_SEEK_SET); + if (GNUNET_SYSERR == GNUNET_DISK_file_seek (fh, fileslot, GNUNET_DISK_SEEK_SET)) + { + GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "seek"); + return; + } GNUNET_assert (1 == GNUNET_DISK_file_write (fh, &value, 1)); } @@ -340,7 +348,7 @@ typedef int (*BitIterator) (void *cls, */ static void iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf, - BitIterator callback, void *arg, const struct GNUNET_HashCode * key) + BitIterator callback, void *arg, const struct GNUNET_HashCode *key) { struct GNUNET_HashCode tmp[2]; int bitCount; @@ -358,7 +366,7 @@ iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf, { if (GNUNET_YES != callback (arg, bf, - (((uint32_t *) & tmp[round & 1])[slot]) % + ntohl ((((uint32_t *) & tmp[round & 1])[slot])) % ((bf->bitArraySize * 8LL)))) return; slot++;