Skip to content

Commit

Permalink
Replace array with std::vector in decodeBase64()
Browse files Browse the repository at this point in the history
This serves as a work around for a weird bug in Apple Clang 14.0.*

xref: https://stackoverflow.com/q/75153729/1005215
  • Loading branch information
nehaljwani committed Jan 18, 2023
1 parent 90a9618 commit c8fab3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <climits>
#include <string>
#include <vector>

#include "preview.hpp"
#include "futils.hpp"
Expand Down Expand Up @@ -936,9 +937,8 @@ namespace {

// create decoding table
unsigned long invalid = 64;
unsigned long decodeBase64Table[256] = {};
for (unsigned long i = 0; i < 256; i++)
decodeBase64Table[i] = invalid;
std::vector<unsigned long> decodeBase64Table(256, invalid);

for (unsigned long i = 0; i < 64; i++)
decodeBase64Table[(unsigned char)encodeBase64Table[i]] = i;

Expand Down

0 comments on commit c8fab3a

Please sign in to comment.