Mercurial > masqmail
comparison src/base64/base64.c @ 366:41958685480d
Switched to `type *name' style
Andrew Koenig's ``C Traps and Pitfalls'' (Ch.2.1) convinced
me that it is best to go with the way C had been designed.
The ``declaration reflects use'' concept conflicts with a
``type* name'' notation. Hence I switched.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 22 Sep 2011 15:07:40 +0200 |
parents | c74adb7c4f50 |
children | b27f66555ba8 |
comparison
equal
deleted
inserted
replaced
365:934a223e4ee8 | 366:41958685480d |
---|---|
20 #include <glib.h> | 20 #include <glib.h> |
21 #include <string.h> | 21 #include <string.h> |
22 #include "base64.h" | 22 #include "base64.h" |
23 | 23 |
24 gchar* | 24 gchar* |
25 base64_encode(guchar * buf, gint len) | 25 base64_encode(guchar *buf, gint len) |
26 { | 26 { |
27 guchar *outbuf, *q; | 27 guchar *outbuf, *q; |
28 gchar enc[64]; | 28 gchar enc[64]; |
29 gint i = 0, j = 0; | 29 gint i = 0, j = 0; |
30 guint in0, in1, in2; | 30 guint in0, in1, in2; |
72 *q = 0; | 72 *q = 0; |
73 | 73 |
74 return outbuf; | 74 return outbuf; |
75 } | 75 } |
76 | 76 |
77 gchar *base64_decode(gchar * buf, gint * size) | 77 gchar *base64_decode(gchar *buf, gint *size) |
78 { | 78 { |
79 guchar *p = buf, *q; | 79 guchar *p = buf, *q; |
80 guint in[4]; | 80 guint in[4]; |
81 /* gchar *out = g_malloc(((strlen(buf)+3) * 3) / 4 + 1); */ | 81 /* gchar *out = g_malloc(((strlen(buf)+3) * 3) / 4 + 1); */ |
82 gchar *out = g_malloc((strlen(buf) + 3) + 1 +1); | 82 gchar *out = g_malloc((strlen(buf) + 3) + 1 +1); |