Skip to content

Commit

Permalink
Change crate name to "zip" per zip-rs/zip-old#446 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr0methean committed Apr 20, 2024
1 parent 91a549d commit 1748252
Show file tree
Hide file tree
Showing 27 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

### Merged from upstream

- Added experimental [`zip_next::unstable::write::FileOptions::with_deprecated_encryption`] API to enable encrypting
- Added experimental [`zip::unstable::write::FileOptions::with_deprecated_encryption`] API to enable encrypting
files with PKWARE encryption.

## [0.7.5]
Expand All @@ -134,7 +134,7 @@

### Changed

- Alignment and extra-data fields are now attributes of [`zip_next::unstable::write::FileOptions`], allowing them to be
- Alignment and extra-data fields are now attributes of [`zip::unstable::write::FileOptions`], allowing them to be
specified for `add_directory` and `add_symlink`.
- Extra-data fields are now formatted by the `FileOptions` method `add_extra_data`.
- Improved performance, especially for `shallow_copy_file` and `deep_copy_file` on files with extra data.
Expand Down Expand Up @@ -197,7 +197,7 @@
### Added

- `zlib-ng` for fast Deflate compression. This is now the default for compression levels 0-9.
- `chrono` to convert zip_next::DateTime to and from chrono::NaiveDateTime
- `chrono` to convert zip::DateTime to and from chrono::NaiveDateTime

