Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare release #63

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 28 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,34 @@ members = [
exclude = [
"libbz2-rs-sys-cdylib",
]
package.edition = "2021"


[package]
name = "c2rust_out"
authors = ["C2Rust"]
version = "0.0.0"
publish = false
[workspace.package]
version = "0.1.0"
edition = "2021"
license = "bzip2-1.0.6"
repository = "https://github.com/trifectatechfoundation/libbzip2-rs"
homepage = "https://github.com/trifectatechfoundation/libbzip2-rs"
readme = "./README.md"
description = "a drop-in compatible rust bzip2 implementation"
publish = true
rust-version = "1.82" # MSRV

[workspace.dependencies]
libc = "0.2"
libbz2-rs-sys = { path = "libbz2-rs-sys/", default-features = false }

[package]
name = "libbzip2-rs"
readme.workspace = true
description.workspace = true
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
publish.workspace = true
rust-version.workspace = true

[[bin]]
name = "bzip2"
path = "bzip2.rs"
Expand All @@ -25,14 +42,11 @@ path = "bzip2.rs"
name = "bzip2recover"
path = "bzip2recover.rs"

[workspace.dependencies]
libc = "0.2"
libbz2-rs-sys = { path = "libbz2-rs-sys/", default-features = false }


[dependencies]
libc = "0.2"
libbz2-rs-sys = { path = "libbz2-rs-sys/" }
libc.workspace = true
# we need `std` here, because we test the log output of the binaries, and those only
# get printed when std is enabled.
libbz2-rs-sys = { workspace = true, features = ["stdio", "c-allocator"] }

[dev-dependencies]
tempfile = "3.13.0"
Expand Down
4 changes: 2 additions & 2 deletions libbz2-rs-sys-cdylib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions libbz2-rs-sys-cdylib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "libbz2-rs-sys-cdylib"
version = "0.0.0"
version = "0.1.0"
edition = "2021"
readme = "README.md"
license = "bzip2-1.0.6"
repository = "https://github.com/trifectatechfoundation/libbzip2-rs"
homepage = "https://github.com/trifectatechfoundation/libbzip2-rs"
bjorn3 marked this conversation as resolved.
Show resolved Hide resolved
readme = "./README.md"
description = "a drop-in compatible libbz2 cdylib"
publish = true
description = "A memory-safe bzip2 implementation written in rust"
rust-version = "1.82" # MSRV

[lib]
Expand All @@ -22,7 +22,7 @@ custom-prefix = ["libbz2-rs-sys/custom-prefix"] # use the LIBBZ2_RS_SYS_PREFIX t
capi = []

[dependencies]
libbz2-rs-sys = { version = "0.0.0", path = "../libbz2-rs-sys", default-features = false, features = ["c-allocator"] }
libbz2-rs-sys = { version = "0.1.0", path = "../libbz2-rs-sys", default-features = false, features = ["c-allocator"] }
libc = "0.2"

[package.metadata.capi.library]
Expand Down
42 changes: 42 additions & 0 deletions libbz2-rs-sys-cdylib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

--------------------------------------------------------------------------

This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2010 Julian R Seward. All
rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.

3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.

4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Julian Seward, [email protected]
bzip2/libbzip2 version 1.1.0 of 6 September 2010

--------------------------------------------------------------------------
5 changes: 2 additions & 3 deletions libbz2-rs-sys-cdylib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ impl core::fmt::Write for StderrWritter {
use core::ffi::c_void;
use libc::write;

unsafe {
write(2, s.as_ptr() as *const c_void, s.len());
}
unsafe { write(2, s.as_ptr() as *const c_void, s.len() as _) };

Ok(())
}
}
Expand Down
7 changes: 7 additions & 0 deletions libbz2-rs-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[package]
name = "libbz2-rs-sys"
readme = "README.md"
description.workspace = true
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
publish.workspace = true
rust-version.workspace = true

[features]
default = ["std", "stdio"]
Expand Down
1 change: 1 addition & 0 deletions libbz2-rs-sys/LICENSE
2 changes: 1 addition & 1 deletion libbz2-rs-sys/src/bzlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ mod stream {
let bzalloc = strm.bzalloc.get_or_insert(default_bzalloc);
let bzfree = strm.bzfree.get_or_insert(default_bzfree);

Some(Allocator::custom(*bzalloc, *bzfree, (*strm).opaque))
Some(Allocator::custom(*bzalloc, *bzfree, strm.opaque))
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions libbz2-rs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,42 @@ pub(crate) use libbz2_rs_sys_version;

// --- debug logs

#[cfg(all(not(feature = "std"), feature = "stdio"))]
pub(crate) struct StderrWritter;

#[cfg(all(not(feature = "std"), feature = "stdio"))]
impl core::fmt::Write for StderrWritter {
fn write_str(&mut self, s: &str) -> core::fmt::Result {
use core::ffi::c_void;
use libc::write;

unsafe { write(2, s.as_ptr() as *const c_void, s.len() as _) };

Ok(())
}
}

macro_rules! debug_log {
($($arg:tt)*) => {
#[cfg(feature = "std")]
std::eprint!($($arg)*);
#[cfg(all(not(feature = "std"), feature = "stdio"))]
{
use core::fmt::Write;
let _ = write!($crate::StderrWritter, $($arg)*);
}
};
}

macro_rules! debug_logln {
($($arg:tt)*) => {
#[cfg(feature = "std")]
std::eprintln!($($arg)*);
#[cfg(all(not(feature = "std"), feature = "stdio"))]
{
use core::fmt::Write;
let _ = writeln!($crate::StderrWritter, $($arg)*);
}
};
}

Expand Down
Loading