gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: reindent


From: gnunet
Subject: [taler-donau] branch master updated: reindent
Date: Wed, 20 Mar 2024 12:14:04 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 8e469ba  reindent
8e469ba is described below

commit 8e469ba6516ce1e102c96d3b07484e171e17018b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Mar 20 12:13:58 2024 +0100

    reindent
---
 src/donau/donau-httpd_keys.c             |   2 +-
 src/donau/donau-httpd_post-batch-issue.c | 204 ++++++++++++++++---------------
 2 files changed, 107 insertions(+), 99 deletions(-)

diff --git a/src/donau/donau-httpd_keys.c b/src/donau/donau-httpd_keys.c
index b24ab26..08c93f5 100644
--- a/src/donau/donau-httpd_keys.c
+++ b/src/donau/donau-httpd_keys.c
@@ -359,7 +359,7 @@ struct DH_KeyStateHandle
   unsigned int krd_array_length;
 
   /**
-   * Information we track for thecrypto helpers.  Preserved
+   * Information we track for the crypto helpers.  Preserved
    * when the @e key_generation changes, thus kept separate.
    */
   struct HelperState *helpers;
diff --git a/src/donau/donau-httpd_post-batch-issue.c 
b/src/donau/donau-httpd_post-batch-issue.c
index 0a2efcf..c170739 100644
--- a/src/donau/donau-httpd_post-batch-issue.c
+++ b/src/donau/donau-httpd_post-batch-issue.c
@@ -54,13 +54,13 @@ struct IssueReceiptsContext
  */
 static enum GNUNET_GenericReturnValue
 parse_json_bkp (struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
-                    const json_t *bkp_key_obj)
+                const json_t *bkp_key_obj)
 {
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_fixed_auto ("h_du_pub",
                                  &bkp->h_donation_unit_pub),
     GNUNET_JSON_spec_fixed_auto ("blinded_udi",
-                             &bkp->blinded_udi),
+                                 &bkp->blinded_udi),
     GNUNET_JSON_spec_end ()
   };
 
@@ -76,42 +76,41 @@ parse_json_bkp (struct 
DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp,
 }
 
 
-
 MHD_RESULT
 DH_handler_issue_receipts_post (struct DH_RequestContext *rc,
-                                        const json_t *root,
-                                                                const char 
*const args[1])
+                                const json_t *root,
+                                const char *const args[1])
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "issue receipts request! \n");
+              "issue receipts request! \n");
 
   unsigned long long charity_id;
   char dummy;
 
   if ( (NULL == args[0]) ||
-        (1 != sscanf (args[0],
-                                  "%llu%c",
-                                  &charity_id,
-                                  &dummy)) )
+       (1 != sscanf (args[0],
+                     "%llu%c",
+                     &charity_id,
+                     &dummy)) )
   {
     GNUNET_break_op (0);
     return TALER_MHD_reply_with_error (rc->connection,
-                                                                        
MHD_HTTP_BAD_REQUEST,
-                                                                        
TALER_EC_GENERIC_PARAMETER_MALFORMED,
-                                                                        
"charity_id");
+                                       MHD_HTTP_BAD_REQUEST,
+                                       TALER_EC_GENERIC_PARAMETER_MALFORMED,
+                                       "charity_id");
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "issue receipts for charity id: %llu\n",
-                         charity_id);
+              "issue receipts for charity id: %llu\n",
+              charity_id);
 
   struct IssueReceiptsContext irc;
   const json_t *budikeypairs;
 
   struct GNUNET_JSON_Specification spec[] = {
-       GNUNET_JSON_spec_array_const ("budikeypairs",
-                                                                       
&budikeypairs),
+    GNUNET_JSON_spec_array_const ("budikeypairs",
+                                  &budikeypairs),
     GNUNET_JSON_spec_fixed_auto ("charity_sig",
-                                                       &irc.charity_sig),
+                                 &irc.charity_sig),
     GNUNET_JSON_spec_uint64 ("year",
                              &irc.year),
     GNUNET_JSON_spec_end ()
@@ -133,7 +132,7 @@ DH_handler_issue_receipts_post (struct DH_RequestContext 
*rc,
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "parse some values!");
+              "parse some values!");
   /* parse the budikeypairs array */
   const uint64_t num_bkp
     = json_array_size (budikeypairs);
