aboutsummaryrefslogtreecommitdiffstats
path: root/common/convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/convert.c')
-rw-r--r--common/convert.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/common/convert.c b/common/convert.c
index c314ec9a6..78a16c957 100644
--- a/common/convert.c
+++ b/common/convert.c
@@ -23,7 +23,6 @@
#include <ctype.h>
#include "util.h"
-#include "gcrypt.h" /* FIXME: really needed? */
#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
@@ -107,14 +106,14 @@ do_bin2hex (const void *buffer, size_t length, char *stringbuf, int with_colon)
{
const unsigned char *s;
char *p;
-
+
if (!stringbuf)
{
/* Not really correct for with_colon but we don't care about the
one wasted byte. */
- size_t n = with_colon? 3:2;
- size_t nbytes = n * length + 1;
- if (length && (nbytes-1) / n != length)
+ size_t n = with_colon? 3:2;
+ size_t nbytes = n * length + 1;
+ if (length && (nbytes-1) / n != length)
{
gpg_err_set_errno (ENOMEM);
return NULL;
@@ -123,7 +122,7 @@ do_bin2hex (const void *buffer, size_t length, char *stringbuf, int with_colon)
if (!stringbuf)
return NULL;
}
-
+
for (s = buffer, p = stringbuf; length; length--, s++)
{
if (with_colon && s != buffer)
@@ -172,7 +171,7 @@ bin2hexcolon (const void *buffer, size_t length, char *stringbuf)
buffer, the function returns NULL and won't change the existing
conent of buffer. In-place conversion is possible as long as
BUFFER points to HEXSTRING.
-
+
If BUFFER is NULL and bufsize is 0 the function scans HEXSTRING but
does not store anything. This may be used to find the end of
hexstring.
@@ -205,7 +204,7 @@ hex2str (const char *hexstring, char *buffer, size_t bufsize, size_t *buflen)
{
if (count > bufsize)
return NULL; /* Too long. */
-
+
for (s=hexstring, idx=0; hexdigitp (s) && hexdigitp (s+1); s += 2)
((unsigned char*)buffer)[idx++] = xtoi_2 (s);
if (need_nul)