gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: uncrustify


From: gnunet
Subject: [taler-anastasis] branch master updated: uncrustify
Date: Mon, 05 Oct 2020 19:07:56 +0200

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

ds-meister pushed a commit to branch master
in repository anastasis.

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

commit d64a4030d576cc2ced91583753b747333f295e8b
Author: Dominik Meister <dominik.meister@hotmail.ch>
AuthorDate: Mon Oct 5 19:07:42 2020 +0200

    uncrustify
---
 src/backend/anastasis-httpd_truth.c     |   6 +-
 src/include/anastasis_database_plugin.h |  36 +++----
 src/stasis/plugin_anastasis_postgres.c  | 173 +++++++++++++++++---------------
 src/stasis/test_anastasis_db.c          |   8 +-
 4 files changed, 118 insertions(+), 105 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 8fdc280..eb5d3e2 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -336,7 +336,7 @@ proposal_cb (void *cls,
   {
     GNUNET_break (0);
     gc->resp = TALER_MHD_make_error (TALER_EC_SYNC_PAYMENT_CREATE_DB_ERROR,
-                                      "Failed to persist payment request in 
anastasis database");
+                                     "Failed to persist payment request in 
anastasis database");
     gc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
     return;
   }
@@ -451,7 +451,7 @@ check_payment_cb (void *cls,
       return; /* continue as planned */
     GNUNET_break (0);
     gc->resp = TALER_MHD_make_error (TALER_EC_SYNC_PAYMENT_CONFIRM_DB_ERROR,
-                                      "Failed to persist payment confirmation 
in sync database");
+                                     "Failed to persist payment confirmation 
in sync database");
     gc->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
     return; /* continue as planned */
   }
@@ -468,7 +468,7 @@ check_payment_cb (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Timeout waiting for payment\n");
   gc->resp = TALER_MHD_make_error (TALER_EC_SYNC_PAYMENT_TIMEOUT,
-                                    "Timeout awaiting promised payment");
+                                   "Timeout awaiting promised payment");
   GNUNET_assert (NULL != gc->resp);
   gc->response_code = MHD_HTTP_REQUEST_TIMEOUT;
 }
diff --git a/src/include/anastasis_database_plugin.h 
b/src/include/anastasis_database_plugin.h
index 395903a..1c0f31a 100644
--- a/src/include/anastasis_database_plugin.h
+++ b/src/include/anastasis_database_plugin.h
@@ -362,8 +362,8 @@ struct ANASTASIS_DatabasePlugin
  * @param valid_counter[OUT] bool value to show if post_counter is > 0
  * @return transaction status
  */
- enum ANASTASIS_DB_QueryStatus
- (*check_challenge_payment) (void *cls,
+  enum ANASTASIS_DB_QueryStatus
+  (*check_challenge_payment)(void *cls,
                              const struct
                              ANASTASIS_PaymentSecretP *payment_secret,
                              bool *paid);
@@ -403,7 +403,8 @@ struct ANASTASIS_DatabasePlugin
                            const struct
                            ANASTASIS_CRYPTO_AccountPublicKeyP *anastasis_pub,
                            uint32_t post_counter,
-                           const struct ANASTASIS_PaymentSecretP 
*payment_secret,
+                           const struct
+                           ANASTASIS_PaymentSecretP *payment_secret,
                            const struct TALER_Amount *amount);
 
   /**
@@ -452,12 +453,13 @@ struct ANASTASIS_DatabasePlugin
    * @param amount how much we asked for
    * @return transaction status
    */
-   enum ANASTASIS_DB_QueryStatus
-  (*record_challenge_payment) (void *cls,
-                               const struct
-                               ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
-                               const struct ANASTASIS_PaymentSecretP 
*payment_secret,
-                               const struct TALER_Amount *amount);
+  enum ANASTASIS_DB_QueryStatus
+  (*record_challenge_payment)(void *cls,
+                              const struct
+                              ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
+                              const struct
+                              ANASTASIS_PaymentSecretP *payment_secret,
+                              const struct TALER_Amount *amount);
 
   /**
    * Lookup for a pending payment for a certain challenge
@@ -467,8 +469,8 @@ struct ANASTASIS_DatabasePlugin
    * @param cp returns a challenge payment struct
    * @return transaction status
    */
-   enum ANASTASIS_DB_QueryStatus
-   (*lookup_challenge_payment)(void *cls,
+  enum ANASTASIS_DB_QueryStatus
+  (*lookup_challenge_payment)(void *cls,
                               const struct
                               ANASTASIS_CRYPTO_TruthPublicKeyP
                               *truth_public_key,
@@ -482,12 +484,12 @@ struct ANASTASIS_DatabasePlugin
    * @param payment_identifier proof of payment, must be unique and match 
pending payment
    * @return transaction status
    */
-   enum ANASTASIS_DB_QueryStatus
-   (*update_challenge_payment)(void *cls,
-                               const struct
-                               ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
-                               const struct
-                               ANASTASIS_PaymentSecretP *payment_identifier);
+  enum ANASTASIS_DB_QueryStatus
+  (*update_challenge_payment)(void *cls,
+                              const struct
+                              ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
+                              const struct
+                              ANASTASIS_PaymentSecretP *payment_identifier);
   /**
    * FIXME maybe implemented in the postgres_gc but want it seperate first
    * Function called to remove all expired codes in the database
diff --git a/src/stasis/plugin_anastasis_postgres.c 
b/src/stasis/plugin_anastasis_postgres.c
index f632aaa..b658099 100644
--- a/src/stasis/plugin_anastasis_postgres.c
+++ b/src/stasis/plugin_anastasis_postgres.c
@@ -75,13 +75,17 @@ postgres_drop_tables (void *cls)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_ExecuteStatement es[] = {
-    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_truth 
CASCADE;"),
+    GNUNET_PQ_make_try_execute (
+      "DROP TABLE IF EXISTS anastasis_truth CASCADE;"),
     GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS anastasis_user 
CASCADE;"),
-    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS 
anastasis_recdoc_payment;"),
+    GNUNET_PQ_make_try_execute (
+      "DROP TABLE IF EXISTS anastasis_recdoc_payment;"),
     GNUNET_PQ_make_try_execute (
       "DROP TABLE IF EXISTS anastasis_recoverydocument;"),
-    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS 
anastasis_challengecode;"),
-    GNUNET_PQ_make_try_execute ("DROP TABLE IF EXISTS 
anastasis_challenge_payment;"),
+    GNUNET_PQ_make_try_execute (
+      "DROP TABLE IF EXISTS anastasis_challengecode;"),
+    GNUNET_PQ_make_try_execute (
+      "DROP TABLE IF EXISTS anastasis_challenge_payment;"),
     GNUNET_PQ_EXECUTE_STATEMENT_END
   };
   return GNUNET_PQ_exec_statements (pg->conn,
@@ -852,9 +856,11 @@ postgres_increment_lifetime (void *cls,
 static enum ANASTASIS_DB_QueryStatus
 postgres_record_recdoc_payment (void *cls,
                                 const struct
-                                ANASTASIS_CRYPTO_AccountPublicKeyP 
*anastasis_pub,
+                                ANASTASIS_CRYPTO_AccountPublicKeyP *
+                                anastasis_pub,
                                 uint32_t post_counter,
-                                const struct ANASTASIS_PaymentSecretP 
*payment_secret,
+                                const struct
+                                ANASTASIS_PaymentSecretP *payment_secret,
                                 const struct TALER_Amount *amount)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -991,8 +997,10 @@ postgres_record_recdoc_payment (void *cls,
 static enum ANASTASIS_DB_QueryStatus
 postgres_record_challenge_payment (void *cls,
                                    const struct
-                                   ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
-                                   const struct ANASTASIS_PaymentSecretP 
*payment_secret,
+                                   ANASTASIS_CRYPTO_TruthPublicKeyP *
+                                   truth_public_key,
+                                   const struct
+                                   ANASTASIS_PaymentSecretP *payment_secret,
                                    const struct TALER_Amount *amount)
 {
   struct PostgresClosure *pg = cls;
@@ -1005,39 +1013,39 @@ postgres_record_challenge_payment (void *cls,
               __FILE__,
               __LINE__,
               TALER_B2S (truth_public_key));
-              /*dummy funcion to check if truth is available*/
-                void *truth;
-                size_t truth_size;
-                char *truth_mime;
-                char *method;
-
-
-                {
-                  // because of constraint at truth_id, first we have to verify
-                  // if the challenge exists
-                  struct GNUNET_PQ_QueryParam params[] = {
-                    GNUNET_PQ_query_param_auto_from_type (truth_public_key),
-                    GNUNET_PQ_query_param_end
-                  };
-                  struct GNUNET_PQ_ResultSpec rs[] = {
-                    GNUNET_PQ_result_spec_variable_size ("encrypted_truth",
-                                                         &truth,
-                                                         &truth_size),
-                    GNUNET_PQ_result_spec_string ("truth_mime",
-                                                  &truth_mime),
-                    GNUNET_PQ_result_spec_string ("method",
-                                                  &method),
-                    GNUNET_PQ_result_spec_end
-                  };
-                  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                                 
"truth_select",
-                                                                 params,
-                                                                 rs);
-                  if (qs != 1)
-                  {
-                    return qs;
-                  }
-                }
+  /*dummy funcion to check if truth is available*/
+  void *truth;
+  size_t truth_size;
+  char *truth_mime;
+  char *method;
+
+
+  {
+    // because of constraint at truth_id, first we have to verify
+    // if the challenge exists
+    struct GNUNET_PQ_QueryParam params[] = {
+      GNUNET_PQ_query_param_auto_from_type (truth_public_key),
+      GNUNET_PQ_query_param_end
+    };
+    struct GNUNET_PQ_ResultSpec rs[] = {
+      GNUNET_PQ_result_spec_variable_size ("encrypted_truth",
+                                           &truth,
+                                           &truth_size),
+      GNUNET_PQ_result_spec_string ("truth_mime",
+                                    &truth_mime),
+      GNUNET_PQ_result_spec_string ("method",
+                                    &method),
+      GNUNET_PQ_result_spec_end
+    };
+    qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                   "truth_select",
+                                                   params,
+                                                   rs);
+    if (qs != 1)
+    {
+      return qs;
+    }
+  }
 
   if (GNUNET_OK != begin_transaction (pg,
                                       "store_truth"))
@@ -1710,34 +1718,34 @@ postgres_lookup_challenge_payment (void *cls,
                                  pg->currency,
                                  &amount),
     GNUNET_PQ_result_spec_end
-   };
+  };
 