@@ -142,74 +141,79 @@ DH_handler_issue_receipts_post (struct DH_RequestContext 
*rc,
     json_t *bkp_obj;
     unsigned int index;
 
-    struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp = 
GNUNET_new_array (num_bkp,
-                          struct DONAU_BlindedUniqueDonationIdentifierKeyPair);
+    struct DONAU_BlindedUniqueDonationIdentifierKeyPair *bkp
+      = GNUNET_new_array
+          (num_bkp,
+          struct DONAU_BlindedUniqueDonationIdentifierKeyPair);
     json_array_foreach (budikeypairs, index, bkp_obj) {
-               if (GNUNET_SYSERR ==
-                               parse_json_bkp(&bkp[index], bkp_obj)) {
-                   return TALER_MHD_reply_with_error (rc->connection,
-                                                      MHD_HTTP_BAD_REQUEST,
-                                                      
TALER_EC_GENERIC_PARAMETER_MALFORMED,
-                                                      "budikeypairs");
-               }
+      if (GNUNET_SYSERR ==
+          parse_json_bkp (&bkp[index], bkp_obj))
+      {
+        return TALER_MHD_reply_with_error (rc->connection,
+                                           MHD_HTTP_BAD_REQUEST,
+                                           
TALER_EC_GENERIC_PARAMETER_MALFORMED,
+                                           "budikeypairs");
+      }
     }
     irc.bkp = bkp;
-  } else {
-         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                                 "empty array of budi key pairs!");
-           return TALER_MHD_reply_with_error (rc->connection,
-                                              MHD_HTTP_BAD_REQUEST,
-                                              
TALER_EC_GENERIC_PARAMETER_MALFORMED,
-                                              "budikeypairs");
+  }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "empty array of budi key pairs!");
+    return TALER_MHD_reply_with_error (rc->connection,
+                                       MHD_HTTP_BAD_REQUEST,
+                                       TALER_EC_GENERIC_PARAMETER_MALFORMED,
+                                       "budikeypairs");
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "budi key pairs array is parsed!");
+              "budi key pairs array is parsed!");
   // Get charity pub
   struct DONAUDB_CharityMetaData charity_meta;
   enum GNUNET_DB_QueryStatus qs_charity;
 
   qs_charity = DH_plugin->lookup_charity (DH_plugin->cls,
-                                                                       
(uint64_t) charity_id,
-                                                                       
&charity_meta);
+                                          (uint64_t) charity_id,
+                                          &charity_meta);
   switch (qs_charity)
   {
   case GNUNET_DB_STATUS_HARD_ERROR:
   case GNUNET_DB_STATUS_SOFT_ERROR:
-         GNUNET_break (0);
-         return TALER_MHD_reply_with_error (rc->connection,
-                                                                               
 MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                                                               
 TALER_EC_GENERIC_DB_FETCH_FAILED,
-                                                                               
 NULL);
+    GNUNET_break (0);
+    return TALER_MHD_reply_with_error (rc->connection,
+                                       MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                       TALER_EC_GENERIC_DB_FETCH_FAILED,
+                                       NULL);
   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
-         return TALER_MHD_reply_with_error (
-               rc->connection,
-               MHD_HTTP_NOT_FOUND,
-               TALER_EC_DONAU_CHARITY_NOT_FOUND,
-               NULL);
-   break;
-   case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
-        break;
-   }
+    return TALER_MHD_reply_with_error (
+      rc->connection,
+      MHD_HTTP_NOT_FOUND,
+      TALER_EC_DONAU_CHARITY_NOT_FOUND,
+      NULL);
+    break;
+  case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+    break;
+  }
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "got charity from db!");
+              "got charity from db!");
   /* verify charity signature */
   if (GNUNET_OK !=
-                 DONAU_charity_budi_key_pair_verify(num_bkp, &irc.bkp,
-                                                                               
          &charity_meta.charity_pub,
-                                                                               
          &irc.charity_sig))
+      DONAU_charity_budi_key_pair_verify (num_bkp, &irc.bkp,
+                                          &charity_meta.charity_pub,
+                                          &irc.charity_sig))
   {
-       GNUNET_break_op (0);
-       return TALER_MHD_reply_with_error (
-         rc->connection,
-         MHD_HTTP_FORBIDDEN,
-         TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID,
-         NULL);
+    GNUNET_break_op (0);
+    return TALER_MHD_reply_with_error (
+      rc->connection,
+      MHD_HTTP_FORBIDDEN,
+      TALER_EC_DONAU_CHARITY_SIGNATURE_INVALID,
+      NULL);
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "charity signature valid!");
+              "charity signature valid!");
   /* request already made? -> idempotent */
   enum GNUNET_DB_QueryStatus qs_check_receipts;
   struct DONAUDB_IssuedReceiptsMetaData check_receipts_meta;
