Skip to content

Commit

Permalink
Merge pull request #683 from a2retrosystems/master
Browse files Browse the repository at this point in the history
Remove dependency on os.h
  • Loading branch information
tschak909 authored Oct 28, 2023
2 parents 03749d0 + 917c8fb commit a406d68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/base64/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

#include <stdint.h>
#include <string.h>

#include "os.h"
#include "base64.h"

static const char base64_table[65] =
Expand All @@ -33,7 +33,7 @@ static char * base64_gen_encode(const unsigned char *src, size_t len,
olen++; /* nul termination */
if (olen < len)
return NULL; /* integer overflow */
out = os_malloc(olen);
out = malloc(olen);
if (out == NULL)
return NULL;

Expand Down Expand Up @@ -88,7 +88,7 @@ static unsigned char * base64_gen_decode(const char *src, size_t len,
int pad = 0;
size_t extra_pad;

os_memset(dtable, 0x80, 256);
memset(dtable, 0x80, 256);
for (i = 0; i < sizeof(base64_table) - 1; i++)
dtable[(unsigned char) table[i]] = (unsigned char) i;
dtable['='] = 0;
Expand All @@ -104,7 +104,7 @@ static unsigned char * base64_gen_decode(const char *src, size_t len,
extra_pad = (4 - count % 4) % 4;

olen = (count + extra_pad) / 4 * 3;
pos = out = os_malloc(olen);
pos = out = malloc(olen);
if (out == NULL)
return NULL;

Expand Down Expand Up @@ -136,7 +136,7 @@ static unsigned char * base64_gen_decode(const char *src, size_t len,
pos -= 2;
else {
/* Invalid padding */
os_free(out);
free(out);
return NULL;
}
break;
Expand Down

0 comments on commit a406d68

Please sign in to comment.