Skip to content

Commit

Permalink
Fix build Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
TruongQuangSB committed Dec 12, 2024
1 parent 3a25666 commit 9605667
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions native/chromium_jni_macro/src/utils/jni_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ fn get_type_parameter(p: &Path) -> Punctuated<GenericArgument, Comma> {
/// Extracts Args from an Option function pointer path Option<*mut fn(Args...)>
pub fn extract_arguments(p: &Path) -> syn::punctuated::Punctuated<BareFnArg, Comma> {
let bracket_args = get_type_parameter(p);
return match bracket_args.first().unwrap() {
match bracket_args.first().unwrap() {
GenericArgument::Type(Type::BareFn(t)) => t.inputs.clone(),
_ => panic!("Not a type"),
};
}
}

/// Extracts the result type from an Option function pointer path Option<*mut fn(...) -> Result>
pub fn extract_result(p: &Path) -> Option<syn::Type> {
let bracket_args = get_type_parameter(p);
return match bracket_args.first().unwrap() {
match bracket_args.first().unwrap() {
GenericArgument::Type(Type::BareFn(t)) => match t.output.clone() {
ReturnType::Type(_, ty) => Some(*ty),
ReturnType::Default => None,
},
_ => panic!("Not a type (result)"),
};
}
}
1 change: 0 additions & 1 deletion native/chromium_jni_macro/src/utils/unzip4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*/

/// Trait for unzipping 4-tuples
pub trait Unzip4<A, B, C, D> {
fn unzip4<FromA, FromB, FromC, FromD>(self) -> (FromA, FromB, FromC, FromD)
Expand Down
4 changes: 2 additions & 2 deletions native/chromium_jni_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ impl<T> FromJavaValue for *mut T {
impl FromJavaMember for usize {
fn from_java_member(env: JNIEnv, object: JObject, name: &str) -> usize {
// Read an integer field
return env
env
.get_field(object, name, "I")
.and_then(|v| v.i())
.unwrap() as usize;
.unwrap() as usize
}
}

Expand Down
1 change: 0 additions & 1 deletion native/chromium_subp/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* Contributors:
* Guillermo Zunino, Equo - initial implementation
*/

fn main() {
link();
}
Expand Down
8 changes: 4 additions & 4 deletions native/chromium_swt/src/cef_cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ pub extern "C" fn Java_org_eclipse_set_browser_lib_cefswt_1cookie_1visitor_1t_ce
cookie: *mut chromium::cef::_cef_cookie_t,
) -> jstring {
let value = unsafe { CStr::from_ptr(cefswt_cookie_value(cookie)) };
return env
env
.new_string(value.to_str().unwrap())
.unwrap()
.into_inner();
.into_inner()
}

#[no_mangle]
Expand All @@ -33,10 +33,10 @@ pub extern "C" fn Java_org_eclipse_set_browser_lib_cefswt_1cookie_1visitor_1t_ce
cookie: *mut chromium::cef::_cef_cookie_t,
) -> jstring {
let value = unsafe { CStr::from_ptr(cefswt_cookie_to_java(cookie)) };
return env
env
.new_string(value.to_str().unwrap())
.unwrap()
.into_inner();
.into_inner()
}

fn cefswt_cookie_to_java(cookie: *mut chromium::cef::_cef_cookie_t) -> *mut c_char {
Expand Down
8 changes: 4 additions & 4 deletions native/chromium_swt/src/cef_download_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ pub unsafe extern "C" fn get_full_path(
let path = (*item).get_full_path.unwrap()(item);

let value = CStr::from_ptr(crate::cefswt_cefstring_to_java(path));
return env
env
.new_string(value.to_str().unwrap())
.unwrap()
.into_inner();
.into_inner()
}

#[jni_name("org.eclipse.set.browser.lib.cef_download_item_t")]
Expand Down Expand Up @@ -56,10 +56,10 @@ pub unsafe extern "C" fn get_url(
) -> jstring {
let url = (*item).get_url.unwrap()(item);
let value = CStr::from_ptr(crate::cefswt_cefstring_to_java(url));
return env
env
.new_string(value.to_str().unwrap())
.unwrap()
.into_inner();
.into_inner()
}

#[jni_name("org.eclipse.set.browser.lib.cef_download_item_t")]
Expand Down

0 comments on commit 9605667

Please sign in to comment.