## [0.10.0]

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "zip_next"
name = "zip"
version = "1.1.0"
authors = [
"Mathijs van de Nes <git@mathijs.vd-nes.nl>",
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
zip_next
zip
========

[![Build Status](https://github.com/Pr0methean/zip-next/actions/workflows/ci.yaml/badge.svg)](https://github.com/Pr0methean/zip-next/actions?query=branch%3Amaster+workflow%3ACI)
[![Crates.io version](https://img.shields.io/crates/v/zip_next.svg)](https://crates.io/crates/zip_next)
[![Crates.io version](https://img.shields.io/crates/v/zip.svg)](https://crates.io/crates/zip)

[Documentation](https://docs.rs/zip_next/1.1.0/zip_next/)
[Documentation](https://docs.rs/zip/1.1.0/zip/)

Info
----
Expand Down Expand Up @@ -33,14 +33,14 @@ With all default features:

```toml
[dependencies]
zip_next = "1.1.0"
zip = "1.1.0"
```

Without the default features:

```toml
[dependencies]
zip_next = { version = "1.1.0", default-features = false }
zip = { version = "1.1.0", default-features = false }
```

The features available are:
Expand All @@ -56,7 +56,7 @@ The features available are:
* `deflate64`: Enables the deflate64 compression algorithm. Decompression is only supported.
* `bzip2`: Enables the BZip2 compression algorithm.
* `time`: Enables features using the [time](https://github.com/rust-lang-deprecated/time) crate.
* `chrono`: Enables converting last-modified `zip_next::DateTime` to and from `chrono::NaiveDateTime`.
* `chrono`: Enables converting last-modified `zip::DateTime` to and from `chrono::NaiveDateTime`.
* `zstd`: Enables the Zstandard compression algorithm.

By default `aes-crypto`, `deflate`, `deflate-zlib-ng`, `deflate-zopfli`, `bzip2`, `time` and `zstd` are enabled.
Expand Down
4 changes: 2 additions & 2 deletions benches/read_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use std::io::{Cursor, Read, Write};

use bencher::Bencher;
use getrandom::getrandom;
use zip_next::{write::SimpleFileOptions, ZipArchive, ZipWriter};
use zip::{write::SimpleFileOptions, ZipArchive, ZipWriter};

fn generate_random_archive(size: usize) -> Vec<u8> {
let data = Vec::new();
let mut writer = ZipWriter::new(Cursor::new(data));
let options =
SimpleFileOptions::default().compression_method(zip_next::CompressionMethod::Stored);
SimpleFileOptions::default().compression_method(zip::CompressionMethod::Stored);

writer.start_file("random.dat", options).unwrap();
let mut bytes = vec![0u8; size];
Expand Down
4 changes: 2 additions & 2 deletions benches/read_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use bencher::{benchmark_group, benchmark_main};
use std::io::{Cursor, Write};

use bencher::Bencher;
use zip_next::write::SimpleFileOptions;
use zip_next::{CompressionMethod, ZipArchive, ZipWriter};
use zip::write::SimpleFileOptions;
use zip::{CompressionMethod, ZipArchive, ZipWriter};

const FILE_COUNT: usize = 15_000;
const FILE_SIZE: usize = 1024;
Expand Down
2 changes: 1 addition & 1 deletion examples/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn real_main() -> i32 {
let fname = std::path::Path::new(&*args[1]);
let file = fs::File::open(fname).unwrap();

let mut archive = zip_next::ZipArchive::new(file).unwrap();
let mut archive = zip::ZipArchive::new(file).unwrap();

for i in 0..archive.len() {
let mut file = archive.by_index(i).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/extract_lorem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn real_main() -> i32 {
let fname = std::path::Path::new(&*args[1]);
let zipfile = std::fs::File::open(fname).unwrap();

let mut archive = zip_next::ZipArchive::new(zipfile).unwrap();
let mut archive = zip::ZipArchive::new(zipfile).unwrap();

let mut file = match archive.by_name("test/lorem_ipsum.txt") {
Ok(file) => file,
Expand Down
2 changes: 1 addition & 1 deletion examples/file_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn real_main() -> i32 {
let file = fs::File::open(fname).unwrap();
let reader = BufReader::new(file);

let mut archive = zip_next::ZipArchive::new(reader).unwrap();
let mut archive = zip::ZipArchive::new(reader).unwrap();

for i in 0..archive.len() {
let file = archive.by_index(i).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/stdin_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn real_main() -> i32 {
let mut buf = [0u8; 16];

loop {
match zip_next::read::read_zipfile_from_stream(&mut stdin_handle) {
match zip::read::read_zipfile_from_stream(&mut stdin_handle) {
Ok(Some(mut file)) => {
println!(
"{}: {} bytes ({} bytes packed)",
Expand Down
26 changes: 13 additions & 13 deletions examples/write_dir.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context;
use std::io::prelude::*;
use zip_next::{result::ZipError, write::SimpleFileOptions};
use zip::{result::ZipError, write::SimpleFileOptions};

use std::fs::File;
use std::path::Path;
Expand All @@ -10,35 +10,35 @@ fn main() {
std::process::exit(real_main());
}

const METHOD_STORED: Option<zip_next::CompressionMethod> =
Some(zip_next::CompressionMethod::Stored);
const METHOD_STORED: Option<zip::CompressionMethod> =
Some(zip::CompressionMethod::Stored);

#[cfg(any(
feature = "deflate",
feature = "deflate-miniz",
feature = "deflate-zlib",
feature = "deflate-zlib-ng"
))]
const METHOD_DEFLATED: Option<zip_next::CompressionMethod> =
Some(zip_next::CompressionMethod::Deflated);
const METHOD_DEFLATED: Option<zip::CompressionMethod> =
Some(zip::CompressionMethod::Deflated);
#[cfg(not(any(
feature = "deflate",
feature = "deflate-miniz",
feature = "deflate-zlib",
feature = "deflate-zlib-ng",
feature = "deflate-zopfli"
)))]
const METHOD_DEFLATED: Option<zip_next::CompressionMethod> = None;
const METHOD_DEFLATED: Option<zip::CompressionMethod> = None;

#[cfg(feature = "bzip2")]
const METHOD_BZIP2: Option<zip_next::CompressionMethod> = Some(zip_next::CompressionMethod::Bzip2);
const METHOD_BZIP2: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Bzip2);
#[cfg(not(feature = "bzip2"))]
const METHOD_BZIP2: Option<zip_next::CompressionMethod> = None;
const METHOD_BZIP2: Option<zip::CompressionMethod> = None;

#[cfg(feature = "zstd")]
const METHOD_ZSTD: Option<zip_next::CompressionMethod> = Some(zip_next::CompressionMethod::Zstd);
const METHOD_ZSTD: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Zstd);
#[cfg(not(feature = "zstd"))]
const METHOD_ZSTD: Option<zip_next::CompressionMethod> = None;
const METHOD_ZSTD: Option<zip::CompressionMethod> = None;

fn real_main() -> i32 {
let args: Vec<_> = std::env::args().collect();
Expand Down Expand Up @@ -69,12 +69,12 @@ fn zip_dir<T>(
it: &mut dyn Iterator<Item = DirEntry>,
prefix: &str,
writer: T,
method: zip_next::CompressionMethod,
method: zip::CompressionMethod,
) -> anyhow::Result<()>
where
T: Write + Seek,
{
let mut zip = zip_next::ZipWriter::new(writer);
let mut zip = zip::ZipWriter::new(writer);
let options = SimpleFileOptions::default()
.compression_method(method)
.unix_permissions(0o755);
Expand Down Expand Up @@ -110,7 +110,7 @@ where
Ok(())
}

fn doit(src_dir: &str, dst_file: &str, method: zip_next::CompressionMethod) -> anyhow::Result<()> {
fn doit(src_dir: &str, dst_file: &str, method: zip::CompressionMethod) -> anyhow::Result<()> {
if !Path::new(src_dir).is_dir() {
return Err(ZipError::FileNotFound.into());
}
Expand Down
8 changes: 4 additions & 4 deletions examples/write_sample.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::io::prelude::*;
use zip_next::write::SimpleFileOptions;
use zip::write::SimpleFileOptions;

fn main() {
std::process::exit(real_main());
Expand All @@ -21,16 +21,16 @@ fn real_main() -> i32 {
0
}

fn doit(filename: &str) -> zip_next::result::ZipResult<()> {
fn doit(filename: &str) -> zip::result::ZipResult<()> {
let path = std::path::Path::new(filename);
let file = std::fs::File::create(path).unwrap();

let mut zip = zip_next::ZipWriter::new(file);
let mut zip = zip::ZipWriter::new(file);

zip.add_directory("test/", SimpleFileOptions::default())?;

let options = SimpleFileOptions::default()
.compression_method(zip_next::CompressionMethod::Stored)
.compression_method(zip::CompressionMethod::Stored)
.unix_permissions(0o755);
zip.start_file("test/☃.txt", options)?;
zip.write_all(b"Hello, World!\n")?;
Expand Down
6 changes: 3 additions & 3 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ cargo-fuzz = true
libfuzzer-sys = "0.4"
arbitrary = { version = "1.3.0", features = ["derive"] }

[dependencies.zip_next]
[dependencies.zip]
path = ".."
default-features = false

[features]
zip_next_defaults = ["zip_next/default"]
default = ["zip_next_defaults"]
zip_defaults = ["zip/default"]
default = ["zip_defaults"]

# Prevent this from interfering with workspaces
[workspace]
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/fuzz_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const MAX_BYTES_TO_READ: u64 = 1 << 24;

fn decompress_all(data: &[u8]) -> Result<(), Box<dyn std::error::Error>> {
let reader = std::io::Cursor::new(data);
let mut zip = zip_next::ZipArchive::new(reader)?;
let mut zip = zip::ZipArchive::new(reader)?;

for i in 0..zip.len() {
let mut file = zip.by_index(i)?.take(MAX_BYTES_TO_READ);
Expand Down
14 changes: 7 additions & 7 deletions fuzz/fuzz_targets/fuzz_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use std::path::PathBuf;
pub enum BasicFileOperation {
WriteNormalFile {
contents: Vec<Vec<u8>>,
options: zip_next::write::FullFileOptions,
options: zip::write::FullFileOptions,
},
WriteDirectory(zip_next::write::FullFileOptions),
WriteDirectory(zip::write::FullFileOptions),
WriteSymlinkWithTarget {
target: Box<PathBuf>,
options: zip_next::write::FullFileOptions,
options: zip::write::FullFileOptions,
},
ShallowCopy(Box<FileOperation>),
DeepCopy(Box<FileOperation>),
Expand Down Expand Up @@ -48,7 +48,7 @@ impl FileOperation {
}

fn do_operation<T>(
writer: &mut RefCell<zip_next::ZipWriter<T>>,
writer: &mut RefCell<zip::ZipWriter<T>>,
operation: FileOperation,
abort: bool,
flush_on_finish_file: bool,
Expand Down Expand Up @@ -100,15 +100,15 @@ where
if operation.reopen {
let old_comment = writer.borrow().get_raw_comment().to_owned();
let new_writer =
zip_next::ZipWriter::new_append(writer.borrow_mut().finish().unwrap()).unwrap();
zip::ZipWriter::new_append(writer.borrow_mut().finish().unwrap()).unwrap();
assert_eq!(&old_comment, new_writer.get_raw_comment());
*writer = new_writer.into();
}
Ok(())
}

fuzz_target!(|test_case: FuzzTestCase| {
let mut writer = RefCell::new(zip_next::ZipWriter::new(Cursor::new(Vec::new())));
let mut writer = RefCell::new(zip::ZipWriter::new(Cursor::new(Vec::new())));
writer.borrow_mut().set_raw_comment(test_case.comment);
for (operation, abort) in test_case.operations {
let _ = do_operation(
Expand All @@ -118,5 +118,5 @@ fuzz_target!(|test_case: FuzzTestCase| {
test_case.flush_on_finish_file,
);
}
let _ = zip_next::ZipArchive::new(writer.borrow_mut().finish().unwrap());
let _ = zip::ZipArchive::new(writer.borrow_mut().finish().unwrap());
});
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//!
//! ---
//!
//! [`zip_next`](`crate`) has support for the most common ZIP archives found in common use.
//! [`zip`](`crate`) has support for the most common ZIP archives found in common use.
//! However, in special cases,
//! there are some zip archives that are difficult to read or write.
//!
Expand Down Expand Up @@ -53,6 +53,6 @@ mod zipcrypto;
///
/// ```toml
/// [dependencies]
/// zip_next = "=1.1.0"
/// zip = "=1.1.0"
/// ```
pub mod unstable;
4 changes: 2 additions & 2 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ pub(crate) mod zip_archive {
///
/// ```no_run
/// use std::io::prelude::*;
/// fn list_zip_contents(reader: impl Read + Seek) -> zip_next::result::ZipResult<()> {
/// let mut zip = zip_next::ZipArchive::new(reader)?;
/// fn list_zip_contents(reader: impl Read + Seek) -> zip::result::ZipResult<()> {
/// let mut zip = zip::ZipArchive::new(reader)?;
///
/// for i in 0..zip.len() {
/// let mut file = zip.by_index(i)?;
Expand Down
4 changes: 2 additions & 2 deletions src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ impl ZipError {
/// The text used as an error when a password is required and not supplied
///
/// ```rust,no_run
/// # use zip_next::result::ZipError;
/// # let mut archive = zip_next::ZipArchive::new(std::io::Cursor::new(&[])).unwrap();
/// # use zip::result::ZipError;
/// # let mut archive = zip::ZipArchive::new(std::io::Cursor::new(&[])).unwrap();
/// match archive.by_index(1) {
/// Err(ZipError::UnsupportedArchive(ZipError::PASSWORD_REQUIRED)) => eprintln!("a password is needed to unzip this file"),
/// _ => (),
Expand Down
Loading

0 comments on commit 1748252

Please sign in to comment.