aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/gnunet-scalarproduct.c
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2013-09-12 10:03:41 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2013-09-12 10:03:41 +0000
commit4b113550b06da869e7351c8f36437226874fd20a (patch)
tree2a9fe282abea804ae8b66df39cdc1b9416a4fe2f /src/scalarproduct/gnunet-scalarproduct.c
parentcb32d6369ef9b9c4a4a9adc3391dff3355da9222 (diff)
downloadgnunet-4b113550b06da869e7351c8f36437226874fd20a.tar.gz
gnunet-4b113550b06da869e7351c8f36437226874fd20a.zip
bugfix, forgot to reset a variable
Diffstat (limited to 'src/scalarproduct/gnunet-scalarproduct.c')
-rw-r--r--src/scalarproduct/gnunet-scalarproduct.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c
index 7fe6cf75c..5e95742e6 100644
--- a/src/scalarproduct/gnunet-scalarproduct.c
+++ b/src/scalarproduct/gnunet-scalarproduct.c
@@ -225,13 +225,13 @@ run (void *cls,
225 // get the length of the current element and replace , with null 225 // get the length of the current element and replace , with null
226 for (end = begin; *end && *end != ','; end++); 226 for (end = begin; *end && *end != ','; end++);
227 227
228 if (1 == sscanf (begin, "%" SCNd32",", &element)) 228 if (1 == sscanf (begin, "%" SCNd32 ",", &element))
229 { 229 {
230 //element in the middle 230 //element in the middle
231 element_count++; 231 element_count++;
232 begin = end + 1; 232 begin = end + 1;
233 } 233 }
234 else if (*begin == 0) 234 else if (0 == *begin)
235 { 235 {
236 break; 236 break;
237 } 237 }
@@ -244,25 +244,26 @@ run (void *cls,
244 while (1); 244 while (1);
245 if (0 == element_count) 245 if (0 == element_count)
246 { 246 {
247 247 LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the vectorproduct, got none.\n"));
248 return; 248 return;
249 } 249 }
250 250
251 begin = input_elements; 251 begin = input_elements;
252 elements = GNUNET_malloc (sizeof (int32_t) * element_count); 252 elements = GNUNET_malloc (sizeof (int32_t) * element_count);
253 element_count = 0;
253 /* Read input_elements_peer1, and put in elements_peer1 array */ 254 /* Read input_elements_peer1, and put in elements_peer1 array */
254 do 255 do
255 { 256 {
256 // get the length of the current element and replace , with null 257 // get the length of the current element and replace , with null
257 for (end = begin; *end && *end != ','; end++); 258 for (end = begin; *end && *end != ','; end++);
258 259
259 if (1 == sscanf (begin, "%" SCNd32",", &elements[element_count])) 260 if (1 == sscanf (begin, "%" SCNd32 ",", &elements[element_count]))
260 { 261 {
261 //element in the middle 262 //element in the middle
262 element_count++; 263 element_count++;
263 begin = end + 1; 264 begin = end + 1;
264 } 265 }
265 else if (*begin == 0) 266 else if (0 == *begin)
266 { 267 {
267 break; 268 break;
268 } 269 }
@@ -270,7 +271,7 @@ run (void *cls,
270 while (1); 271 while (1);
271 272
272 mask_bytes = element_count / 8 + (element_count % 8 ? 1 : 0); 273 mask_bytes = element_count / 8 + (element_count % 8 ? 1 : 0);
273 mask = GNUNET_malloc ((element_count / 8) + 2); 274 mask = GNUNET_malloc ((element_count / 8) + 1);
274 275
275 /* Read input_mask_peer1 and read in mask_peer1 array */ 276 /* Read input_mask_peer1 and read in mask_peer1 array */
276 if ((NULL != input_peer_id) && (NULL != input_mask)) 277 if ((NULL != input_peer_id) && (NULL != input_mask))