-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
parity/main.rs
Outdated
let mut wsdata: ::winapi::winsock2::WSADATA = ::std::mem::zeroed(); | ||
::ws2_32::WSAStartup(WS_VERSION, &mut wsdata); | ||
let mut wsdata: ::winapi::um::winsock2::WSADATA = ::std::mem::zeroed(); | ||
::winapi::um::winsock2:::WSAStartup(WS_VERSION, &mut wsdata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra :
before WSAStartup
.
210238d
to
2acf0af
Compare
parity/url.rs
Outdated
#[cfg(windows)] | ||
pub fn open(url: &str) { | ||
use std::ffi::CString; | ||
use std::ptr; | ||
use winapi::um::shellapi::ShellExecuteA; | ||
use winapi::um::winuser::SW_SHOWNORMAL as Normal; | ||
|
||
unsafe { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove unsafe here now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain me why this can be removed? ShellExecuteA
is still marked as unsafe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, for some reason I thought that winapi interface is safe... I should have double checked :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But shouldn't the build have failed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andresilva I think CI only runs on Linux right? So, using conditional compilation flags will never compile stuff that isn't #[cfg(target_os="linux")]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right didn't think of that 👍
parity/url.rs
Outdated
|
||
unsafe { | ||
shell::ShellExecuteA(ptr::null_mut(), | ||
ShellExecuteA(ptr::null_mut(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually ShellExecuteA
can fail, why doesn't we care about that?
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
|
||
pub use self::winapi::SW_SHOWNORMAL as Normal; | ||
} | ||
|
||
#[cfg(windows)] | ||
pub fn open(url: &str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR:
Ideally, this function should return an error if the winapi
or c_str's
fail!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed!
use winapi::um::shellapi::ShellExecuteA; | ||
use winapi::um::winuser::SW_SHOWNORMAL as Normal; | ||
|
||
ShellExecuteA(ptr::null_mut(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I will repeat myself again because my comment was removed in the latest change!
But, actually ShellExecuteA
can fail. Why doesn't we care about that?
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause we're lazy :p created an issue for that :)
No description provided.