-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cstr literals where possible #311
Conversation
This seems fine though it seems the build is failing on Windows. |
I suspect c strings are i8 on windows? It's a common cross-platform error. |
c1e2639
to
ada53a2
Compare
Convert usage of byte str and normal str with a `\0` to cstr literals where possible. Since CStr::as_ptr() returns `*const c_char` this also allows removing a nice amount of pointer casts. On Windows this also allows removing casts to [`LPCSTR`], which is defined as a `*const CHAR`, where `CHAR` is defined as `c_char` and `c_char` is taken from the std library if the `std` feature is enabled. [`LPCSTR`]: https://docs.rs/winapi/latest/winapi/um/winnt/type.LPCSTR.html Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Fixes pedantic clippy lint `ptr_as_ptr`. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
ad7ebbd
to
ab6cd30
Compare
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
ab6cd30
to
b2a30a1
Compare
The nice thing about While removing those needless casts, I stumbled a bit over CreateWindowExA accepting a |
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.
These changes are great! Thanks for cleaning up the code.
Convert usage of byte str and normal str with a
\0
to cstr literals where possible