aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/setu/gnunet-service-setu_strata_estimator.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c b/src/setu/gnunet-service-setu_strata_estimator.c
index 32898f482..9ca1af0eb 100644
--- a/src/setu/gnunet-service-setu_strata_estimator.c
+++ b/src/setu/gnunet-service-setu_strata_estimator.c
@@ -62,7 +62,9 @@ strata_estimator_write (const struct StrataEstimator *se,
62 &cbuf, 62 &cbuf,
63 &nsize)) 63 &nsize))
64 { 64 {
65 GNUNET_memcpy (buf, cbuf, nsize); 65 GNUNET_memcpy (buf,
66 cbuf,
67 nsize);
66 osize = nsize; 68 osize = nsize;
67 GNUNET_free (cbuf); 69 GNUNET_free (cbuf);
68 } 70 }
@@ -224,19 +226,23 @@ strata_estimator_difference (const struct StrataEstimator *se1,
224 226
225 /* FIXME: implement this without always allocating new IBFs */ 227 /* FIXME: implement this without always allocating new IBFs */
226 diff = ibf_dup (se1->strata[i]); 228 diff = ibf_dup (se1->strata[i]);
227 ibf_subtract (diff, se2->strata[i]); 229 ibf_subtract (diff,
230 se2->strata[i]);
228 for (int ibf_count = 0; GNUNET_YES; ibf_count++) 231 for (int ibf_count = 0; GNUNET_YES; ibf_count++)
229 { 232 {
230 int more; 233 int more;
231 234
232 more = ibf_decode (diff, NULL, NULL); 235 more = ibf_decode (diff,
236 NULL,
237 NULL);
233 if (GNUNET_NO == more) 238 if (GNUNET_NO == more)
234 { 239 {
235 count += ibf_count; 240 count += ibf_count;
236 break; 241 break;
237 } 242 }
238 /* Estimate if decoding fails or would not terminate */ 243 /* Estimate if decoding fails or would not terminate */
239 if ((GNUNET_SYSERR == more) || (ibf_count > diff->size)) 244 if ( (GNUNET_SYSERR == more) ||
245 (ibf_count > diff->size) )
240 { 246 {
241 ibf_destroy (diff); 247 ibf_destroy (diff);
242 return count * (1 << (i + 1)); 248 return count * (1 << (i + 1));