-   qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
-                                                  
"challenge_pending_payment_select",
-                                                  params,
-                                                  rs);
+  qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+                                                 
"challenge_pending_payment_select",
+                                                 params,
+                                                 rs);
   switch (qs)
   {
-   case GNUNET_DB_STATUS_HARD_ERROR:
+  case GNUNET_DB_STATUS_HARD_ERROR:
     return ANASTASIS_DB_STATUS_HARD_ERROR;
-   case GNUNET_DB_STATUS_SOFT_ERROR:
+  case GNUNET_DB_STATUS_SOFT_ERROR:
     return ANASTASIS_DB_STATUS_SOFT_ERROR;
-   case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+  case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
     return ANASTASIS_DB_STATUS_NO_RESULTS;
-   case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+  case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
     break;
-   default:
+  default:
     GNUNET_break (0);
     return ANASTASIS_DB_STATUS_HARD_ERROR;
-   }
+  }
 
-    char *order_id;
-    order_id = GNUNET_STRINGS_data_to_string_alloc (&payment_identifier,
-                                                    sizeof (struct
-                                                            
ANASTASIS_PaymentSecretP));
-    cp->payment_identifier = order_id;
-    cp->amount = &amount;
-    return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
+  char *order_id;
+  order_id = GNUNET_STRINGS_data_to_string_alloc (&payment_identifier,
+                                                  sizeof (struct
+                                                          
ANASTASIS_PaymentSecretP));
+  cp->payment_identifier = order_id;
+  cp->amount = &amount;
+  return ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT;
 }
 
 /**
@@ -1751,7 +1759,8 @@ postgres_lookup_challenge_payment (void *cls,
 enum ANASTASIS_DB_QueryStatus
 postgres_update_challenge_payment (void *cls,
                                    const struct
-                                   ANASTASIS_CRYPTO_TruthPublicKeyP 
*truth_public_key,
+                                   ANASTASIS_CRYPTO_TruthPublicKeyP *
+                                   truth_public_key,
                                    const struct
                                    ANASTASIS_PaymentSecretP 
*payment_identifier)
 {
@@ -1781,13 +1790,13 @@ postgres_update_challenge_payment (void *cls,
     {
 
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "ROLLBACK %d", qs);
+                  "ROLLBACK %d", qs);
       /* payment made before, or unknown, or error => no further action! */
       rollback (pg);
       return qs;
     }
     qs = commit_transaction (pg);
