mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 04:05:11 +01:00
Whitespace cleanup
This commit is contained in:
parent
489b780bb9
commit
5d4ef36f91
120
glib/gbase64.c
120
glib/gbase64.c
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU Library General Public
|
||||||
@ -54,7 +54,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char base64_alphabet[] =
|
static const char base64_alphabet[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_base64_encode_step:
|
* g_base64_encode_step:
|
||||||
@ -88,11 +88,11 @@ static const char base64_alphabet[] =
|
|||||||
*/
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_base64_encode_step (const guchar *in,
|
g_base64_encode_step (const guchar *in,
|
||||||
gsize len,
|
gsize len,
|
||||||
gboolean break_lines,
|
gboolean break_lines,
|
||||||
gchar *out,
|
gchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
gint *save)
|
gint *save)
|
||||||
{
|
{
|
||||||
char *outptr;
|
char *outptr;
|
||||||
const guchar *inptr;
|
const guchar *inptr;
|
||||||
@ -117,40 +117,40 @@ g_base64_encode_step (const guchar *in,
|
|||||||
already = *state;
|
already = *state;
|
||||||
|
|
||||||
switch (((char *) save) [0])
|
switch (((char *) save) [0])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
c1 = ((unsigned char *) save) [1];
|
|
||||||
goto skip1;
|
|
||||||
case 2:
|
|
||||||
c1 = ((unsigned char *) save) [1];
|
c1 = ((unsigned char *) save) [1];
|
||||||
c2 = ((unsigned char *) save) [2];
|
goto skip1;
|
||||||
|
case 2:
|
||||||
|
c1 = ((unsigned char *) save) [1];
|
||||||
|
c2 = ((unsigned char *) save) [2];
|
||||||
goto skip2;
|
goto skip2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* yes, we jump into the loop, no i'm not going to change it,
|
* yes, we jump into the loop, no i'm not going to change it,
|
||||||
* it's beautiful!
|
* it's beautiful!
|
||||||
*/
|
*/
|
||||||
while (inptr < inend)
|
while (inptr < inend)
|
||||||
{
|
{
|
||||||
c1 = *inptr++;
|
c1 = *inptr++;
|
||||||
skip1:
|
skip1:
|
||||||
c2 = *inptr++;
|
c2 = *inptr++;
|
||||||
skip2:
|
skip2:
|
||||||
c3 = *inptr++;
|
c3 = *inptr++;
|
||||||
*outptr++ = base64_alphabet [ c1 >> 2 ];
|
*outptr++ = base64_alphabet [ c1 >> 2 ];
|
||||||
*outptr++ = base64_alphabet [ c2 >> 4 |
|
*outptr++ = base64_alphabet [ c2 >> 4 |
|
||||||
((c1&0x3) << 4) ];
|
((c1&0x3) << 4) ];
|
||||||
*outptr++ = base64_alphabet [ ((c2 &0x0f) << 2) |
|
*outptr++ = base64_alphabet [ ((c2 &0x0f) << 2) |
|
||||||
(c3 >> 6) ];
|
(c3 >> 6) ];
|
||||||
*outptr++ = base64_alphabet [ c3 & 0x3f ];
|
*outptr++ = base64_alphabet [ c3 & 0x3f ];
|
||||||
/* this is a bit ugly ... */
|
/* this is a bit ugly ... */
|
||||||
if (break_lines && (++already) >= 19)
|
if (break_lines && (++already) >= 19)
|
||||||
{
|
{
|
||||||
*outptr++ = '\n';
|
*outptr++ = '\n';
|
||||||
already = 0;
|
already = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
((char *)save)[0] = 0;
|
((char *)save)[0] = 0;
|
||||||
len = 2 - (inptr - inend);
|
len = 2 - (inptr - inend);
|
||||||
@ -166,10 +166,10 @@ g_base64_encode_step (const guchar *in,
|
|||||||
|
|
||||||
/* len can only be 0 1 or 2 */
|
/* len can only be 0 1 or 2 */
|
||||||
switch(len)
|
switch(len)
|
||||||
{
|
{
|
||||||
case 2: *saveout++ = *inptr++;
|
case 2: *saveout++ = *inptr++;
|
||||||
case 1: *saveout++ = *inptr++;
|
case 1: *saveout++ = *inptr++;
|
||||||
}
|
}
|
||||||
((char *)save)[0] += len;
|
((char *)save)[0] += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ g_base64_encode_step (const guchar *in,
|
|||||||
*/
|
*/
|
||||||
gsize
|
gsize
|
||||||
g_base64_encode_close (gboolean break_lines,
|
g_base64_encode_close (gboolean break_lines,
|
||||||
gchar *out,
|
gchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
gint *save)
|
gint *save)
|
||||||
{
|
{
|
||||||
int c1, c2;
|
int c1, c2;
|
||||||
char *outptr = out;
|
char *outptr = out;
|
||||||
@ -314,10 +314,10 @@ static const unsigned char mime_base64_rank[256] = {
|
|||||||
**/
|
**/
|
||||||
gsize
|
gsize
|
||||||
g_base64_decode_step (const gchar *in,
|
g_base64_decode_step (const gchar *in,
|
||||||
gsize len,
|
gsize len,
|
||||||
guchar *out,
|
guchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
guint *save)
|
guint *save)
|
||||||
{
|
{
|
||||||
const guchar *inptr;
|
const guchar *inptr;
|
||||||
guchar *outptr;
|
guchar *outptr;
|
||||||
@ -348,21 +348,21 @@ g_base64_decode_step (const gchar *in,
|
|||||||
c = *inptr++;
|
c = *inptr++;
|
||||||
rank = mime_base64_rank [c];
|
rank = mime_base64_rank [c];
|
||||||
if (rank != 0xff)
|
if (rank != 0xff)
|
||||||
{
|
{
|
||||||
last[1] = last[0];
|
last[1] = last[0];
|
||||||
last[0] = c;
|
last[0] = c;
|
||||||
v = (v<<6) | rank;
|
v = (v<<6) | rank;
|
||||||
i++;
|
i++;
|
||||||
if (i==4)
|
if (i==4)
|
||||||
{
|
{
|
||||||
*outptr++ = v>>16;
|
*outptr++ = v>>16;
|
||||||
if (last[1] != '=')
|
if (last[1] != '=')
|
||||||
*outptr++ = v>>8;
|
*outptr++ = v>>8;
|
||||||
if (last[0] != '=')
|
if (last[0] != '=')
|
||||||
*outptr++ = v;
|
*outptr++ = v;
|
||||||
i=0;
|
i=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*save = v;
|
*save = v;
|
||||||
@ -386,7 +386,7 @@ g_base64_decode_step (const gchar *in,
|
|||||||
*/
|
*/
|
||||||
guchar *
|
guchar *
|
||||||
g_base64_decode (const gchar *text,
|
g_base64_decode (const gchar *text,
|
||||||
gsize *out_len)
|
gsize *out_len)
|
||||||
{
|
{
|
||||||
guchar *ret;
|
guchar *ret;
|
||||||
gsize input_length;
|
gsize input_length;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU Library General Public
|
||||||
@ -29,27 +29,27 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
gsize g_base64_encode_step (const guchar *in,
|
gsize g_base64_encode_step (const guchar *in,
|
||||||
gsize len,
|
gsize len,
|
||||||
gboolean break_lines,
|
gboolean break_lines,
|
||||||
gchar *out,
|
gchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
gint *save);
|
gint *save);
|
||||||
gsize g_base64_encode_close (gboolean break_lines,
|
gsize g_base64_encode_close (gboolean break_lines,
|
||||||
gchar *out,
|
gchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
gint *save);
|
gint *save);
|
||||||
gchar* g_base64_encode (const guchar *data,
|
gchar* g_base64_encode (const guchar *data,
|
||||||
gsize len) G_GNUC_MALLOC;
|
gsize len) G_GNUC_MALLOC;
|
||||||
gsize g_base64_decode_step (const gchar *in,
|
gsize g_base64_decode_step (const gchar *in,
|
||||||
gsize len,
|
gsize len,
|
||||||
guchar *out,
|
guchar *out,
|
||||||
gint *state,
|
gint *state,
|
||||||
guint *save);
|
guint *save);
|
||||||
guchar *g_base64_decode (const gchar *text,
|
guchar *g_base64_decode (const gchar *text,
|
||||||
gsize *out_len) G_GNUC_MALLOC;
|
gsize *out_len) G_GNUC_MALLOC;
|
||||||
guchar *g_base64_decode_inplace (gchar *text,
|
guchar *g_base64_decode_inplace (gchar *text,
|
||||||
gsize *out_len);
|
gsize *out_len);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user