gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29228 - gnunet/src/scalarproduct


From: gnunet
Subject: [GNUnet-SVN] r29228 - gnunet/src/scalarproduct
Date: Thu, 12 Sep 2013 12:03:41 +0200

Author: cfuchs
Date: 2013-09-12 12:03:41 +0200 (Thu, 12 Sep 2013)
New Revision: 29228

Modified:
   gnunet/src/scalarproduct/gnunet-scalarproduct.c
   gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
   gnunet/src/scalarproduct/scalarproduct_api.c
Log:
bugfix, forgot to reset a variable


Modified: gnunet/src/scalarproduct/gnunet-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-scalarproduct.c     2013-09-12 09:42:13 UTC 
(rev 29227)
+++ gnunet/src/scalarproduct/gnunet-scalarproduct.c     2013-09-12 10:03:41 UTC 
(rev 29228)
@@ -225,13 +225,13 @@
     // get the length of the current element and replace , with null
     for (end = begin; *end && *end != ','; end++);
 
-    if (1 == sscanf (begin, "%" SCNd32",", &element))
+    if (1 == sscanf (begin, "%" SCNd32 ",", &element))
     {
       //element in the middle
       element_count++;
       begin = end + 1;
     }
-    else if (*begin == 0)
+    else if (0 == *begin)
     {
       break;
     }
@@ -244,25 +244,26 @@
   while (1);
   if (0 == element_count)
   {
-
+    LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Need elements to compute the 
vectorproduct, got none.\n"));
     return;
   }
-
+  
   begin = input_elements;
   elements = GNUNET_malloc (sizeof (int32_t) * element_count);
+  element_count = 0;
   /* Read input_elements_peer1, and put in elements_peer1 array */
   do
   {
     // get the length of the current element and replace , with null
     for (end = begin; *end && *end != ','; end++);
 
-    if (1 == sscanf (begin, "%" SCNd32",", &elements[element_count]))
+    if (1 == sscanf (begin, "%" SCNd32 ",", &elements[element_count]))
     {
       //element in the middle
       element_count++;
       begin = end + 1;
     }
-    else if (*begin == 0)
+    else if (0 == *begin)
     {
       break;
     }
@@ -270,7 +271,7 @@
   while (1);
 
   mask_bytes = element_count / 8 + (element_count % 8 ? 1 : 0);
-  mask = GNUNET_malloc ((element_count / 8) + 2);
+  mask = GNUNET_malloc ((element_count / 8) + 1);
 
   /* Read input_mask_peer1 and read in mask_peer1 array */
   if ((NULL != input_peer_id) && (NULL != input_mask))

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.c     2013-09-12 
09:42:13 UTC (rev 29227)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.c     2013-09-12 
10:03:41 UTC (rev 29228)
@@ -2014,8 +2014,8 @@
   session->tunnel = NULL;
   // send message with product to client
   session->client_notification_task = 
-          GNUNET_SCHEDULER_add_now (&prepare_client_response, 
-          session);
+             GNUNET_SCHEDULER_add_now (&prepare_client_response, 
+                                        session);
   // the tunnel has done its job, terminate our connection and the tunnel
   // the peer will be notified that the tunnel was destroyed via 
tunnel_destruction_handler
   // just close the connection, as recommended by Christian

Modified: gnunet/src/scalarproduct/scalarproduct_api.c
===================================================================
--- gnunet/src/scalarproduct/scalarproduct_api.c        2013-09-12 09:42:13 UTC 
(rev 29227)
+++ gnunet/src/scalarproduct/scalarproduct_api.c        2013-09-12 10:03:41 UTC 
(rev 29228)
@@ -331,7 +331,7 @@
   uint64_t i;
 
   GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct 
GNUNET_SCALARPRODUCT_client_request)
-                 +element_count * sizeof (int32_t));
+                 + element_count * sizeof (int32_t));
   h = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle);
   h->client = GNUNET_CLIENT_connect ("scalarproduct", cfg);
   if (!h->client)
@@ -351,7 +351,7 @@
       return NULL;
     }
 
-  size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) +element_count * 
sizeof (int32_t);
+  size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) + element_count * 
sizeof (int32_t);
 
   h->cont_status = cont;
   h->cont_cls = cont_cls;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]