Skip to content

Commit

Permalink
Fix build errors resulting from savage merges
Browse files Browse the repository at this point in the history
  • Loading branch information
crowdagger committed Oct 5, 2024
1 parent 6356fad commit a6b388f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/epub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::io;
use std::io::Read;
use std::path::Path;
use std::str::FromStr;
use upon::Engine;

/// Represents the EPUB version.
///
Expand Down Expand Up @@ -720,8 +721,8 @@ impl<Z: Zip> EpubBuilder<Z> {

let mut res: Vec<u8> = vec![];
match self.version {
EpubVersion::V20 => templates::v2::CONTENT_OPF.render(&data).to_writer(&mut res),
EpubVersion::V30 => templates::v3::CONTENT_OPF.render(&data).to_writer(&mut res),
EpubVersion::V20 => templates::v2::CONTENT_OPF.render(&Engine::new(), &data).to_writer(&mut res),
EpubVersion::V30 => templates::v3::CONTENT_OPF.render(&Engine::new(), &data).to_writer(&mut res),
}
.map_err(|e| crate::Error::TemplateError {
msg: "could not render template for content.opf".to_string(),
Expand Down Expand Up @@ -812,8 +813,8 @@ impl<Z: Zip> EpubBuilder<Z> {

let mut res: Vec<u8> = vec![];
match self.version {
EpubVersion::V20 => templates::v2::NAV_XHTML.render(&data).to_writer(&mut res),
EpubVersion::V30 => templates::v3::NAV_XHTML.render(&data).to_writer(&mut res),
EpubVersion::V20 => templates::v2::NAV_XHTML.render(&Engine::new(), &data).to_writer(&mut res),
EpubVersion::V30 => templates::v3::NAV_XHTML.render(&Engine::new(), &data).to_writer(&mut res),
}
.map_err(|e| crate::Error::TemplateError {
msg: "error rendering nav.xhtml template".to_string(),
Expand Down
7 changes: 3 additions & 4 deletions src/zip_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::io::Write;
use std::path::Path;

use crate::Result;
use libzip::write::FileOptions;
use libzip::CompressionMethod;
use libzip::ZipWriter;

Expand Down Expand Up @@ -43,7 +42,7 @@ impl ZipLibrary {
writer.set_comment(""); // Fix issues with some readers
writer.start_file(
"mimetype",
FileOptions::default().compression_method(CompressionMethod::Stored),
libzip::write::SimpleFileOptions::default().compression_method(CompressionMethod::Stored),
)?;
writer
.write(b"application/epub+zip")
Expand All @@ -63,7 +62,7 @@ impl Zip for ZipLibrary {
// Path names should not use backspaces in zip files
file = file.replace('\\', "/");
}
let options = FileOptions::default();
let options = libzip::write::SimpleFileOptions::default();
self.writer.start_file(file.clone(), options).map_err(|e| {
crate::Error::ZipErrorWithMessage {
msg: format!("could not create file '{}' in epub", file),
Expand All @@ -77,7 +76,7 @@ impl Zip for ZipLibrary {
Ok(())
}

fn generate<W: Write>(&mut self, mut to: W) -> Result<()> {
fn generate<W: Write>(self, mut to: W) -> Result<()> {
let cursor = self
.writer
.finish()
Expand Down

0 comments on commit a6b388f

Please sign in to comment.