Skip to content

Commit c5b3551

Browse files
committed
update
1 parent 7b3d143 commit c5b3551

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Cargo.toml

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ name = "raw-printer"
33
description = "Direct RAW printing on windows or linux"
44
repository = "https://github.com/mushonnip/raw-printer"
55
keywords = ["printer"]
6-
version = "0.1.2"
6+
version = "0.1.3"
77
edition = "2021"
88
license = "MIT"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

12-
[dependencies]
13-
windows = { version = "0.51.1", features = [
12+
[target.'cfg(windows)'.dependencies]
13+
windows = { version = "0.58.0", features = [
1414
"Win32_Foundation",
1515
"Win32_Graphics_Printing",
1616
"Win32_Graphics_Gdi",
17-
] }
17+
]}
18+
19+
[profile.release]
20+
opt-level = 3
21+
lto = true
22+
codegen-units = 1
23+
strip = "symbols"

src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn write_to_device(printer: &str, payload: &str) -> Result<usize, std::io::E
6161
};
6262

6363
let printer_name = CString::new(printer).unwrap_or_default(); // null-terminated string
64-
let mut printer_handle: HANDLE = HANDLE(0);
64+
let mut printer_handle: HANDLE = HANDLE(std::ptr::null_mut());
6565

6666
// Open the printer
6767
unsafe {
@@ -110,8 +110,8 @@ pub fn write_to_device(printer: &str, payload: &str) -> Result<usize, std::io::E
110110
}
111111

112112
// End the page and document
113-
EndPagePrinter(printer_handle);
114-
EndDocPrinter(printer_handle);
113+
let _ = EndPagePrinter(printer_handle);
114+
let _ = EndDocPrinter(printer_handle);
115115
let _ = ClosePrinter(printer_handle);
116116
return Ok(bytes_written as usize);
117117
} else {

0 commit comments

Comments
 (0)