Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Created October 27, 2022 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkomanov/afc1f5c3bf76ab56084526650bf4e0fc to your computer and use it in GitHub Desktop.
Save dkomanov/afc1f5c3bf76ab56084526650bf4e0fc to your computer and use it in GitHub Desktop.
#[no_mangle]
pub extern "system" fn decodeConfigSliceUrlSafe3(
_env: JNIEnv,
_class: JClass,
input: *const u8,
input_size: usize,
output: *mut u8,
output_size: usize,
) -> usize {
let (input_slice, output_slice) = unsafe {
(
std::slice::from_raw_parts(input, input_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