[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libebics] branch master updated: Use the base64 encoder fr
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libebics] branch master updated: Use the base64 encoder from GNUnet. |
Date: |
Thu, 25 Oct 2018 14:34:21 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libebics.
The following commit(s) were added to refs/heads/master by this push:
new cc7282d Use the base64 encoder from GNUnet.
cc7282d is described below
commit cc7282d437d83e0b69238a42b63e77654dff6adf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Oct 25 14:33:56 2018 +0200
Use the base64 encoder from GNUnet.
---
src/util.c | 61 -------------------------------------------------------
src/util.h | 52 ++++++++++++++++++++---------------------------
src/xmlmessages.c | 30 ++++++++++++++-------------
3 files changed, 38 insertions(+), 105 deletions(-)
diff --git a/src/util.c b/src/util.c
index 1859b77..f4d6033 100644
--- a/src/util.c
+++ b/src/util.c
@@ -152,67 +152,6 @@ EBICS_util_log_from (int32_t fileline,
/** ******************** Base64 encoding ***********/
-#define FILLCHAR '='
-static char *cvt =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/";
-
-
-/**
- * Encode into Base64.
- *
- * @param data the data to encode
- * @param len the length of the input
- * @param output where to write the output (*output should be NULL,
- * is allocated)
- * @return the size of the output
- */
-size_t
-EBICS_UTIL_base64_encode (const char *data,
- size_t len,
- char **output)
-{
- size_t i;
- char c;
- size_t ret;
- char *opt;
-
- ret = 0;
- opt = malloc (2 + (len * 4 / 3) + 8);
- *output = opt;
- for (i = 0; i < len; ++i)
- {
- c = (data[i] >> 2) & 0x3f;
- opt[ret++] = cvt[(int) c];
- c = (data[i] << 4) & 0x3f;
- if (++i < len)
- c |= (data[i] >> 4) & 0x0f;
- opt[ret++] = cvt[(int) c];
- if (i < len)
- {
- c = (data[i] << 2) & 0x3f;
- if (++i < len)
- c |= (data[i] >> 6) & 0x03;
- opt[ret++] = cvt[(int) c];
- }
- else
- {
- ++i;
- opt[ret++] = FILLCHAR;
- }
- if (i < len)
- {
- c = data[i] & 0x3f;
- opt[ret++] = cvt[(int) c];
- }
- else
- {
- opt[ret++] = FILLCHAR;
- }
- }
- opt[ret++] = FILLCHAR;
- return ret;
-}
-
/**
* Dump a EBICS_genex_document to LOG_DEBUG.
*
diff --git a/src/util.h b/src/util.h
index d14eafb..030a0d4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -53,9 +53,15 @@
#define EBICS_LOGLEVEL_DEBUG 4
/**
- * central logging function
+ * Central logging function
*/
-void EBICS_util_log_from (int32_t fileline, const char *filename, const char
*funcname, const uint8_t level, const char *component, const char *message,
...);
+void EBICS_util_log_from (int32_t fileline,
+ const char *filename,
+ const char *funcname,
+ const uint8_t level,
+ const char *component,
+ const char *message,
+ ...);
/**
* Typedef for logging target functions.
@@ -65,8 +71,11 @@ void EBICS_util_log_from (int32_t fileline, const char
*filename, const char *fu
* @param date current date and time
* @param message the actual message
*/
-typedef void (*util_logging_target_function_pointer) (uint8_t level, const
char *component, const char *date, const char *message);
-
+typedef void
+(*util_logging_target_function_pointer) (uint8_t level,
+ const char *component,
+ const char *date,
+ const char *message);
/**
* struct with config for logging mechanism
*/
@@ -82,40 +91,23 @@ struct util_logging_config
* Default loglevel.
*/
uint8_t loglevel;
-};
-
-/*
- * Base64 encoding from GNUnet
- */
-size_t
-EBICS_UTIL_base64_encode (const char *data,
- size_t len,
- char **output);
-
-/*
- * Base64 decoding from GNUNET
-size_t
-EBICS_UTIL_base64_decode (const char *data,
- size_t len, char **output)
-
-*/
+};
void
-util_dump_message ( struct EBICS_genex_document *document);
+util_dump_message (struct EBICS_genex_document *document);
struct EBICS_genex_document*
-util_genex_document_from_file ( char *path );
+util_genex_document_from_file (char *path);
void
util_genex_free_document (struct EBICS_genex_document *document);
-xmlChar*
-util_test_xpath_value(const char *expression, xmlXPathContextPtr xpath);
-
-char*
-util_generate_path(const char *basePath, const char *fileName);
-
-
+xmlChar *
+util_test_xpath_value(const char *expression,
+ xmlXPathContextPtr xpath);
+char *
+util_generate_path(const char *basePath,
+ const char *fileName);
#endif
diff --git a/src/xmlmessages.c b/src/xmlmessages.c
index 81ad141..bc8512a 100644
--- a/src/xmlmessages.c
+++ b/src/xmlmessages.c
@@ -141,12 +141,12 @@ util_extract_public_RSAKeyValue (struct EBICS_Key *key,
gnutls_strerror (retv));
return EBICS_ERROR;
}
- eSize = EBICS_UTIL_base64_encode ((char*) exp.data,
- exp.size,
- eData);
- mSize = EBICS_UTIL_base64_encode ((char*) mod.data,
- mod.size,
- mData);
+ eSize = GNUNET_STRINGS_base64_encode ((char*) exp.data,
+ exp.size,
+ eData);
+ mSize = GNUNET_STRINGS_base64_encode ((char*) mod.data,
+ mod.size,
+ mData);
gnutls_free (mod.data);
gnutls_free (exp.data);
@@ -317,7 +317,8 @@ EBICS_build_content_ini (void *cls,
xmlChar *iniContent;
char *base64content;
- size_t zLen, b64len;
+ long unsigned int zLen;
+ size_t b64len;
int xLen;
char *b64data;
@@ -377,9 +378,9 @@ EBICS_build_content_ini (void *cls,
(size_t) xLen,
zLen);
- b64len = EBICS_UTIL_base64_encode ((char *) zData,
- zLen,
- &base64content);
+ b64len = GNUNET_STRINGS_base64_encode ((char *) zData,
+ zLen,
+ &base64content);
b64data = realloc (base64content,
b64len + 1);
@@ -499,7 +500,8 @@ EBICS_build_content_hia (void *cls,
/* insert base64'ed and zlib'ed data */
xmlChar *iniContent;
char *base64Content;
- size_t zLen, b64Len;
+ long unsigned int zLen;
+ size_t b64Len;
int xLen;
LOG (EBICS_LOGLEVEL_DEBUG,
@@ -522,9 +524,9 @@ EBICS_build_content_hia (void *cls,
(size_t) xLen,
zLen);
- b64Len = EBICS_UTIL_base64_encode ((char*)zData,
- zLen,
- &base64Content);
+ b64Len = GNUNET_STRINGS_base64_encode ((char*)zData,
+ zLen,
+ &base64Content);
char *b64Data = realloc (base64Content,
b64Len+1);
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libebics] branch master updated: Use the base64 encoder from GNUnet.,
gnunet <=