Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobcode
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
0
Merge Requests
0
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
libvmod-blobcode
Commits
cf73bad4
Commit
cf73bad4
authored
Apr 10, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify base64_decode()
parent
31f86d26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
base64.c
src/base64.c
+8
-9
No files found.
src/base64.c
View file @
cf73bad4
...
...
@@ -132,11 +132,15 @@ base64_decode(const enum encoding dec, char *restrict const buf,
char
*
dest
=
buf
;
unsigned
u
=
0
,
term
=
0
;
int
n
=
0
;
size_t
len
=
SIZE_MAX
;
AN
(
buf
);
AN
(
alpha
);
for
(
const
char
*
s
=
p
;
s
!=
vrt_magic_string_end
;
if
(
inlen
>=
0
)
len
=
inlen
;
for
(
const
char
*
s
=
p
;
len
>
0
&&
s
!=
vrt_magic_string_end
;
s
=
va_arg
(
ap
,
const
char
*
))
{
if
(
s
==
NULL
)
continue
;
...
...
@@ -144,7 +148,7 @@ base64_decode(const enum encoding dec, char *restrict const buf,
errno
=
EINVAL
;
return
-
1
;
}
while
(
*
s
&&
(
inlen
==
-
1
||
inlen
>
0
)
)
{
while
(
*
s
&&
len
)
{
while
(
n
<
4
)
{
char
b
=
alpha
->
i64
[(
unsigned
)
*
s
++
];
u
<<=
6
;
...
...
@@ -158,11 +162,8 @@ base64_decode(const enum encoding dec, char *restrict const buf,
continue
;
}
u
|=
(
unsigned
)
b
;
if
(
inlen
!=
-
1
)
{
--
inlen
;
if
(
inlen
==
0
)
if
(
--
len
==
0
)
break
;
}
if
(
!*
s
)
break
;
}
...
...
@@ -172,8 +173,6 @@ base64_decode(const enum encoding dec, char *restrict const buf,
n
=
0
;
}
}
if
(
inlen
!=
-
1
&&
inlen
==
0
)
break
;
}
if
(
n
)
{
if
(
!
alpha
->
padding
)
...
...
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