Updated examples and grammar for big error change.

This commit is contained in:
Christoffer Lerno
2020-06-17 18:19:00 +02:00
parent 42a222e353
commit a6a4136685
11 changed files with 613 additions and 95 deletions

View File

@@ -82,7 +82,13 @@ public func void encode(byte[] in, string *out)
}
}
public func int decode(string in, byte[] out) throws Base64Error
error InvalidCharacter
{
int index;
char c;
}
public func int! decode(string in, byte[] out)
{
int j = 0;
@@ -92,9 +98,9 @@ public func int decode(string in, byte[] out) throws Base64Error
if (value == PAD) return j;
if (value < FIRST || in[i] > LAST) throw INVALID_CHARACTER;
if (value < FIRST || in[i] > LAST) return! InvalidCharacter(i, value);
byte c = LUT_DEC[in[i] - FIRST);
if (c == ERR) throw INVALID_CHARACTER;
if (c == ERR) return! InvalidCharacter(i, value);
switch (i % 4)
{