[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libfints] branch master updated: Minor changes.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libfints] branch master updated: Minor changes. |
Date: |
Mon, 08 Oct 2018 15:53:55 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libfints.
The following commit(s) were added to refs/heads/master by this push:
new 1df7cce Minor changes.
1df7cce is described below
commit 1df7cce3c2efd48a17e42b37a6e498729badc797
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Oct 8 15:53:04 2018 +0200
Minor changes.
Fixing (some) indentation and putting 'const' where needed.
---
src/libebics.c | 81 +++++++++++++++++++++++++++++-------------------------
src/libebics.h | 4 ++-
src/message_dump.c | 2 +-
src/xmlmessages.c | 12 +++++---
src/xmlproto.c | 74 +++++++++++++++++++++++++++++++------------------
src/xmlproto.h | 3 +-
6 files changed, 105 insertions(+), 71 deletions(-)
diff --git a/src/libebics.c b/src/libebics.c
index 50ffece..7f32acc 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -283,11 +283,11 @@ EBICS_free_keymaterial (struct EBICS_Key keyList[])
* Load and parse all needed genex-style documents and create xpath contexts.
*
* @returns EBICS_SUCCESS on success, else EBICS_ERROR.
- *
- * TODO: Rewrite once genex documents are integrated into a c-file?
*/
int
-EBICS_init_genex_documents(struct EBICS_genex_document genexList[], char
*genex_schemas_dir, char *genexFiles[])
+EBICS_init_genex_documents(struct EBICS_genex_document genexList[],
+ const char *genex_schemas_dir,
+ const char *genexFiles[])
{
LOG (EBICS_LOGLEVEL_DEBUG, "Initializing 'genex_documents'");
@@ -349,56 +349,54 @@ EBICS_free_genex_documents (struct EBICS_genex_document
genexList[])
int
-EBICS_init_library()
+EBICS_init_library ()
{
int retv;
- xmlInitParser();
+ xmlInitParser ();
- retv = init_libgcrypt();
- if(retv)
- return(retv);
+ retv = init_libgcrypt ();
+ if (retv)
+ return (retv);
- retv= init_libxmlsec();
- if(retv)
- return(retv);
+ retv = init_libxmlsec ();
+ if (retv)
+ return (retv);
- retv= init_libgnutls();
- if(retv)
- return(retv);
+ retv = init_libgnutls ();
+ if (retv)
+ return (retv);
- retv= init_zlib();
- if(retv)
- return(retv);
+ retv = init_zlib ();
+ if (retv)
+ return (retv);
}
int
-EBICS_close_library()
+EBICS_close_library ()
{
int retv;
- retv = free_libgcrypt();
- if(retv)
- return(retv);
+ retv = free_libgcrypt ();
+ if (retv)
+ return (retv);
- retv= free_libxmlsec();
- if(retv)
- return(retv);
+ retv = free_libxmlsec ();
+ if (retv)
+ return (retv);
- retv= free_libgnutls();
- if(retv)
- return(retv);
+ retv = free_libgnutls ();
+ if (retv)
+ return (retv);
- retv= free_zlib();
- if(retv)
- return(retv);
+ retv = free_zlib ();
+ if (retv)
+ return (retv);
- xmlCleanupParser();
+ xmlCleanupParser ();
/* cleanup */
}
-/* TODO: Use short name typedefs? */
-//typedef struct EBICS_genex_document* EBICS_s_genexDocPtr;
int
EBICS_generate_message_ini (struct EBICS_genex_document *document,
@@ -407,13 +405,16 @@ EBICS_generate_message_ini (struct EBICS_genex_document
*document,
{
struct EBICS_MSG_Spec foo[] = {
- EBICS_MSG_op_subcommand(EBICS_build_header_ebicsUnsecuredRequest,
headerArgs,NULL),
- EBICS_MSG_op_subcommand(EBICS_build_content_ini ,iniArgs,
iniArgs->document),
+ EBICS_MSG_op_subcommand(EBICS_build_header_ebicsUnsecuredRequest,
+ headerArgs,
+ NULL),
+ EBICS_MSG_op_subcommand(EBICS_build_content_ini,
+ iniArgs,
+ iniArgs->document),
EBICS_MSG_op_clean(),
EBICS_MSG_op_end()
};
-
EBICS_MSG_parse_spec(foo, document);
}
@@ -424,8 +425,12 @@ EBICS_generate_message_hia (struct EBICS_genex_document
*document,
{
struct EBICS_MSG_Spec foo[] = {
- EBICS_MSG_op_subcommand(EBICS_build_header_ebicsUnsecuredRequest,
headerArgs,NULL),
- EBICS_MSG_op_subcommand(EBICS_build_content_hia ,hiaArgs,
hiaArgs->document),
+ EBICS_MSG_op_subcommand(EBICS_build_header_ebicsUnsecuredRequest,
+ headerArgs,
+ NULL),
+ EBICS_MSG_op_subcommand(EBICS_build_content_hia,
+ hiaArgs,
+ hiaArgs->document),
EBICS_MSG_op_clean(),
EBICS_MSG_op_end()
};
diff --git a/src/libebics.h b/src/libebics.h
index d1f4211..da17d72 100644
--- a/src/libebics.h
+++ b/src/libebics.h
@@ -42,7 +42,9 @@ int
EBICS_free_keymaterial (struct EBICS_Key keyList[]);
int
-EBICS_init_genex_documents(struct EBICS_genex_document genexList[], char
*genex_schemas_dir, char *genexFiles[]);
+EBICS_init_genex_documents(struct EBICS_genex_document genexList[],
+ const char *genex_schemas_dir,
+ const char *genexFiles[]);
int
EBICS_free_genex_documents (struct EBICS_genex_document genexList[]);
diff --git a/src/message_dump.c b/src/message_dump.c
index 7539620..6f967c4 100644
--- a/src/message_dump.c
+++ b/src/message_dump.c
@@ -35,7 +35,7 @@ main (int argc, char **argv)
"SignaturePubKeyOrderData.xml",
"HIARequestOrderData.xml",
"ebicsUnsecuredRequest.xml",
- "ebicsNoPubKeyDigestsRequest.xml",
+ "ebicsNoPubKeyDigestsRequeST.XMl",
NULL};
/* Load all existing/needed keys from disk. */
diff --git a/src/xmlmessages.c b/src/xmlmessages.c
index 8b94327..9ea54cd 100644
--- a/src/xmlmessages.c
+++ b/src/xmlmessages.c
@@ -103,10 +103,11 @@ util_extract_public_RSAKeyValue(gnutls_pubkey_t pubkey,
char **mData, char **eDa
}
void
-EBICS_build_header_generic (void *cls, struct EBICS_genex_document *document)
+EBICS_build_header_generic (void *cls,
+ struct EBICS_genex_document *document)
{
char *sigAttribute[] = {"DZHNN", "OZHNN"};
- struct EBICS_ARGS_build_header *data = (struct EBICS_ARGS_build_header*)cls;
+ struct EBICS_ARGS_build_header *data = (struct EBICS_ARGS_build_header*) cls;
struct EBICS_MSG_Spec header[] = {
EBICS_MSG_op_unique_choice("//ebics:static"),
EBICS_MSG_op_set_string("//ebics:static//ebics:HostID", data->hostID),
@@ -139,10 +140,13 @@ EBICS_build_header_ebicsRequest (void *cls, struct
EBICS_genex_document *documen
}
void
-EBICS_build_header_ebicsUnsecuredRequest (void *cls, struct
EBICS_genex_document *document)
+EBICS_build_header_ebicsUnsecuredRequest (void *cls,
+ struct EBICS_genex_document
*document)
{
struct EBICS_MSG_Spec header[] = {
- EBICS_MSG_op_subcommand(EBICS_build_header_generic ,cls, NULL),
+ EBICS_MSG_op_subcommand(EBICS_build_header_generic,
+ cls,
+ NULL),
EBICS_MSG_op_end()
};
EBICS_MSG_parse_spec(header, document);
diff --git a/src/xmlproto.c b/src/xmlproto.c
index 7072b9f..5d04e32 100644
--- a/src/xmlproto.c
+++ b/src/xmlproto.c
@@ -254,7 +254,9 @@ EBICS_MSG_op_del_node (const char *xpath)
* @param node Node that will be added as a child.
*/
struct EBICS_MSG_Spec
-EBICS_MSG_op_subcommand (EBICS_MSG_subcommand_fn subcmd, void *cls, struct
EBICS_genex_document *target)
+EBICS_MSG_op_subcommand (EBICS_MSG_subcommand_fn subcmd,
+ void *cls,
+ struct EBICS_genex_document *target)
{
struct EBICS_MSG_Spec result =
{
@@ -434,7 +436,8 @@ remove_any_nodes (struct EBICS_genex_document *document)
*
*/
static void
-process_choice (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_choice (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -465,7 +468,8 @@ process_choice (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *d
*
*/
static void
-process_unique (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_unique (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -488,7 +492,8 @@ process_unique (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *d
* Parse a set uint operation.
*/
static void
-process_uint (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_uint (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -522,7 +527,8 @@ process_uint (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *doc
* Parse a set int operation.
*/
static void
-process_int (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_int (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -556,7 +562,8 @@ process_int (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *docu
* Parse a set flag operation.
*/
static void
-process_flag (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_flag (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -593,7 +600,8 @@ process_flag (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *doc
/** Parse a set string operation.
*/
static void
-process_string (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_string (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -627,7 +635,8 @@ process_string (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *d
/** Parse a set date operation.
*/
static void
-process_date (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_date (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -662,7 +671,8 @@ process_date (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *doc
/** Parse a set attribute operation.
*/
static void
-process_attribute_set (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_attribute_set (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
xmlDocPtr doc = document->document;
@@ -694,7 +704,8 @@ process_attribute_set (struct EBICS_MSG_Spec *operation,
struct EBICS_genex_docu
}
static void
-process_attribute_del (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_attribute_del (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
int i;
@@ -722,7 +733,8 @@ process_attribute_del (struct EBICS_MSG_Spec *operation,
struct EBICS_genex_docu
}
static void
-process_attribute_add (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_attribute_add (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
int i;
@@ -756,7 +768,8 @@ process_attribute_add (struct EBICS_MSG_Spec *operation,
struct EBICS_genex_docu
/** Parse a add node operation.
*/
static void
-process_add_node (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_add_node (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
int i;
@@ -787,7 +800,8 @@ process_add_node (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document
/** Parse a delete node operation.
*/
static void
-process_del_node (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_del_node (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
xmlXPathContextPtr xpathCtxPtr = document->xpath;
int i;
@@ -819,15 +833,17 @@ process_del_node (struct EBICS_MSG_Spec *operation,
struct EBICS_genex_document
* Process a subcommand
*/
static void
-process_subcommand (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *document)
+process_subcommand (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
- if (operation->data.subcommand.target != NULL)
+ if (NULL != operation->data.subcommand.target)
{
- operation->data.subcommand.function(operation->data.subcommand.cls,
document);
+ operation->data.subcommand.function (operation->data.subcommand.cls,
document);
}
else
{
- operation->data.subcommand.function(operation->data.subcommand.cls,
document);
+ /* FIXME */
+ operation->data.subcommand.function (operation->data.subcommand.cls,
document);
}
}
@@ -835,7 +851,8 @@ process_subcommand (struct EBICS_MSG_Spec *operation,
struct EBICS_genex_documen
* Parse a operationlist end operation.
*/
static void
-process_end (struct EBICS_MSG_Spec *operation, struct EBICS_genex_document
*document)
+process_end (const struct EBICS_MSG_Spec *operation,
+ struct EBICS_genex_document *document)
{
remove_lfts_optional_nodes(document);
remove_any_nodes(document);
@@ -845,19 +862,22 @@ process_end (struct EBICS_MSG_Spec *operation, struct
EBICS_genex_document *docu
* Parse document according to given command specification.
* Each element of the operation list is called with the appropriate parser
function.
*
- * @param *ops Array containing MSG_spec structs.
- * @param xpathCtxPtr Pointer to the XPath context.
- * @param doc Pointer to the base document->
- *
+ * @param ops Array containing MSG_spec structs.
+ * @param doc Pointer to the base document
*/
void
-EBICS_MSG_parse_spec (struct EBICS_MSG_Spec *ops, struct EBICS_genex_document
*document)
+EBICS_MSG_parse_spec (const struct EBICS_MSG_Spec *ops,
+ struct EBICS_genex_document *document)
{
uint8_t index;
- struct EBICS_MSG_Spec *op;
- for (index = 0; EBICS_MSG_OP_END != ops[index].operation; index++)
+ const struct EBICS_MSG_Spec *op;
+
+ for (index = 0;
+ EBICS_MSG_OP_END != ops[index].operation;
+ index++)
{
- /*TODO What if EBICS_MSG_OP_END is not at end of list? */
+ /* TODO What if EBICS_MSG_OP_END is not at end of list? */
+
op = &ops[index];
switch (op->operation)
{
@@ -917,7 +937,9 @@ EBICS_MSG_parse_spec (struct EBICS_MSG_Spec *ops, struct
EBICS_genex_document *d
LOG(EBICS_LOGLEVEL_INFO,"parse_spec: executing 'add_node'");
process_end(op, document);
break;
+
default:
+
/*TODO should this be the error case? */
break;
}
diff --git a/src/xmlproto.h b/src/xmlproto.h
index 3ae5d03..ac4952d 100644
--- a/src/xmlproto.h
+++ b/src/xmlproto.h
@@ -257,6 +257,7 @@ EBICS_MSG_op_clean ();
void
-EBICS_MSG_parse_spec(struct EBICS_MSG_Spec *ops, struct EBICS_genex_document
*document);
+EBICS_MSG_parse_spec(const struct EBICS_MSG_Spec *ops,
+ struct EBICS_genex_document *document);
#endif
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libfints] branch master updated: Minor changes.,
gnunet <=