Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent
Commits
af4c3599
Commit
af4c3599
authored
Mar 19, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the base64 code from varnishncsa 4.0.3 (public domain)
parent
3deed825
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
base64.c
src/base64.c
+11
-9
base64.h
src/base64.h
+1
-1
No files found.
src/base64.c
View file @
af4c3599
...
@@ -6,8 +6,9 @@
...
@@ -6,8 +6,9 @@
#include "config.h"
#include "config.h"
#include <sys/types.h>
#include <stdlib.h>
#include "varnishapi.h"
#include <string.h>
#include "base64.h"
#include "base64.h"
static
const
char
b64
[]
=
static
const
char
b64
[]
=
...
@@ -29,17 +30,17 @@ VB64_init(void)
...
@@ -29,17 +30,17 @@ VB64_init(void)
}
}
int
int
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
)
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
,
const
char
*
e
)
{
{
unsigned
u
,
v
,
l
;
unsigned
u
,
v
,
l
;
int
i
;
int
i
;
if
(
e
==
NULL
)
e
=
s
+
strlen
(
s
);
u
=
0
;
u
=
0
;
l
=
0
;
l
=
0
;
while
(
*
s
)
{
while
(
s
<
e
)
{
for
(
v
=
0
;
v
<
4
;
v
++
)
{
for
(
v
=
0
;
s
<
e
&&
v
<
4
;
v
++
)
{
if
(
!*
s
)
break
;
i
=
i64
[(
int
)
*
s
++
];
i
=
i64
[(
int
)
*
s
++
];
if
(
i
<
0
)
if
(
i
<
0
)
return
(
-
1
);
return
(
-
1
);
...
@@ -60,7 +61,8 @@ VB64_decode(char *d, unsigned dlen, const char *s)
...
@@ -60,7 +61,8 @@ VB64_decode(char *d, unsigned dlen, const char *s)
}
}
#ifdef TEST_DRIVER
#ifdef TEST_DRIVER
#include <stdio.h>
#include <stdio.h> // for test-prog
const
char
*
test1
=
const
char
*
test1
=
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
...
@@ -81,7 +83,7 @@ main(int argc, char **argv)
...
@@ -81,7 +83,7 @@ main(int argc, char **argv)
VB64_init
();
VB64_init
();
l
=
sizeof
buf
;
l
=
sizeof
buf
;
VB64_decode
(
buf
,
&
l
,
test1
);
VB64_decode
(
buf
,
l
,
test1
,
NULL
);
printf
(
"%s
\n
"
,
buf
);
printf
(
"%s
\n
"
,
buf
);
return
(
0
);
return
(
0
);
}
}
...
...
src/base64.h
View file @
af4c3599
...
@@ -29,4 +29,4 @@
...
@@ -29,4 +29,4 @@
*/
*/
void
VB64_init
(
void
);
void
VB64_init
(
void
);
int
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
);
int
VB64_decode
(
char
*
d
,
unsigned
dlen
,
const
char
*
s
,
const
char
*
e
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment