Skip to content

Commit 43c29f0

Browse files
committed
uefi/src/proto/network/http.rs: misc
1 parent f979966 commit 43c29f0

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

uefi/src/proto/network/http.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
//!
77
//! See [`Http`].
88
9-
extern crate alloc;
109
use alloc::string::String;
1110
use alloc::vec;
1211
use alloc::vec::Vec;
@@ -138,7 +137,7 @@ pub struct HttpHelper {
138137

139138
impl HttpHelper {
140139
/// Create new HTTP helper instance for the given NIC handle.
141-
pub fn new(nic_handle: Handle) -> uefi::Result<HttpHelper> {
140+
pub fn new(nic_handle: Handle) -> uefi::Result<Self> {
142141
let mut binding = unsafe {
143142
boot::open_protocol::<HttpBinding>(
144143
boot::OpenProtocolParams {
@@ -170,7 +169,7 @@ impl HttpHelper {
170169
}
171170
debug!("http: protocol ok");
172171

173-
Ok(HttpHelper {
172+
Ok(Self {
174173
child_handle,
175174
binding,
176175
protocol: Some(protocol_res.unwrap()),
@@ -215,12 +214,12 @@ impl HttpHelper {
215214

216215
let mut tx_req = HttpRequestData {
217216
method,
218-
url: url16.as_ptr() as *const u16,
217+
url: url16.as_ptr().cast::<u16>(),
219218
};
220219

221220
let mut tx_hdr = Vec::new();
222221
tx_hdr.push(HttpHeader {
223-
field_name: c"Host".as_ptr() as *const u8,
222+
field_name: c"Host".as_ptr().cast::<u8>(),
224223
field_value: c_hostname.as_ptr(),
225224
});
226225

@@ -231,7 +230,7 @@ impl HttpHelper {
231230
if body.is_some() {
232231
let b = body.unwrap();
233232
tx_msg.body_length = b.len();
234-
tx_msg.body = b.as_mut_ptr() as *mut c_void;
233+
tx_msg.body = b.as_mut_ptr().cast::<c_void>();
235234
}
236235

237236
let mut tx_token = HttpToken {
@@ -319,8 +318,8 @@ impl HttpHelper {
319318
let n;
320319
let v;
321320
unsafe {
322-
n = CStr::from_ptr((*rx_msg.header.add(i)).field_name as *const c_char);
323-
v = CStr::from_ptr((*rx_msg.header.add(i)).field_value as *const c_char);
321+
n = CStr::from_ptr((*rx_msg.header.add(i)).field_name.cast::<c_char>());
322+
v = CStr::from_ptr((*rx_msg.header.add(i)).field_value.cast::<c_char>());
324323
}
325324
headers.push((
326325
n.to_str().unwrap().to_lowercase(),
@@ -343,7 +342,7 @@ impl HttpHelper {
343342
let mut body = vec![0; 16 * 1024];
344343
let mut rx_msg = HttpMessage {
345344
body_length: body.len(),
346-
body: body.as_mut_ptr() as *mut c_void,
345+
body: body.as_mut_ptr().cast::<c_void>(),
347346
..Default::default()
348347
};
349348

0 commit comments

Comments
 (0)