You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
2308
2326
*
2309
2327
* This function will fail in case of invalid input. There are two possible reasons for
2310
-
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
2311
-
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
2328
+
* failure: the input contains a number of base64 characters that when divided by 4, leaves
2329
+
* a single remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
2312
2330
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
2313
2331
*
2332
+
* When the error is INVALID_BASE64_CHARACTER, r.count contains the index in the input
2333
+
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
2334
+
* r.count contains the number of bytes decoded.
2335
+
*
2314
2336
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
2315
2337
* If you fail to provide that much space, the function may cause a buffer overflow.
2316
2338
*
2317
2339
* @param input the base64 string to process
2318
2340
* @param length the length of the string in bytes
2319
2341
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
2342
+
* @param options the base64 options to use, can be base64_default or base64_url, is base64_default by default.
2320
2343
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
2321
2344
*/
2322
-
simdutf_warn_unused result base64_to_binary(constchar * input, size_t length, char* output) noexcept;
* This function follows the WHATWG forgiving-base64 format, which means that it will
2373
+
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
2374
+
* equal signs at the end) or an unpadded input (without any equal signs at the end).
2375
+
*
2376
+
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
2377
+
*
2378
+
* This function will fail in case of invalid input. There are two possible reasons for
2379
+
* failure: the input contains a number of base64 characters that when divided by 4, leaves
2380
+
* a single remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
2381
+
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
2382
+
*
2383
+
* When the error is INVALID_BASE64_CHARACTER, r.count contains the index in the input
2384
+
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
2385
+
* r.count contains the number of bytes decoded.
2386
+
*
2387
+
* You should call this function with a buffer that is at least maximal_binary_length_from_utf6_base64(input, length) bytes long.
2388
+
* If you fail to provide that much space, the function may cause a buffer overflow.
2389
+
*
2390
+
* @param input the base64 string to process, in ASCII stored as 16-bit units
2391
+
* @param length the length of the string in 16-bit units
2392
+
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
2393
+
* @param options the base64 options to use, can be base64_default or base64_url, is base64_default by default.
2394
+
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and position of the INVALID_BASE64_CHARACTER error (in the input in units) if any, or the number of bytes written if successful.
* This function follows the WHATWG forgiving-base64 format, which means that it will
2402
+
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
2403
+
* equal signs at the end) or an unpadded input (without any equal signs at the end).
2404
+
*
2405
+
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
2406
+
*
2407
+
* This function will fail in case of invalid input. There are three possible reasons for
2408
+
* failure: the input contains a number of base64 characters that when divided by 4, leaves
2409
+
* a single remainder character (BASE64_INPUT_REMAINDER), the input contains a character
2410
+
* that is not a valid base64 character (INVALID_BASE64_CHARACTER), or the output buffer
2411
+
* is too small (OUTPUT_BUFFER_TOO_SMALL).
2412
+
*
2413
+
* When OUTPUT_BUFFER_TOO_SMALL, we return both the number of bytes written
2414
+
* and the number of units processed, see description of the parameters and returned value.
2415
+
*
2416
+
* When the error is INVALID_BASE64_CHARACTER, r.count contains the index in the input
2417
+
* where the invalid character was found. When the error is BASE64_INPUT_REMAINDER, then
2418
+
* r.count contains the number of bytes decoded.
2419
+
*
2420
+
* The INVALID_BASE64_CHARACTER cases are considered fatal and you are expected to discard
2421
+
* the output.
2422
+
*
2423
+
* @param input the base64 string to process, in ASCII stored as 8-bit or 16-bit units
2424
+
* @param length the length of the string in 8-bit or 16-bit units.
2425
+
* @param output the pointer to buffer that can hold the conversion result.
2426
+
* @param outlen the number of bytes that can be written in the output buffer. Upon return, it is modified to reflect how many bytes were written.
2427
+
* @param options the base64 options to use, can be base64_default or base64_url, is base64_default by default.
2428
+
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and position of the INVALID_BASE64_CHARACTER error (in the input in units) if any, or the number of units processed if successful.
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
3424
3523
*
3425
3524
* This function will fail in case of invalid input. There are two possible reasons for
3426
-
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
3427
-
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
3525
+
* failure: the input contains a number of base64 characters that when divided by 4, leaves
3526
+
* a single remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
3428
3527
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
3429
3528
*
3430
3529
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
@@ -3433,17 +3532,44 @@ class implementation {
3433
3532
* @param input the base64 string to process
3434
3533
* @param length the length of the string in bytes
3435
3534
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
3535
+
* @param options the base64 options to use, can be base64_default or base64_url, is base64_default by default.
3436
3536
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
* This function follows the WHATWG forgiving-base64 format, which means that it will
3544
+
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
3545
+
* equal signs at the end) or an unpadded input (without any equal signs at the end).
3546
+
*
3547
+
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
3548
+
*
3549
+
* This function will fail in case of invalid input. There are two possible reasons for
3550
+
* failure: the input contains a number of base64 characters that when divided by 4, leaves
3551
+
* a single remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
3552
+
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
3553
+
*
3554
+
* You should call this function with a buffer that is at least maximal_binary_length_from_utf6_base64(input, length) bytes long.
3555
+
* If you fail to provide that much space, the function may cause a buffer overflow.
3556
+
*
3557
+
* @param input the base64 string to process, in ASCII stored as 16-bit units
3558
+
* @param length the length of the string in 16-bit units
3559
+
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
3560
+
* @param options the base64 options to use, can be base64_default or base64_url, is base64_default by default.
3561
+
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and position of the INVALID_BASE64_CHARACTER error (in the input in units) if any, or the number of bytes written if successful.
0 commit comments