Skip to content

Commit

Permalink
fix build failures, warnings, clippy, and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Ream authored and robertream committed May 22, 2024
1 parent 266913b commit 23e59bb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions srt-c/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ fn main() {
cc::Build::new()
.cpp(true)
.file("src/catch.cpp")
.flag("-std=c++11")
.compile("catch");
}
6 changes: 3 additions & 3 deletions srt-c/src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ fn handle_result(res: Result<(), SrtError>) -> c_int {

thread_local! {
pub static LAST_ERROR_STR: RefCell<CString> = RefCell::new(CString::new("(no error set on this thread)").unwrap());
pub static LAST_ERROR: RefCell<SRT_ERRNO> = RefCell::new(SRT_ERRNO::SRT_SUCCESS);
pub static LAST_ERROR: RefCell<SRT_ERRNO> = const { RefCell::new(SRT_ERRNO::SRT_SUCCESS) };
}

#[no_mangle]
Expand Down Expand Up @@ -776,7 +776,7 @@ pub extern "C" fn srt_sendmsg2(
.try_send(
Instant::now(),
Bytes::copy_from_slice(unsafe {
from_raw_parts(buf, len as usize)
from_raw_parts(buf as *const u8, len as usize)
}),
)
.is_err()
Expand All @@ -798,7 +798,7 @@ pub extern "C" fn srt_recv(sock: SRTSOCKET, buf: *mut c_char, len: c_int) -> c_i
Some(sock) => sock,
};

let bytes = unsafe { from_raw_parts_mut(buf, len as usize) };
let bytes = unsafe { from_raw_parts_mut(buf as *mut u8, len as usize) };

let mut l = sock.lock().unwrap();
if let SocketData::Established(ref mut sock, opts) = *l {
Expand Down
15 changes: 0 additions & 15 deletions srt-protocol/tests/simulator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ use srt_protocol::{
protocol::handshake::Handshake,
};

#[derive(Eq, PartialEq)]
struct SentPacket(Instant, (Packet, SocketAddr));

impl PartialOrd for SentPacket {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl Ord for SentPacket {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.0.cmp(&other.0).reverse() // reverse to make it a min-heap
}
}

struct ScheduledInput(Instant, Input);

impl PartialEq for ScheduledInput {
Expand Down
5 changes: 1 addition & 4 deletions srt-tokio/tests/accesscontrol.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
io,
time::Instant,
};
use std::{io, time::Instant};

use assert_matches::assert_matches;
use bytes::Bytes;
Expand Down
3 changes: 3 additions & 0 deletions srt-transmit/src/streamer_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use srt_tokio::{
SrtIncoming, SrtListener, SrtSocket,
};

// Even though it is never directly used, oneshot::Sender<()> is not dead code. It is used to
// ensures the run_receive_loop task terminates when the StreamerServer is dropped
#[allow(dead_code)]
pub struct StreamerServer(broadcast::Sender<(Instant, Bytes)>, oneshot::Sender<()>);

impl StreamerServer {
Expand Down

0 comments on commit 23e59bb

Please sign in to comment.