aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/gnunet-scalarproduct.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-05-24 19:57:15 +0000
committerChristian Grothoff <christian@grothoff.org>2014-05-24 19:57:15 +0000
commit31536a9bb75502f4c090472f188e1eec138515f7 (patch)
tree2c75617baa1ca040ddfb6a59d90831624b3512b1 /src/scalarproduct/gnunet-scalarproduct.c
parent152cd13768915399f9e5137d78a2f75296a1b93e (diff)
downloadgnunet-31536a9bb75502f4c090472f188e1eec138515f7.tar.gz
gnunet-31536a9bb75502f4c090472f188e1eec138515f7.zip
cleaning up scalar product client API
Diffstat (limited to 'src/scalarproduct/gnunet-scalarproduct.c')
-rw-r--r--src/scalarproduct/gnunet-scalarproduct.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c
index 2bb708fc9..88069d41d 100644
--- a/src/scalarproduct/gnunet-scalarproduct.c
+++ b/src/scalarproduct/gnunet-scalarproduct.c
@@ -261,22 +261,22 @@ run (void *cls,
261 _ ("Need elements to compute the vectorproduct, got none.\n")); 261 _ ("Need elements to compute the vectorproduct, got none.\n"));
262 return; 262 return;
263 } 263 }
264 264
265 elements = (struct GNUNET_SCALARPRODUCT_Element *) 265 elements = (struct GNUNET_SCALARPRODUCT_Element *)
266 GNUNET_malloc(sizeof(struct GNUNET_SCALARPRODUCT_Element)*element_count); 266 GNUNET_malloc(sizeof(struct GNUNET_SCALARPRODUCT_Element)*element_count);
267 267
268 for (i = 0; i < element_count;i++) 268 for (i = 0; i < element_count;i++)
269 { 269 {
270 struct GNUNET_SCALARPRODUCT_Element element; 270 struct GNUNET_SCALARPRODUCT_Element element;
271 char* separator=NULL; 271 char* separator=NULL;
272 272
273 // get the length of the current key,value; tupel 273 // get the length of the current key,value; tupel
274 for (end = begin; *end != ';'; end++) 274 for (end = begin; *end != ';'; end++)
275 if (*end == ',') 275 if (*end == ',')
276 separator = end; 276 separator = end;
277 277
278 // final element 278 // final element
279 if ((NULL == separator) 279 if ((NULL == separator)
280 || (begin == separator) 280 || (begin == separator)
281 || (separator == end - 1 )) { 281 || (separator == end - 1 )) {
282 LOG (GNUNET_ERROR_TYPE_ERROR, 282 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -284,20 +284,20 @@ run (void *cls,
284 GNUNET_free(elements); 284 GNUNET_free(elements);
285 return; 285 return;
286 } 286 }
287 287
288 // read the element's key 288 // read the element's key
289 *separator = 0; 289 *separator = 0;
290 GNUNET_CRYPTO_hash (begin, strlen (begin), &element.key); 290 GNUNET_CRYPTO_hash (begin, strlen (begin), &element.key);
291 291
292 // read the element's value 292 // read the element's value
293 if (1 != sscanf (separator+1, "%" SCNd32 ";", &element.value)) 293 if (1 != sscanf (separator+1, "%" SCNd64 ";", &element.value))
294 { 294 {
295 LOG (GNUNET_ERROR_TYPE_ERROR, 295 LOG (GNUNET_ERROR_TYPE_ERROR,
296 _ ("Could not convert `%s' to int32_t.\n"), begin); 296 _ ("Could not convert `%s' to int64_t.\n"), begin);
297 GNUNET_free(elements); 297 GNUNET_free(elements);
298 return; 298 return;
299 } 299 }
300 300
301 elements[i]=element; 301 elements[i]=element;
302 begin = end+1; 302 begin = end+1;
303 } 303 }