@@ -219,26 +223,26 @@ DH_handler_issue_receipts_post (struct DH_RequestContext 
*rc,
                       &bkp_hash.hash);
 
   qs_check_receipts = DH_plugin->lookup_issued_receipts (DH_plugin->cls,
-                                                                       
bkp_hash,
-                                                                       
&check_receipts_meta);
+                                                         bkp_hash,
+                                                         &check_receipts_meta);
   switch (qs_check_receipts)
   {
   case GNUNET_DB_STATUS_HARD_ERROR:
   case GNUNET_DB_STATUS_SOFT_ERROR:
-       GNUNET_break (0);
-       return TALER_MHD_reply_with_error (rc->connection,
-                                                                          
MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                                                          
TALER_EC_GENERIC_DB_FETCH_FAILED,
-                                                                          
NULL);
+    GNUNET_break (0);
+    return TALER_MHD_reply_with_error (rc->connection,
+                                       MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                       TALER_EC_GENERIC_DB_FETCH_FAILED,
+                                       NULL);
   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
-         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                                 "request have not been made yet (first 
time)!");
-       break; // it's the first request from the charity, we can proceed
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "request have not been made yet (first time)!");
+    break; // it's the first request from the charity, we can proceed
   case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
-         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                                 "request have been made already!");
-         // A request was already made. We do not change the annual limit
-       break;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "request have been made already!");
+    // A request was already made. We do not change the annual limit
+    break;
   }
   /* check annual limit and change it -> Rollback if we could not save the 
request*/
   /* save Request (charity signature, charity id, amount, hash over bkps) and 
make it idempotent*/
@@ -246,33 +250,37 @@ DH_handler_issue_receipts_post (struct DH_RequestContext 
*rc,
   int i = 0;
   json_t *blind_signatures;
   blind_signatures = json_array ();
-  while (i < num_bkp) {
-         struct DONAU_BlindedDonationUnitSignature du_sig;
-         // TODO: get donation unit private key
-         const struct DONAU_DonationUnitPrivateKey du_priv;
-         const struct DONAU_BlindedUniqueDonationIdentifier budi = 
irc.bkp[i].blinded_udi;
-         if (GNUNET_SYSERR == TALER_donation_unit_sign_blinded(&du_sig, 
&du_priv, &budi)) {
-                       GNUNET_break (0);
-                       return TALER_MHD_reply_with_error (rc->connection,
-                                                                               
           MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                                                               
           TALER_EC_GENERIC_DB_FETCH_FAILED,
-                                                                               
           NULL);
-         }
-         GNUNET_assert (
-           0 == json_array_append (
-             blind_signatures,
-             GNUNET_JSON_PACK (
-               GNUNET_JSON_pack_data_auto ("du_sig",
-                                           &du_sig))));
+  while (i < num_bkp)
+  {
+    struct DONAU_BlindedDonationUnitSignature du_sig;
+    // TODO: get donation unit private key
+    const struct DONAU_DonationUnitPrivateKey du_priv;
+    const struct DONAU_BlindedUniqueDonationIdentifier budi = irc.bkp[i].
+                                                              blinded_udi;
+    if (GNUNET_SYSERR == TALER_donation_unit_sign_blinded (&du_sig, &du_priv, &
+                                                           budi))
+    {
+      GNUNET_break (0);
+      return TALER_MHD_reply_with_error (rc->connection,
+                                         MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                         TALER_EC_GENERIC_DB_FETCH_FAILED,
+                                         NULL);
+    }
+    GNUNET_assert (
+      0 == json_array_append (
+        blind_signatures,
+        GNUNET_JSON_PACK (
+          GNUNET_JSON_pack_data_auto ("du_sig",
+                                      &du_sig))));
   }
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                         "made blind signatures!");
+              "made blind signatures!");
   return TALER_MHD_REPLY_JSON_PACK (
     rc->connection,
-       MHD_HTTP_OK,
+    MHD_HTTP_OK,
     GNUNET_JSON_pack_array_steal ("blind_signatures",
-                                                       blind_signatures));
+                                  blind_signatures));
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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