gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: Fix age mask parsing from config


From: gnunet
Subject: [taler-exchange] branch master updated: Fix age mask parsing from config
Date: Tue, 09 May 2023 21:46:17 +0200

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

oec pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new dc5b0fb0 Fix age mask parsing from config
dc5b0fb0 is described below

commit dc5b0fb0d35b9758f6eac7b0bd144db00eef7216
Author: Özgür Kesim <oec-taler@kesim.org>
AuthorDate: Tue May 9 20:40:43 2023 +0200

    Fix age mask parsing from config
    
    - initialize age mask to zero
    - drop default bitstring for age mask, use string instead
    
    -remove default age mask bits, use string instead
    
    -strdup
---
 src/extensions/age_restriction/age_restriction.c | 6 +++---
 src/include/taler_extensions.h                   | 4 ----
 src/util/age_restriction.c                       | 3 +++
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/extensions/age_restriction/age_restriction.c 
b/src/extensions/age_restriction/age_restriction.c
index 2d6d0cbd..481cb133 100644
--- a/src/extensions/age_restriction/age_restriction.c
+++ b/src/extensions/age_restriction/age_restriction.c
@@ -207,10 +207,10 @@ libtaler_extension_age_restriction_init (void *arg)
     return NULL;
   }
 
-  mask.bits = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK;
+  if (NULL == groups)
+    groups = GNUNET_strdup 
(TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_GROUPS);
 
-  if ((groups != NULL) &&
-      (GNUNET_OK != TALER_parse_age_group_string (groups, &mask)))
+  if (GNUNET_OK != TALER_parse_age_group_string (groups, &mask))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "[age restriction] couldn't parse age groups: '%s'\n",
diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h
index bd5b7248..75f22534 100644
--- a/src/include/taler_extensions.h
+++ b/src/include/taler_extensions.h
@@ -344,10 +344,6 @@ TALER_extensions_verify_manifests_signature (
  * The default age mask represents the age groups
  * 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-20, 21-...
  */
-#define TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK (1 | 1 << 8 | 1 << 10 
\
-                                                          | 1 << 12 | 1 << 14 \
-                                                          | 1 << 16 | 1 << 18 \
-                                                          | 1 << 21)
 #define TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_GROUPS 
"8:10:12:14:16:18:21"
 
 
diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c
index beb68e5a..cf81d915 100644
--- a/src/util/age_restriction.c
+++ b/src/util/age_restriction.c
@@ -513,6 +513,9 @@ TALER_parse_age_group_string (
   unsigned int val = 0;
   char c;
 
+  /* reset mask */
+  mask->bits = 0;
+
   while (*pos)
   {
     c = *pos++;

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