Commit Graph

5 Commits

Author SHA1 Message Date
Henrik Hørlück Berg
d6a9ad66a7
Allow CancelChecker to be FnMut 2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
d277a50564
Combine previous attempt into this
*singing it's the best of both worlds*
2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
e0bbf3eee9
Port wilcard.{cpp,h} to Rust
- This is untested and unused, string ownership is very much subject to change
- Ports the minimally necessary parts of complete.rs as well
- This should fix an infinite loop in `create_directory` in `path.rs`, the first
  `wstat` loop only breaks if it fails with an error that's different from
  EAGAIN
2023-09-15 14:44:58 +02:00
Henrik Hørlück Berg
80d92dcc6d
Port the easy part of wildcard.{h,cpp}
- wildcard_match is now closer to the original that is linked in a comment, as
  pointer-arithmetic translates very poorly. The act of calling wildcard
  patterns wc or wildcard is kinda confusing when wc elsewhere is widechar.
2023-09-15 14:38:30 +02:00
Johannes Altmanninger
05bad5eda1 Port common.{h,cpp} to Rust
Most of it is duplicated, hence untested.

Functions like mbrtowc are not exposed by the libc crate, so declare them
ourselves.
Since we don't know the definition of C macros, add two big hacks to make
this work:
1. Replace MB_LEN_MAX and mbstate_t with values (resp types) that should
   be large enough for any implementation.
2. Detect the definition of MB_CUR_MAX in the build script. This requires
   more changes for each new libc. We could also use this approach for 1.

Additionally, this commit brings a small behavior change to
read_unquoted_escape(): we cannot decode surrogate code points like \UDE01
into a Rust char, so use � (\UFFFD, replacement character) instead.
Previously, we added such code points to a wcstring; looks like they were
ignored when printed.
2023-04-02 15:17:06 +02:00