Created
October 27, 2022 10:03
-
-
Save dkomanov/52e8b825e63c2b9144a277f9e8c611d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[no_mangle] | |
pub extern "system" fn decodeConfigSliceUrlSafe2( | |
env: JNIEnv, | |
_class: JClass, | |
payload: jbyteArray, | |
size: usize, | |
output: *mut u8, | |
output_size: usize, | |
) -> usize { | |
let arr = env.get_byte_array_elements( | |
payload, | |
ReleaseMode::NoCopyBack, | |
).unwrap(); | |
let (input_slice, output_slice) = unsafe { | |
( | |
std::slice::from_raw_parts(arr.as_ptr() as *const u8, size), | |
std::slice::from_raw_parts_mut(output, output_size), | |
) | |
}; | |
return base64::decode_config_slice( | |
input_slice, | |
base64::URL_SAFE_NO_PAD, | |
output_slice, | |
).unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment