MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_fromBase64

Function UArray_fromBase64

libs/basekit/source/UArray_string.c:540–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540UArray *UArray_fromBase64(const UArray *self) {
541 base64_decodestate state;
542 size_t undecodedBytesSize;
543 uint8_t *decodedBytes;
544 size_t decodedBytesSize;
545 UArray *decoded;
546
547 base64_init_decodestate(&state);
548 undecodedBytesSize = UArray_sizeInBytes(self);
549 decodedBytes = io_calloc(2 * undecodedBytesSize, 1);
550
551 decoded = UArray_new();
552 UArray_setItemType_(decoded, CTYPE_uint8_t);
553
554 decodedBytesSize =
555 base64_decode_block((char *)UArray_bytes(self), (int)undecodedBytesSize,
556 (char *)decodedBytes, &state);
557 UArray_appendBytes_size_(decoded, decodedBytes, decodedBytesSize);
558
559 io_free(decodedBytes);
560
561 return decoded;
562}

Callers 1

IoSeq_immutable.cFile · 0.85

Calls 8

base64_init_decodestateFunction · 0.85
UArray_sizeInBytesFunction · 0.85
UArray_newFunction · 0.85
UArray_setItemType_Function · 0.85
base64_decode_blockFunction · 0.85
UArray_bytesFunction · 0.85
UArray_appendBytes_size_Function · 0.85
io_freeFunction · 0.85

Tested by

no test coverage detected