| 377 | }; |
| 378 | |
| 379 | bool MemoryBlock::fromBase64Encoding (StringRef s) |
| 380 | { |
| 381 | auto dot = CharacterFunctions::find (s.text, (juce_wchar) '.'); |
| 382 | |
| 383 | if (dot.isEmpty()) |
| 384 | return false; |
| 385 | |
| 386 | auto numBytesNeeded = String (s.text, dot).getIntValue(); |
| 387 | |
| 388 | setSize ((size_t) numBytesNeeded, true); |
| 389 | |
| 390 | auto srcChars = dot + 1; |
| 391 | int pos = 0; |
| 392 | |
| 393 | for (;;) |
| 394 | { |
| 395 | auto c = (int) srcChars.getAndAdvance(); |
| 396 | |
| 397 | if (c == 0) |
| 398 | return true; |
| 399 | |
| 400 | c -= 43; |
| 401 | |
| 402 | if (isPositiveAndBelow (c, numElementsInArray (base64DecodingTable))) |
| 403 | { |
| 404 | setBitRange ((size_t) pos, 6, base64DecodingTable[c]); |
| 405 | pos += 6; |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | } // namespace juce |
no test coverage detected