From 3e8be4c4f824a09df14734ac4ccb9bcc5b2535d2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 2 Aug 2021 11:27:16 +0200 Subject: -doxygen fixes --- src/include/anastasis_crypto_lib.h | 6 +- src/include/anastasis_json.h | 4 +- src/include/anastasis_testing_lib.h | 46 +++--- src/include/gettext.h | 302 ++++++++++++++++++++++++++++++++---- src/include/platform.h | 2 +- 5 files changed, 302 insertions(+), 58 deletions(-) (limited to 'src/include') diff --git a/src/include/anastasis_crypto_lib.h b/src/include/anastasis_crypto_lib.h index bf29b27..ee3ef16 100644 --- a/src/include/anastasis_crypto_lib.h +++ b/src/include/anastasis_crypto_lib.h @@ -14,7 +14,7 @@ Anastasis; see the file COPYING.GPL. If not, see */ /** - * @file lib/anastasis_cryto_lib.h + * @file include/anastasis_crypto_lib.h * @brief anastasis crypto api * @author Christian Grothoff * @author Dominik Meister @@ -370,7 +370,7 @@ ANASTASIS_CRYPTO_recovery_document_encrypt ( * are the first 48Byte of the data. * * @param id Hashed User input, used for the generation of the encryption key - * @param enc_rec_doc, contains the encrypted recovery document and the nonce and iv used for the encryption. + * @param enc_rec_doc contains the encrypted recovery document and the nonce and iv used for the encryption. * @param erd_size size of the data * @param[out] rec_doc return from the result, which contains the encrypted recovery document * and the nonce and iv used for the encryption as Additional Data @@ -464,7 +464,7 @@ ANASTASIS_CRYPTO_truth_decrypt ( * A key share is randomly generated, one key share is generated for every * truth a policy contains. * - * @param key_share[out] reference to the created key share. + * @param[out] key_share reference to the created key share. */ void ANASTASIS_CRYPTO_keyshare_create ( diff --git a/src/include/anastasis_json.h b/src/include/anastasis_json.h index 9e8d924..d2523a2 100644 --- a/src/include/anastasis_json.h +++ b/src/include/anastasis_json.h @@ -14,7 +14,7 @@ Anastasis; see the file COPYING.GPL. If not, see */ /** - * @file lib/anastasis_json.h + * @file include/anastasis_json.h * @brief anastasis de-/serialization api * @author Christian Grothoff * @author Dominik Meister @@ -407,4 +407,4 @@ ANASTASIS_apply_anastasis_recovery_action ( struct ANASTASIS_RecoveryAction *ra, ANASTASIS_RecoveryApplyActionCallback cb); -#endif /* _ANASTASIS_JSON_H */ \ No newline at end of file +#endif /* _ANASTASIS_JSON_H */ diff --git a/src/include/anastasis_testing_lib.h b/src/include/anastasis_testing_lib.h index a54e3ae..80018d9 100644 --- a/src/include/anastasis_testing_lib.h +++ b/src/include/anastasis_testing_lib.h @@ -62,7 +62,7 @@ ANASTASIS_TESTING_get_trait_hash (const struct TALER_TESTING_Command *cmd, * * @param index the number's index number. * @param h the hash to offer. - * @return #GNUNET_OK on success. + * @return trait on success. */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_hash (unsigned int index, @@ -89,7 +89,7 @@ ANASTASIS_TESTING_get_trait_truth_key ( * * @param index usually zero * @param h the account_pub to offer. - * @return #GNUNET_OK on success. + * @return trait on success. */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_truth_key ( @@ -118,7 +118,7 @@ ANASTASIS_TESTING_get_trait_account_pub ( * * @param index usually zero * @param h the account_pub to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_account_pub ( @@ -147,7 +147,7 @@ ANASTASIS_TESTING_get_trait_account_priv ( * * @param index usually zero * @param priv the account_priv to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_account_priv ( @@ -175,7 +175,7 @@ ANASTASIS_TESTING_get_trait_payment_secret ( * * @param index usually zero * @param h the payment secret to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_payment_secret ( @@ -188,27 +188,27 @@ ANASTASIS_TESTING_make_trait_payment_secret ( * * @param cmd command to extract the number from. * @param index the number's index number. - * @param[out] uuid set to the number coming from @a cmd. + * @param[out] tpk set to the number coming from @a cmd. * @return #GNUNET_OK on success. */ int ANASTASIS_TESTING_get_trait_truth_uuid ( const struct TALER_TESTING_Command *cmd, unsigned int index, - const struct ANASTASIS_CRYPTO_TruthUUIDP **uuid); + const struct ANASTASIS_CRYPTO_TruthUUIDP **tpk); /** * Offer a truth UUID. * * @param index the number's index number. - * @param uuid the UUID to offer. - * @return #GNUNET_OK on success. + * @param tpk the UUID to offer. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_truth_uuid ( unsigned int index, - const struct ANASTASIS_CRYPTO_TruthUUIDP *uuid); + const struct ANASTASIS_CRYPTO_TruthUUIDP *tpk); /** @@ -231,7 +231,7 @@ ANASTASIS_TESTING_get_trait_eks ( * * @param index the number's index number. * @param eks the encrypted key share to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_eks ( @@ -259,7 +259,7 @@ ANASTASIS_TESTING_get_trait_code ( * * @param index the number's index number. * @param tpk the public key to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_code (unsigned int index, @@ -515,8 +515,8 @@ ANASTASIS_TESTING_get_trait_salt ( * Offer an salt. * * @param index the salt's index number. - * @param u the salt to offer. - * @return #GNUNET_OK on success. + * @param s the salt to offer. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_salt ( @@ -559,7 +559,7 @@ ANASTASIS_TESTING_get_trait_truth (const struct TALER_TESTING_Command *cmd, * * @param index the truth's index number. * @param t the truth to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_truth (unsigned int index, @@ -617,7 +617,7 @@ ANASTASIS_TESTING_cmd_truth_upload ( * @param answer the answer to the security question * @param http_status expected HTTP status * @param tso truth upload options - * @param upload_ref reference to the previous upload + * @param salt_ref reference to command downloading provider salt * @return the command */ struct TALER_TESTING_Command @@ -652,8 +652,8 @@ ANASTASIS_TESTING_get_trait_policy (const struct TALER_TESTING_Command *cmd, * Offer a policy. * * @param index the policy's index number. - * @param t the policy to offer. - * @return #GNUNET_OK on success. + * @param p the policy to offer. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_policy (unsigned int index, @@ -694,7 +694,7 @@ ANASTASIS_TESTING_get_trait_core_secret (const struct * * @param index the core secret's index number (usually 0). * @param s the core secret to offer. - * @return #GNUNET_OK on success. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_core_secret (unsigned int index, @@ -785,6 +785,8 @@ enum ANASTASIS_TESTING_RecoverSecretOption * @param version of the recovery document to download * @param rso recover secret options * @param download_ref salt download reference + * @param core_secret_ref reference to core secret + * we expect to recover * @return the command */ struct TALER_TESTING_Command @@ -831,8 +833,8 @@ ANASTASIS_TESTING_get_trait_challenge (const struct TALER_TESTING_Command *cmd, * Offer a challenge. * * @param index the challenge index number. - * @param c the challenge to offer. - * @return #GNUNET_OK on success. + * @param r the challenge to offer. + * @return trait on success */ struct TALER_TESTING_Trait ANASTASIS_TESTING_make_trait_challenge (unsigned int index, @@ -867,6 +869,8 @@ ANASTASIS_TESTING_cmd_challenge_start ( * @param challenge_ref reference to the recovery process * @param challenge_index defines the index of the trait to solve * @param answer to the challenge + * @param mode 0 for no plugin needed (security question) + * 1 for plugin needed to authenticate * @param expected_cs expected reply type * @return the command */ diff --git a/src/include/gettext.h b/src/include/gettext.h index 4585126..705487b 100644 --- a/src/include/gettext.h +++ b/src/include/gettext.h @@ -1,29 +1,40 @@ /* Convenience header for conditional use of GNU . - Copyright Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2020 Free Software + Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 3, or (at your option) - any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ #ifndef _LIBGETTEXT_H #define _LIBGETTEXT_H 1 -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS +/* NLS can be disabled through the configure --disable-nls option + or through "#define ENABLE NLS 0" before including this file. */ +#if defined ENABLE_NLS && ENABLE_NLS /* Get declarations of GNU message catalog functions. */ -#include +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif #else @@ -32,9 +43,19 @@ later inclusions of a NOP. We don't include as well because people using "gettext.h" will not include , and also including would fail on SunOS 4, whereas - is GNUNET_OK. */ + is OK. */ #if defined(__sun) -#include +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2 && ! defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif #endif /* Disabled NLS. @@ -42,21 +63,39 @@ for invalid uses of the value returned from these functions. On pre-ANSI systems without 'const', the config.h file is supposed to contain "#define const". */ -#define gettext(Msgid) ((const char *) (Msgid)) -#define dgettext(Domainname, Msgid) ((const char *) (Msgid)) -#define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -#define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -#define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -#define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -/* slight modification here to avoid warnings: generate GNUNET_NO code, - not even the cast... */ -#define textdomain(Domainname) -#define bindtextdomain(Domainname, Dirname) -#define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) +# undef gettext +# define gettext(Msgid) ((const char *) (Msgid)) +# undef dgettext +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# undef dcgettext +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# undef dngettext +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# undef dcngettext +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) +# undef textdomain +# define textdomain(Domainname) ((const char *) (Domainname)) +# undef bindtextdomain +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# undef bind_textdomain_codeset +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif +/* Prefer gnulib's setlocale override over libintl's setlocale override. */ +#ifdef GNULIB_defined_setlocale +# undef setlocale +# define setlocale rpl_setlocale #endif /* A pseudo function call that serves as a marker for the automated @@ -68,4 +107,205 @@ initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, \ + LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, \ + LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, \ + MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, \ + N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, \ + MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, \ + MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if ((translation == msg_ctxt_id) || (translation == msgid_plural)) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. + This relates to the -Wvla and -Wvla-larger-than warnings, enabled in + the default GCC many warnings set. This allows programs to disable use + of VLAs, which may be unintended, or may be awkward to support portably, + or may have security implications due to non-deterministic stack usage. */ + +#if (! defined GNULIB_NO_VLA \ + && (((__GNUC__ >= 3 || __GNUG__ >= 2) && ! defined __STRICT_ANSI__) \ + /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */)) +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 +#else +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 +#endif + +#if ! _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + int found_translation; + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); + found_translation = (translation != msg_ctxt_id); +#if ! _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (found_translation) + return translation; + } + return msgid; +} + + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + int found_translation; + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + found_translation = ! (translation == msg_ctxt_id || translation == + msgid_plural); +#if ! _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (found_translation) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + + #endif /* _LIBGETTEXT_H */ diff --git a/src/include/platform.h b/src/include/platform.h index 04a2dce..d4b8bbe 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -15,7 +15,7 @@ */ /** - * @file include/platform.h + * @file anastasis/src/include/platform.h * @brief This file contains the includes and definitions which are used by the * rest of the modules * @author Sree Harsha Totakura -- cgit v1.2.3