elast0ny / shared_memory

A Rust wrapper around native shared memory for Linux and Windows
382 stars 51 forks source link

Incorrect use of ANSI windows APIs #51

Closed ExpHP closed 4 years ago

ExpHP commented 4 years ago

https://github.com/elast0ny/shared_memory-rs/blob/749f11db3324afc41d67a8229bbbd059856494a6/src/windows.rs#L65-L73

This is using the ANSI API on string data that is not ANSI-encoded. It should be using the wide APIs, using the standard library utils for conversion to UTF-16.

I can make up a pull request for this tomorrow.


(aside: that call to .as_ptr() on a temporary is terrifying and---while correct---it depends on delicate aspects of drop order that people seldom talk about. I can't imagine why anyone would choose to silence the lint when they could easily add a binding for the temporary in just as many characters...)