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

Switch to byteorder-lite crate #2196

Merged
merged 1 commit into from Apr 14, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -36,7 +36,7 @@ exclude = ["src/png/testdata/*", "examples/*", "tests/*"]

[dependencies]
bytemuck = { version = "1.8.0", features = ["extern_crate_alloc"] } # includes cast_vec
byteorder = "1.3.2"
byteorder-lite = "0.1.0"
num-traits = { version = "0.2.0" }

# Optional dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/bmp/decoder.rs
Expand Up @@ -4,7 +4,7 @@ use std::iter::{repeat, Rev};
use std::slice::ChunksMut;
use std::{error, fmt};

use byteorder::{LittleEndian, ReadBytesExt};
use byteorder_lite::{LittleEndian, ReadBytesExt};

use crate::color::ColorType;
use crate::error::{
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/bmp/encoder.rs
@@ -1,4 +1,4 @@
use byteorder::{LittleEndian, WriteBytesExt};
use byteorder_lite::{LittleEndian, WriteBytesExt};
use std::io::{self, Write};

use crate::error::{
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/dds.rs
Expand Up @@ -8,7 +8,7 @@
use std::io::Read;
use std::{error, fmt};

use byteorder::{LittleEndian, ReadBytesExt};
use byteorder_lite::{LittleEndian, ReadBytesExt};

#[allow(deprecated)]
use crate::codecs::dxt::{DxtDecoder, DxtVariant};
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/farbfeld.rs
Expand Up @@ -315,7 +315,7 @@ impl<W: Write> ImageEncoder for FarbfeldEncoder<W> {
mod tests {
use crate::codecs::farbfeld::FarbfeldDecoder;
use crate::ImageDecoderRect;
use byteorder::{ByteOrder, NativeEndian};
use byteorder_lite::{ByteOrder, NativeEndian};
use std::io::{Cursor, Seek, SeekFrom};

static RECTANGLE_IN: &[u8] = b"farbfeld\
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/ico/decoder.rs
@@ -1,4 +1,4 @@
use byteorder::{LittleEndian, ReadBytesExt};
use byteorder_lite::{LittleEndian, ReadBytesExt};
use std::io::{BufRead, Read, Seek, SeekFrom};
use std::{error, fmt};

Expand Down
2 changes: 1 addition & 1 deletion src/codecs/ico/encoder.rs
@@ -1,4 +1,4 @@
use byteorder::{LittleEndian, WriteBytesExt};
use byteorder_lite::{LittleEndian, WriteBytesExt};
use std::borrow::Cow;
use std::io::{self, Write};

Expand Down
4 changes: 2 additions & 2 deletions src/codecs/png.rs
Expand Up @@ -178,7 +178,7 @@ impl<R: BufRead + Seek> ImageDecoder for PngDecoder<R> {
}

fn read_image(mut self, buf: &mut [u8]) -> ImageResult<()> {
use byteorder::{BigEndian, ByteOrder, NativeEndian};
use byteorder_lite::{BigEndian, ByteOrder, NativeEndian};

assert_eq!(u64::try_from(buf.len()), Ok(self.total_bytes()));
self.reader.next_frame(buf).map_err(ImageError::from_png)?;
Expand Down Expand Up @@ -607,7 +607,7 @@ impl<W: Write> ImageEncoder for PngEncoder<W> {
height: u32,
color_type: ExtendedColorType,
) -> ImageResult<()> {
use byteorder::{BigEndian, ByteOrder, NativeEndian};
use byteorder_lite::{BigEndian, ByteOrder, NativeEndian};
use ExtendedColorType::*;

let expected_buffer_len = color_type.buffer_size(width, height);
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/pnm/decoder.rs
Expand Up @@ -13,7 +13,7 @@ use crate::error::{
use crate::image::{ImageDecoder, ImageFormat};
use crate::utils;

use byteorder::{BigEndian, ByteOrder, NativeEndian};
use byteorder_lite::{BigEndian, ByteOrder, NativeEndian};

/// All errors that can occur when attempting to parse a PNM
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/pnm/encoder.rs
Expand Up @@ -14,7 +14,7 @@ use crate::error::{
};
use crate::image::{ImageEncoder, ImageFormat};

use byteorder::{BigEndian, WriteBytesExt};
use byteorder_lite::{BigEndian, WriteBytesExt};

enum HeaderStrategy {
Dynamic,
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/pnm/mod.rs
Expand Up @@ -22,7 +22,7 @@ mod tests {
use super::*;
use crate::image::ImageDecoder;
use crate::ExtendedColorType;
use byteorder::{ByteOrder, NativeEndian};
use byteorder_lite::{ByteOrder, NativeEndian};

fn execute_roundtrip_default(buffer: &[u8], width: u32, height: u32, color: ExtendedColorType) {
let mut encoded_buffer = Vec::new();
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/tga/decoder.rs
Expand Up @@ -6,7 +6,7 @@ use crate::{
},
image::{ImageDecoder, ImageFormat},
};
use byteorder::ReadBytesExt;
use byteorder_lite::ReadBytesExt;
use std::io::{self, Read};

struct ColorMap {
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/tga/header.rs
Expand Up @@ -2,7 +2,7 @@ use crate::{
error::{UnsupportedError, UnsupportedErrorKind},
ExtendedColorType, ImageError, ImageFormat, ImageResult,
};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use byteorder_lite::{LittleEndian, ReadBytesExt, WriteBytesExt};
use std::io::{Read, Write};

pub(crate) const ALPHA_BIT_MASK: u8 = 0b1111;
Expand Down
2 changes: 1 addition & 1 deletion tests/reference_images.rs
Expand Up @@ -314,7 +314,7 @@ fn check_references() {
#[cfg(feature = "hdr")]
#[test]
fn check_hdr_references() {
use byteorder::{LittleEndian as LE, ReadBytesExt};
use byteorder_lite::{LittleEndian as LE, ReadBytesExt};
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
Expand Down