diff options
Diffstat (limited to 'vendor/iana-time-zone-haiku')
-rw-r--r-- | vendor/iana-time-zone-haiku/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/Cargo.toml | 9 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/README.md | 2 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/build.rs | 4 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/src/implementation.cc | 23 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/src/interface.h | 9 | ||||
-rw-r--r-- | vendor/iana-time-zone-haiku/src/lib.rs | 21 |
7 files changed, 33 insertions, 37 deletions
diff --git a/vendor/iana-time-zone-haiku/.cargo-checksum.json b/vendor/iana-time-zone-haiku/.cargo-checksum.json index 0d389ca41..11e259e18 100644 --- a/vendor/iana-time-zone-haiku/.cargo-checksum.json +++ b/vendor/iana-time-zone-haiku/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"ba2a4df50db8d516727230e9cfcf50ac6a14661404409a4fc80122b51d166e91","LICENSE-APACHE":"696759d65dfe558ff7d9f031c76db19ec5c0767470fb67c4e8d990820d1e99c9","LICENSE-MIT":"da28ccc6b158fc2d8cccc74e99794b1cff1d29bd7bbeb019442fcf0c04c6cad9","README.md":"b793fe64e8527ddd63c1da9006e6e52bba2e1190b35d7d96faa519d26157330b","build.rs":"de126604acf36bb9f2c3a4b7f29d857da0b09d63cbaf67f3da9587ac4ac75d43","src/implementation.cc":"8968c91a597fc35c076b736ad9dccd6fed7245cab555f4b99b3d7320f8de5cbf","src/interface.h":"1914c19df2e96f80c1b43da119422d18b2c9af6205ba0770db1f1734c380b472","src/lib.rs":"aa2a49592bcae5513c294b43f3202a142f6b33a9a0e6124b778493f1be813bfe"},"package":"0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"}
\ No newline at end of file +{"files":{"Cargo.toml":"8f06eca1c0e108d0422687eeb87030520ae7bd956efc92352599cc9cf079d9a3","LICENSE-APACHE":"696759d65dfe558ff7d9f031c76db19ec5c0767470fb67c4e8d990820d1e99c9","LICENSE-MIT":"da28ccc6b158fc2d8cccc74e99794b1cff1d29bd7bbeb019442fcf0c04c6cad9","README.md":"5b1ad9309b716374cc1bdcd025f525fac31b2f413e6c4d311e207fa6b1f96a83","build.rs":"10304831100a60c1c2b990762dcfeb47dae8342cf9b54595bec94884e7de5784","src/implementation.cc":"66d2ecfe58ec543e27a6fb3a96526a07cd1ac43a2370344f856529e5a112ce0f","src/lib.rs":"e58db019554bd372f0a187f8f51f96624cdf21bcef507de2093e1d49ca0787cd"},"package":"f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"}
\ No newline at end of file diff --git a/vendor/iana-time-zone-haiku/Cargo.toml b/vendor/iana-time-zone-haiku/Cargo.toml index d4a80dc3a..6b0ca3df2 100644 --- a/vendor/iana-time-zone-haiku/Cargo.toml +++ b/vendor/iana-time-zone-haiku/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" authors = ["René Kijewski <crates.io@k6i.de>"] description = "iana-time-zone support crate for Haiku OS" readme = "README.md" @@ -28,8 +28,7 @@ categories = [ license = "MIT OR Apache-2.0" repository = "https://github.com/strawlab/iana-time-zone" -[dependencies.cxx] -version = "1.0.34" +[dependencies] -[build-dependencies.cxx-build] -version = "1.0.34" +[build-dependencies.cc] +version = "1.0.79" diff --git a/vendor/iana-time-zone-haiku/README.md b/vendor/iana-time-zone-haiku/README.md index 7ad49aee6..87450cdb9 100644 --- a/vendor/iana-time-zone-haiku/README.md +++ b/vendor/iana-time-zone-haiku/README.md @@ -3,6 +3,6 @@ [![Crates.io](https://img.shields.io/crates/v/iana-time-zone-haiku.svg)](https://crates.io/crates/iana-time-zone-haiku) [![Documentation](https://docs.rs/iana-time-zone/badge.svg)](https://docs.rs/iana-time-zone/) [![Crate License](https://img.shields.io/crates/l/iana-time-zone-haiku.svg)](https://crates.io/crates/iana-time-zone-haiku) -[![build](https://github.com/strawlab/iana-time-zone/workflows/build/badge.svg?branch=master)](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amaster) +[![build](https://github.com/strawlab/iana-time-zone/workflows/build/badge.svg?branch=main)](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amain) [iana-time-zone](https://github.com/strawlab/iana-time-zone) support crate for Haiku OS. diff --git a/vendor/iana-time-zone-haiku/build.rs b/vendor/iana-time-zone-haiku/build.rs index 085e8d0bc..7ef5d9339 100644 --- a/vendor/iana-time-zone-haiku/build.rs +++ b/vendor/iana-time-zone-haiku/build.rs @@ -1,7 +1,9 @@ use std::env; fn main() { - cxx_build::bridge("src/lib.rs") + cc::Build::new() + .warnings(false) + .cpp(true) .file("src/implementation.cc") .flag_if_supported("-std=c++11") .compile("tz_haiku"); diff --git a/vendor/iana-time-zone-haiku/src/implementation.cc b/vendor/iana-time-zone-haiku/src/implementation.cc index 35e130552..d1c92cd3b 100644 --- a/vendor/iana-time-zone-haiku/src/implementation.cc +++ b/vendor/iana-time-zone-haiku/src/implementation.cc @@ -1,5 +1,4 @@ -#include "iana-time-zone-haiku/src/interface.h" -#include "iana-time-zone-haiku/src/lib.rs.h" +#include <cstddef> #ifdef __HAIKU__ @@ -10,12 +9,13 @@ #include <String.h> #include <TimeZone.h> -namespace iana_time_zone_haiku { -size_t get_tz(rust::Slice<uint8_t> buf) { +extern "C" { + +size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) { try { static_assert(sizeof(char) == sizeof(uint8_t), "Illegal char size"); - if (buf.empty()) { + if (buf_size == 0) { return 0; } @@ -38,7 +38,7 @@ size_t get_tz(rust::Slice<uint8_t> buf) { } size_t length(ilength); - if (length > buf.size()) { + if (length > buf_size) { return 0; } @@ -49,18 +49,19 @@ size_t get_tz(rust::Slice<uint8_t> buf) { return 0; } - std::memcpy(buf.data(), sname, length); + std::memcpy(buf, sname, length); return length; } catch (...) { return 0; } } -} // namespace iana_time_zone_haiku +} // extern "C" #else -namespace iana_time_zone_haiku { -size_t get_tz(rust::Slice<uint8_t>) { return 0; } -} // namespace iana_time_zone_haiku +extern "C" { + +size_t iana_time_zone_haiku_get_tz(char *buf, size_t buf_size) { return 0; } +} // extern "C" #endif diff --git a/vendor/iana-time-zone-haiku/src/interface.h b/vendor/iana-time-zone-haiku/src/interface.h deleted file mode 100644 index 5913a4043..000000000 --- a/vendor/iana-time-zone-haiku/src/interface.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "rust/cxx.h" - -#include <cstddef> - -namespace iana_time_zone_haiku { -size_t get_tz(rust::Slice<uint8_t> buf); -} diff --git a/vendor/iana-time-zone-haiku/src/lib.rs b/vendor/iana-time-zone-haiku/src/lib.rs index 55681a267..8ce821faa 100644 --- a/vendor/iana-time-zone-haiku/src/lib.rs +++ b/vendor/iana-time-zone-haiku/src/lib.rs @@ -16,18 +16,14 @@ //! [![Crates.io](https://img.shields.io/crates/v/iana-time-zone-haiku.svg)](https://crates.io/crates/iana-time-zone-haiku) //! [![Documentation](https://docs.rs/iana-time-zone/badge.svg)](https://docs.rs/iana-time-zone/) //! [![Crate License](https://img.shields.io/crates/l/iana-time-zone-haiku-haiku.svg)](https://crates.io/crates/iana-time-zone-haiku) -//! [![build](https://github.com/strawlab/iana-time-zone/workflows/build/badge.svg?branch=master)](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amaster) +//! [![build](https://github.com/strawlab/iana-time-zone/workflows/build/badge.svg?branch=main)](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amain) //! //! [iana-time-zone](https://github.com/strawlab/iana-time-zone) support crate for Haiku OS. -#[cxx::bridge(namespace = "iana_time_zone_haiku")] -mod ffi { - // SAFETY: in here "unsafe" is simply part of the syntax - unsafe extern "C++" { - include!("iana-time-zone-haiku/src/interface.h"); +use std::os::raw::c_char; - fn get_tz(buf: &mut [u8]) -> usize; - } +extern "C" { + fn iana_time_zone_haiku_get_tz(buf: *mut c_char, buf_size: usize) -> usize; } /// Get the current IANA time zone as a string. @@ -40,10 +36,17 @@ mod ffi { /// ``` /// let timezone = iana_time_zone_haiku::get_timezone(); /// ``` +#[must_use] pub fn get_timezone() -> Option<String> { // The longest name in the IANA time zone database is 25 ASCII characters long. let mut buf = [0u8; 32]; - let len = ffi::get_tz(&mut buf); + // SAFETY: a valid, aligned, non-NULL pointer and length are given which + // point to a single allocation. + let len = unsafe { + let buf_size = buf.len(); + let buf_ptr = buf.as_mut_ptr().cast::<c_char>(); + iana_time_zone_haiku_get_tz(buf_ptr, buf_size) + }; // The name should not be empty, or excessively long. match buf.get(..len)? { b"" => None, |