-      if (qs < 0)
+    if (qs < 0)
     {
       return qs;
     }
@@ -1968,25 +1977,27 @@ libanastasis_plugin_db_postgres_init (void *cls)
                             "( user_id BYTEA PRIMARY KEY 
CHECK(LENGTH(user_id)=32),"
                             "  expiration_date TIMESTAMP NOT NULL"
                             ");"),
-    GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS 
anastasis_recdoc_payment"
-                            "(payment_id BIGSERIAL PRIMARY KEY,"
-                            " user_id BYTEA NOT NULL REFERENCES 
anastasis_user(user_id),"
-                            " post_counter INT4 NOT NULL DEFAULT 0 
CHECK(post_counter >= 0),"
-                            " amount_val INT8 NOT NULL," /* amount we were 
paid */
-                            " amount_frac INT4 NOT NULL,"
-                            " payment_identifier BYTEA NOT NULL 
CHECK(LENGTH(payment_identifier)=32),"
-                            " timestamp TIMESTAMP NOT NULL DEFAULT NOW(),"
-                            " paid BOOLEAN NOT NULL DEFAULT FALSE"
-                            ");"),
-    GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS 
anastasis_challenge_payment"
-                            "(payment_id BIGSERIAL PRIMARY KEY,"
-                            " truth_public_key BYTEA NOT NULL,"
-                            " amount_val INT8 NOT NULL," /* amount we were 
paid */
-                            " amount_frac INT4 NOT NULL,"
-                            " payment_identifier BYTEA NOT NULL 
CHECK(LENGTH(payment_identifier)=32),"
-                            " timestamp TIMESTAMP NOT NULL DEFAULT NOW(),"
-                            " paid BOOLEAN NOT NULL DEFAULT FALSE"
-                            ");"),
+    GNUNET_PQ_make_execute (
+      "CREATE TABLE IF NOT EXISTS anastasis_recdoc_payment"
+      "(payment_id BIGSERIAL PRIMARY KEY,"
+      " user_id BYTEA NOT NULL REFERENCES anastasis_user(user_id),"
+      " post_counter INT4 NOT NULL DEFAULT 0 CHECK(post_counter >= 0),"
+      " amount_val INT8 NOT NULL,"                       /* amount we were 
paid */
+      " amount_frac INT4 NOT NULL,"
+      " payment_identifier BYTEA NOT NULL 
CHECK(LENGTH(payment_identifier)=32),"
+      " timestamp TIMESTAMP NOT NULL DEFAULT NOW(),"
+      " paid BOOLEAN NOT NULL DEFAULT FALSE"
+      ");"),
+    GNUNET_PQ_make_execute (
+      "CREATE TABLE IF NOT EXISTS anastasis_challenge_payment"
+      "(payment_id BIGSERIAL PRIMARY KEY,"
+      " truth_public_key BYTEA NOT NULL,"
+      " amount_val INT8 NOT NULL,"                       /* amount we were 
paid */
+      " amount_frac INT4 NOT NULL,"
+      " payment_identifier BYTEA NOT NULL 
CHECK(LENGTH(payment_identifier)=32),"
+      " timestamp TIMESTAMP NOT NULL DEFAULT NOW(),"
+      " paid BOOLEAN NOT NULL DEFAULT FALSE"
+      ");"),
     GNUNET_PQ_make_execute (
       "CREATE TABLE IF NOT EXISTS anastasis_recoverydocument"
       "( user_id BYTEA NOT NULL REFERENCES anastasis_user(user_id),"
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 4977883..f283105 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -287,14 +287,14 @@ run (void *cls)
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->update_challenge_payment (plugin->cls,
-                                           &truth_public_key,
-                                           &paymentSecretP));
+                                            &truth_public_key,
+                                            &paymentSecretP));
 
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->check_challenge_payment (plugin->cls,
-                                          &paymentSecretP,
-                                          &paid));
+                                           &paymentSecretP,
+                                           &paid));
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_recovery_document (plugin->cls,

-- 
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]