-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cstr literals where possible (#311)
* Use cstr literals where possible 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> * examples: prefer `ptr::cast()` over as casts Fixes pedantic clippy lint `ptr_as_ptr`. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * Add comment explaining cast of `u16` to pointer. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
- Loading branch information
Showing
9 changed files
with
104 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.