| 3605 | } |
| 3606 | |
| 3607 | void fx_Uint8Array_fromBase64(txMachine* the) |
| 3608 | { |
| 3609 | txSize srcSize; |
| 3610 | txSize dstSize; |
| 3611 | txU1* alphabet = (txU1*)gxBase64Alphabet; |
| 3612 | txInteger lastChunkHandling = mxBase64Loose; |
| 3613 | txU1* src; |
| 3614 | txU1* dst; |
| 3615 | if ((mxArgc < 1) || !mxIsStringPrimitive(mxArgv(0))) |
| 3616 | mxTypeError("string: not a string"); |
| 3617 | fxUint8ArrayGetBase64Options(the, 1, &alphabet, &lastChunkHandling, NULL); |
| 3618 | srcSize = (txSize)c_strlen(mxArgv(0)->value.string); |
| 3619 | dstSize = (((srcSize + 3) / 4) * 3); |
| 3620 | mxPush(mxUint8ArrayConstructor); |
| 3621 | mxNew(); |
| 3622 | mxPushInteger(dstSize); |
| 3623 | mxRunCount(1); |
| 3624 | mxPullSlot(mxResult); |
| 3625 | { |
| 3626 | txSlot* resultInstance = fxCheckTypedArrayInstance(the, mxResult); \ |
| 3627 | txSlot* resultDispatch = resultInstance->next; \ |
| 3628 | txSlot* resultView = resultDispatch->next; \ |
| 3629 | txSlot* resultBuffer = resultView->next; \ |
| 3630 | src = (txU1*)(mxArgv(0)->value.string); |
| 3631 | dst = (txU1*)(resultBuffer->value.reference->next->value.arrayBuffer.address + resultView->value.dataView.offset); |
| 3632 | resultBuffer->value.reference->next->next->value.bufferInfo.maxLength = dstSize; |
| 3633 | fxUint8ArrayFromBase64(the, src, dst, &srcSize, &dstSize, alphabet, lastChunkHandling); |
| 3634 | fxSetArrayBufferLength(the, resultBuffer, dstSize); |
| 3635 | resultBuffer->value.reference->next->next->value.bufferInfo.maxLength = -1; |
| 3636 | resultView->value.dataView.size = dstSize; |
| 3637 | } |
| 3638 | } |
| 3639 | |
| 3640 | void fx_Uint8Array_fromHex(txMachine* the) |
| 3641 | { |
nothing calls this directly
no test coverage detected