commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
6c7dad1e2c2f65f4fa1477d8033f29e1c4c990c9 | Ivan Smirnov | 2022-01-02T15:59:25 | Decoder: remove decode_to_stream(), use output buf | diff --git a/src/decode.rs b/src/decode.rs
index 782a637..4d86a5b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,4 +1,4 @@
-use std::io::{Read, Write};
+use std::io::Read;
// TODO: can be removed once https://github.com/rust-lang/rust/issues/74985 is stable
use bytemuck::{cast_slice, cast_slice_mut, Pod};
@@ ... | 1 | 29 | 43 |
b8fe879b22fca5622fbcd346bf3b0f336cd13064 | Ivan Smirnov | 2022-01-02T15:58:54 | In qoi-bench, report and skip invalid png files | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 3ca5643..57c0f7a 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -374,7 +374,12 @@ fn bench_png(filename: &Path, seconds: f64, use_median: bool) -> Result<ImageBen
fn bench_suite(files: &[PathBuf], seconds: f64, use_median: bool) -> Res... | 1 | 6 | 1 |
59e67b455a6d70f175dfe93d9150b1d251e11fa3 | Ivan Smirnov | 2022-01-02T11:02:44 | Encoder minor fixups | diff --git a/src/encode.rs b/src/encode.rs
index 986a663..3fe44d4 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -44,13 +44,13 @@ impl<'a> WriteBuf<'a> {
}
#[allow(clippy::cast_possible_truncation)]
-fn qoi_encode_impl<const CHANNELS: usize>(
+fn qoi_encode_impl<const N: usize>(
out: &mut [u8], data: &[u8],... | 1 | 10 | 11 |
21b06f37e027da690b274867cc721a7bf475b795 | Ivan Smirnov | 2022-01-01T21:03:58 | Re-export all decoding funcs/structs at crate root | diff --git a/src/lib.rs b/src/lib.rs
index 4590249..0f536a0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,7 +21,9 @@ mod utils;
pub mod consts;
pub use crate::colorspace::ColorSpace;
-pub use crate::decode::{qoi_decode_header, qoi_decode_to_vec};
+pub use crate::decode::{
+ qoi_decode_header, qoi_decode_to_buf... | 1 | 3 | 1 |
074fc72b2232be96e27e99ffe7779d6385fc9ea8 | Ivan Smirnov | 2022-01-01T21:03:47 | Add generic streaming decoder | diff --git a/src/decode.rs b/src/decode.rs
index eb5769c..782a637 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,3 +1,5 @@
+use std::io::{Read, Write};
+
// TODO: can be removed once https://github.com/rust-lang/rust/issues/74985 is stable
use bytemuck::{cast_slice, cast_slice_mut, Pod};
@@ -217,4 +219,179 @@... | 2 | 189 | 1 |
4a8c20e0d3d26bb6ffd298a04c455aa02ab6172f | Ivan Smirnov | 2022-01-01T21:02:55 | QoiDecoder - minor cleanups | diff --git a/src/decode.rs b/src/decode.rs
index d88af6a..eb5769c 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -133,7 +133,7 @@ fn qoi_decode_impl_slice_all(
(4, 4) => qoi_decode_impl_slice::<4, true>(data, out),
_ => {
cold();
- return Err(Error::InvalidChannels { channel... | 1 | 7 | 7 |
0eb8a7ade7ccbe3e2446c5dc9b06114054f21bc6 | Ivan Smirnov | 2022-01-01T21:02:08 | Add QoiDecoder, handle padding properly + refactor | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 49553e3..3ca5643 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -126,8 +126,8 @@ impl Codec for CodecQoiFast {
Ok(qoi_fast::qoi_encode_to_vec(&img.data, img.width, img.height, img.channels, 0)?)
}
- fn decode(data: &[... | 4 | 87 | 45 |
acdd29060c160fffe2d1cf1bda45fc0e6044da78 | Ivan Smirnov | 2022-01-01T18:58:18 | Further decoder reworks + add qoi_decode_to_buf() | diff --git a/src/decode.rs b/src/decode.rs
index 8076272..15f6a3b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -15,81 +15,104 @@ const QOI_OP_RUN_END: u8 = QOI_OP_RUN | 0x3d; // <- note, 0x3d (not 0x3f)
const QOI_OP_DIFF_END: u8 = QOI_OP_DIFF | 0x3f;
const QOI_OP_LUMA_END: u8 = QOI_OP_LUMA | 0x3f;
-pub fn qoi_... | 1 | 94 | 44 |
343f11bccfc06d394234e1507d88f1369f7f284b | Ivan Smirnov | 2022-01-01T18:55:51 | Sort the files when running benches | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 80b875b..49553e3 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -68,6 +68,7 @@ fn find_pngs(paths: &[PathBuf]) -> Result<Vec<PathBuf>> {
bail!("path doesn't exist: {}", path.to_string_lossy());
}
}
+ out.so... | 1 | 1 | 0 |
2a764a1132b844f13d80cbb99430dbdddb2765f2 | Ivan Smirnov | 2021-12-31T11:36:20 | Further encoder improvements | diff --git a/src/encode.rs b/src/encode.rs
index 67bc26e..986a663 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -105,19 +105,23 @@ where
let vg_r = vr.wrapping_sub(vg);
let vg_b = vb.wrapping_sub(vg);
- // TODO maybe add an outer check for vg_32
- ... | 1 | 15 | 11 |
637ac22a99a2eb528fdcac5ea0d38b5ab5a5d798 | Ivan Smirnov | 2021-12-31T10:37:56 | (Clippy fixes across the board) | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 8bda609..80b875b 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -210,8 +210,8 @@ struct BenchResult {
impl BenchResult {
pub fn new(codec: impl AsRef<str>, mut decode_sec: Vec<f64>, mut encode_sec: Vec<f64>) -> Self {
- d... | 7 | 61 | 69 |
b315ea20a706f090222c923ff5d333568a4121ad | Ivan Smirnov | 2021-12-31T10:35:32 | Mark consts mod as doc(hidden) | diff --git a/src/lib.rs b/src/lib.rs
index 78aa275..b4dcdb0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -19,6 +19,7 @@ mod header;
mod pixel;
mod utils;
+#[doc(hidden)]
pub mod consts;
pub use crate::colorspace::ColorSpace; | 1 | 1 | 0 |
2dcbdd19c22f572c3333457b01dabeaedc29868e | Ivan Smirnov | 2021-12-31T10:34:27 | Rework ColorSpace to match the latest spec (0 | 1) | diff --git a/src/colorspace.rs b/src/colorspace.rs
index 14706c2..02d6861 100644
--- a/src/colorspace.rs
+++ b/src/colorspace.rs
@@ -1,70 +1,53 @@
-use std::fmt::{self, Debug};
-
-#[derive(Copy, Clone, PartialEq, Eq, Hash)]
-pub struct ColorSpace {
- pub r_linear: bool,
- pub g_linear: bool,
- pub b_linear: bo... | 5 | 82 | 96 |
c39844fb983c72354685c8646b708723a9ff0643 | Ivan Smirnov | 2021-12-31T10:33:45 | Implement From<!> for Error | diff --git a/src/error.rs b/src/error.rs
index 049c02d..2352682 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,3 +1,4 @@
+use std::convert::Infallible;
use std::error::Error as StdError;
use std::fmt::{self, Display};
use std::result::Result as StdResult;
@@ -52,3 +53,9 @@ impl Display for Error {
}
impl Std... | 1 | 7 | 0 |
6019791c3bfff868d9e5644a79b0f21ab67d5059 | Ivan Smirnov | 2021-12-31T07:20:26 | In the bench suite, check for 3/4 channels | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index bc7803e..8bda609 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -91,12 +91,9 @@ fn read_png(filename: &Path) -> Result<Image> {
let mut buf = vec![0; reader.output_buffer_size()];
let info = reader.next_frame(&mut buf)?;
... | 1 | 3 | 6 |
5b0d4202007df55e8349f00804f09f5f41147940 | Ivan Smirnov | 2021-12-30T23:00:53 | Specialize the decoder by source channels as well | diff --git a/src/decode.rs b/src/decode.rs
index fe4bf38..7c34cdf 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -10,7 +10,9 @@ use crate::header::Header;
use crate::pixel::{Pixel, SupportedChannels};
use crate::utils::{cold, unlikely};
-pub fn qoi_decode_impl<const N: usize>(data: &[u8], n_pixels: usize) -> Res... | 1 | 9 | 8 |
9e7c508a349ba4b835d8a8f63c9c6669f52b5ddd | Ivan Smirnov | 2021-12-30T22:54:37 | Add forbid(unsafe_code) at crate root | diff --git a/src/lib.rs b/src/lib.rs
index bf7eae6..78aa275 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,4 @@
+#![forbid(unsafe_code)]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(
clippy::inline_always, | 1 | 1 | 0 |
a9a01c6fbdf7dd34228d8b358ad75f0c9f4880ba | Ivan Smirnov | 2021-12-30T22:44:59 | Rework the decoder so it's safe, add bytemuck dep | diff --git a/Cargo.toml b/Cargo.toml
index d555adc..ad1624d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,9 @@ exclude = [
"assets/*",
]
+[dependencies]
+bytemuck = "1.7"
+
[workspace]
members = ["qoi-bench"]
diff --git a/src/decode.rs b/src/decode.rs
index d4f4fa3..fe4bf38 100644
--- a/src/decode.r... | 4 | 79 | 76 |
6ce544950db87c06806a26e79d95a5ae68962d7b | Ivan Smirnov | 2021-12-30T15:01:16 | Rework the encoder, replace all unsafe code | diff --git a/src/encode.rs b/src/encode.rs
index b175392..024fd46 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -1,5 +1,3 @@
-use std::slice;
-
use crate::colorspace::ColorSpace;
use crate::consts::{
QOI_HEADER_SIZE, QOI_OP_DIFF, QOI_OP_INDEX, QOI_OP_LUMA, QOI_OP_RGB, QOI_OP_RGBA, QOI_OP_RUN,
@@ -8,42 +6,38 ... | 2 | 49 | 57 |
239a22926c5d7303c1563b3489c894d4fdeb5172 | Ivan Smirnov | 2021-12-30T10:22:22 | Get rid of most unsafe in decoder (1% speed loss) | diff --git a/src/decode.rs b/src/decode.rs
index 42ce006..d4f4fa3 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -7,41 +7,7 @@ use crate::consts::{
use crate::error::{Error, Result};
use crate::header::Header;
use crate::pixel::{Pixel, SupportedChannels};
-use crate::utils::unlikely;
-
-struct ReadBuf {
- curr... | 1 | 76 | 105 |
b25b060945f17785f4e7fda46a39ea7e4fda5461 | Ivan Smirnov | 2021-12-30T10:21:54 | Simplify likely/unlikely/cold helpers | diff --git a/src/utils.rs b/src/utils.rs
index 0067793..9ea837a 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,23 +1,19 @@
#[inline(always)]
-#[allow(unused)]
+#[cold]
+pub const fn cold() {}
+
+#[inline(always)]
pub const fn likely(b: bool) -> bool {
- // borrowed from `likely_stable` crate
- #[allow(clipp... | 1 | 10 | 14 |
0c8d7c64e8db9e4827c24be14b5d88ec696c4b37 | Ivan Smirnov | 2021-12-30T10:19:02 | Improve benchmark tool, report totals | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 7f1db0a..bc7803e 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -1,3 +1,4 @@
+use std::cmp::Ordering;
use std::fs::{self, File};
use std::path::{Path, PathBuf};
use std::ptr;
@@ -70,6 +71,7 @@ fn find_pngs(paths: &[PathBuf]) -> Resul... | 1 | 128 | 42 |
0fa8ce5fa9adc1ab7b19b6ea06745b2839b9e844 | Ivan Smirnov | 2021-12-29T19:41:03 | Add reference check tests | diff --git a/Cargo.toml b/Cargo.toml
index d60f121..d555adc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,9 @@ exclude = [
members = ["qoi-bench"]
[dev-dependencies]
-png = "^0.17.2"
+anyhow = "1.0"
+png = "0.17"
+walkdir = "2.3"
[lib]
name = "qoi_fast"
diff --git a/tests/test_ref.rs b/tests/test_ref.rs... | 2 | 109 | 1 |
b0467472ae3fa6502e309944ffa448ce2c1836a2 | Ivan Smirnov | 2021-12-29T19:41:39 | Big rework: everything now matches the latest spec | diff --git a/src/consts.rs b/src/consts.rs
index d7a5f05..b143f90 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -1,23 +1,11 @@
-// 2-bit tag
-pub const QOI_INDEX: u8 = 0x00; // (00)000000
-pub const QOI_DIFF_8: u8 = 0x80; // (10)000000
+pub const QOI_OP_INDEX: u8 = 0x00; // 00xxxxxx
+pub const QOI_OP_DIFF: u8 = 0x4... | 4 | 142 | 259 |
6ed5f1348741ac0e47053c38c76edaa7ba6bd883 | Ivan Smirnov | 2021-12-29T19:40:41 | Remove `canonical` mod and remove it from benches | diff --git a/qoi-bench/src/main.rs b/qoi-bench/src/main.rs
index 1789711..7f1db0a 100644
--- a/qoi-bench/src/main.rs
+++ b/qoi-bench/src/main.rs
@@ -131,28 +131,6 @@ impl Codec for CodecQoiFast {
}
}
-struct CodecQoiFastCanonical;
-
-impl Codec for CodecQoiFastCanonical {
- fn name() -> &'static str {
- ... | 3 | 0 | 48 |
24775b101489e0cc0550e4fbec22845c85cf7d0f | Ivan Smirnov | 2021-12-29T19:39:14 | (Remove temporary tests from crate root) | diff --git a/src/lib.rs b/src/lib.rs
index 6406f6d..5a49b4d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,51 +26,3 @@ pub use crate::decode::{qoi_decode_header, qoi_decode_to_vec};
pub use crate::encode::{encode_size_required, qoi_encode_to_buf, qoi_encode_to_vec};
pub use crate::error::{Error, Result};
pub use cr... | 1 | 0 | 48 |
f906d13e9082709f50512b255583782349a01fd1 | Ivan Smirnov | 2021-12-29T13:11:27 | Update pixel hash function to the latest spec | diff --git a/src/pixel.rs b/src/pixel.rs
index d2f89e5..e353e16 100644
--- a/src/pixel.rs
+++ b/src/pixel.rs
@@ -42,7 +42,7 @@ impl<const N: usize> Pixel<N> {
#[inline]
pub const fn hash_index(self) -> u8 {
- (self.r() ^ self.g() ^ self.b() ^ self.a_or(0xff)) % 64
+ (self.r() * 3 + self.g() * ... | 1 | 1 | 1 |
6640bc571aa29b17c5a8226debbc6b7c5dfb0a5c | Ivan Smirnov | 2021-12-29T13:07:54 | Add unique stream-end marker (7 zeros and one 1) | diff --git a/src/consts.rs b/src/consts.rs
index 204903b..d7a5f05 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -20,7 +20,9 @@ pub const QOI_MASK_3: u8 = 0xe0; // (111)00000
pub const QOI_MASK_4: u8 = 0xf0; // (1111)0000
pub const QOI_HEADER_SIZE: usize = 14;
-pub const QOI_PADDING: usize = 4;
+
+pub const QOI_... | 3 | 10 | 8 |
4d0d760f9278021549ba3c6655b3d101378b382f | Ivan Smirnov | 2021-12-29T13:00:16 | Enforce maximum size of 400Mp (QOI_PIXELS_MAX) | diff --git a/src/consts.rs b/src/consts.rs
index ee13ee0..204903b 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -24,3 +24,5 @@ pub const QOI_PADDING: usize = 4;
pub const QOI_MAGIC: u32 =
(b'q' as u32) << 24 | (b'o' as u32) << 16 | (b'i' as u32) << 8 | (b'f' as u32);
+
+pub const QOI_PIXELS_MAX: usize = 400... | 4 | 14 | 3 |
3ec3d3498751bfcbb373988df6ae35f277191080 | Ivan Smirnov | 2021-12-02T15:57:57 | Add Header::new() and with_colorspace() | diff --git a/src/header.rs b/src/header.rs
index b22a14f..443634b 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -41,6 +41,17 @@ const fn u32_from_be(v: &[u8]) -> u32 {
}
impl Header {
+ #[inline]
+ pub const fn new(width: u32, height: u32, channels: u8) -> Self {
+ Self { magic: QOI_MAGIC, width, h... | 1 | 11 | 0 |
02734e4eca5850973af8b2dd1f36faed682dbdb4 | Ivan Smirnov | 2021-12-02T15:57:03 | Replace Header::SIZE -> encoded_size() | diff --git a/src/header.rs b/src/header.rs
index 2e38d5e..b22a14f 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -41,7 +41,10 @@ const fn u32_from_be(v: &[u8]) -> u32 {
}
impl Header {
- pub const SIZE: usize = QOI_HEADER_SIZE;
+ #[inline]
+ pub const fn encoded_size() -> usize {
+ QOI_HEADER_SIZ... | 1 | 4 | 1 |
0825c0aa3aeace94e86207fad0949fb25fe5c862 | Ivan Smirnov | 2021-12-02T15:55:56 | Fix a few clippy lints | diff --git a/src/decode.rs b/src/decode.rs
index 6823595..1fb0076 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -57,7 +57,7 @@ where
let mut px = Pixel::new().with_a(0xff);
let mut run = 0_u16;
- for px_out in pixels.iter_mut() {
+ for px_out in &mut pixels {
if run != 0 {
ru... | 5 | 44 | 38 |
784f7952de3576dfdeb5c5f7c50fc0dc843f12f0 | Ivan Smirnov | 2021-12-02T15:54:41 | Remove criterion benches for now | diff --git a/Cargo.toml b/Cargo.toml
index e27c5f1..d60f121 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,22 +12,15 @@ documentation = "https://docs.rs/qoi-fast"
categories = ["multimedia::images", "multimedia::encoding"]
keywords = ["qoi", "graphics", "image", "encoding"]
exclude = [
- "benches/*",
"asset... | 2 | 3 | 68 |
bfbf032fff012bb04d5f8d0fc91c720d7e0f5ca8 | Ivan Smirnov | 2021-12-01T17:17:12 | Implement Debug manually for ColorSpace | diff --git a/src/colorspace.rs b/src/colorspace.rs
index 6b8b600..14706c2 100644
--- a/src/colorspace.rs
+++ b/src/colorspace.rs
@@ -1,4 +1,6 @@
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+use std::fmt::{self, Debug};
+
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct ColorSpace {
pub r_linear: bo... | 1 | 13 | 1 |
0d612fd3c23b8ec7f9976ea39c86fb803de40c9e | Ivan Smirnov | 2021-12-01T17:13:50 | Fix: check decode buffer end after the run opcode | diff --git a/src/decode.rs b/src/decode.rs
index ba02565..6823595 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -58,15 +58,12 @@ where
let mut run = 0_u16;
for px_out in pixels.iter_mut() {
- if unlikely(!buf.within_bounds()) {
- break;
- }
-
- // TODO: check for safety t... | 2 | 6 | 5 |
4067d83829961a252dda660328ec8887d7b3d04b | Ivan Smirnov | 2021-12-01T17:07:32 | Mark a few methods as inline in header mod | diff --git a/src/header.rs b/src/header.rs
index 6e464ca..0a65c6d 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -13,6 +13,7 @@ pub struct Header {
}
impl Default for Header {
+ #[inline]
fn default() -> Self {
Self {
magic: QOI_MAGIC,
@@ -24,6 +25,7 @@ impl Default for Header {
... | 1 | 6 | 0 |
7446a0f171aa2b9799728523b227b44bdb5c9438 | Ivan Smirnov | 2021-12-01T17:07:21 | Add Header::validate(), don't check in qoi_dec_hdr | diff --git a/src/decode.rs b/src/decode.rs
index 5cdcaad..ba02565 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,6 +1,6 @@
use std::mem;
-use crate::consts::{QOI_HEADER_SIZE, QOI_INDEX, QOI_MAGIC, QOI_PADDING};
+use crate::consts::{QOI_HEADER_SIZE, QOI_INDEX, QOI_PADDING};
use crate::error::{Error, Result};
... | 2 | 17 | 9 |
fc41914a484a8c4b085efd051b55204058223fbf | Ivan Smirnov | 2021-12-01T17:01:41 | Refactor decoder so it now uses qoi_decode_header | diff --git a/src/decode.rs b/src/decode.rs
index 28a355e..5cdcaad 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -31,28 +31,16 @@ impl ReadBuf {
}
}
-pub fn qoi_decode_impl<const N: usize>(data: &[u8]) -> Result<(Header, Vec<u8>)>
+pub fn qoi_decode_impl<const N: usize>(data: &[u8], n_pixels: usize) -> Resul... | 1 | 37 | 24 |
d9507911f7f3667909df5ed2969ff3b1625c736b | Ivan Smirnov | 2021-12-01T16:57:20 | Encoding: mark unlikely and inline | diff --git a/src/encode.rs b/src/encode.rs
index c49e5df..c02f62e 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -8,6 +8,7 @@ use crate::consts::{
use crate::error::{Error, Result};
use crate::header::Header;
use crate::pixel::{Pixel, SupportedChannels};
+use crate::utils::unlikely;
struct WriteBuf {
star... | 1 | 9 | 3 |
8f0a78a8c94a2bba9e8edf054ae194cf7b2d0c7f | Ivan Smirnov | 2021-12-01T16:04:04 | Add Header::n_pixels() | diff --git a/src/header.rs b/src/header.rs
index 9369b1b..c1cd526 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -57,4 +57,8 @@ impl Header {
out.colorspace = v[13].into();
out
}
+
+ pub const fn n_pixels(&self) -> usize {
+ (self.width as usize).saturating_mul(self.height as usize)
... | 1 | 4 | 0 |
f17d2b6201bad85a12d7b4b2c54c0d30165af8c5 | Ivan Smirnov | 2021-12-01T16:01:58 | Add decode::qoi_decode_header() | diff --git a/src/decode.rs b/src/decode.rs
index 669599b..28a355e 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -178,3 +178,19 @@ pub fn qoi_decode_to_vec(data: impl AsRef<[u8]>, channels: u8) -> Result<(Header
_ => Err(Error::InvalidChannels { channels }),
}
}
+
+#[inline]
+pub fn qoi_decode_header(... | 2 | 17 | 1 |
d7c8346e394f4d2c3500bc0291d5f840112b2430 | Ivan Smirnov | 2021-12-01T16:01:17 | Error::BadDecodingDataSize -> InputBufferTooSmall | diff --git a/src/decode.rs b/src/decode.rs
index cb3eec8..669599b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -36,7 +36,10 @@ where
Pixel<N>: SupportedChannels,
{
if data.len() < QOI_HEADER_SIZE + QOI_PADDING {
- return Err(Error::BadDecodingDataSize { size: data.len() });
+ return Err(Er... | 2 | 8 | 6 |
d35fa000faad362e53689c38910739c462f77d8a | Ivan Smirnov | 2021-12-01T00:05:46 | Add a fuzz target for the decoder | diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index 6a03228..8d5d839 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -23,3 +23,9 @@ name = "qoi_encode"
path = "fuzz_targets/qoi_encode.rs"
test = false
doc = false
+
+[[bin]]
+name = "qoi_decode"
+path = "fuzz_targets/qoi_decode.rs"
+test = false
+doc = false
d... | 2 | 43 | 0 |
cd6f8df1faeaa2e5ba4db43f4ad894dbafd4dc6a | Ivan Smirnov | 2021-12-01T00:05:04 | Remove unneeded mut | diff --git a/src/decode.rs b/src/decode.rs
index f7016a1..cb3eec8 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -56,7 +56,7 @@ where
// Safety: we have just allocated enough memory to set the length without problems
pixels.set_len(n_pixels);
}
- let mut encoded_data_size = data.len() - QOI... | 1 | 1 | 1 |
1ad85dc019ed3d9ab2d182eee346cf801f0f1525 | Ivan Smirnov | 2021-12-01T00:04:51 | Re-export qoi_encode_to_buf / encode_size_required | diff --git a/src/lib.rs b/src/lib.rs
index a1aba18..6221cd7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@ pub mod consts;
pub use crate::colorspace::ColorSpace;
pub use crate::decode::qoi_decode_to_vec;
-pub use crate::encode::qoi_encode_to_vec;
+pub use crate::encode::{encode_size_required, qoi_encode... | 1 | 1 | 1 |
36383a3ea55cc44cb38804312252f8026895ba01 | Ivan Smirnov | 2021-12-01T00:04:28 | Re-export consts module | diff --git a/src/lib.rs b/src/lib.rs
index f1f7c5b..a1aba18 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,4 @@
mod colorspace;
-mod consts;
mod decode;
mod encode;
mod error;
@@ -8,6 +7,7 @@ mod pixel;
mod utils;
pub mod canonical;
+pub mod consts;
pub use crate::colorspace::ColorSpace;
pub use crate:... | 1 | 1 | 1 |
dd2ed70e70407989b96ee0ac4edf05cf4aa9225f | Ivan Smirnov | 2021-11-30T14:31:33 | Decoder: check read buffer bounds for safety | diff --git a/src/decode.rs b/src/decode.rs
index b6bfa12..f7016a1 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -4,29 +4,30 @@ use crate::consts::{QOI_HEADER_SIZE, QOI_INDEX, QOI_MAGIC, QOI_PADDING};
use crate::error::{Error, Result};
use crate::header::Header;
use crate::pixel::{Pixel, SupportedChannels};
+use ... | 1 | 14 | 8 |
572194c0f29d45312ce1ff87a91320bbc59089b6 | Ivan Smirnov | 2021-11-30T14:30:55 | Decoder: mark redundant match arm as unreachable | diff --git a/src/decode.rs b/src/decode.rs
index 59e898d..b6bfa12 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -135,7 +135,12 @@ where
*px_out = px;
continue;
}
- _ => {}
+ _ => {
+ unsafe {
+ // the compiler sho... | 1 | 6 | 1 |
09976fb88990604935533dd36c3ab44d8b5f0864 | Ivan Smirnov | 2021-11-30T14:30:13 | Add stable likely/unlikely to utils module | diff --git a/src/lib.rs b/src/lib.rs
index 14d4dc3..f1f7c5b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,7 @@ mod encode;
mod error;
mod header;
mod pixel;
+mod utils;
pub mod canonical;
diff --git a/src/utils.rs b/src/utils.rs
new file mode 100644
index 0000000..224a456
--- /dev/null
+++ b/src/utils.rs
... | 2 | 24 | 0 |
1bb6ee118c8fdbc3a5eba437d568c79152c55af0 | Ivan Smirnov | 2021-11-30T02:46:04 | Add qoi_encode_to_buf() and encode_size_required() | diff --git a/src/canonical.rs b/src/canonical.rs
index 191b9c3..f0ca717 100644
--- a/src/canonical.rs
+++ b/src/canonical.rs
@@ -1,10 +1,24 @@
use crate::colorspace::ColorSpace;
-use crate::encode::qoi_encode_to_vec_impl;
+use crate::encode::{encode_to_buf_impl, encode_to_vec_impl};
use crate::error::Result;
pub f... | 3 | 77 | 26 |
439a28592048070ef8e78df3bafae3e67eca93dd | Ivan Smirnov | 2021-11-29T23:24:47 | Add `canonical` mod with reference i16-diff encode | diff --git a/Cargo.toml b/Cargo.toml
index a2c1aaa..e27c5f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,10 +19,6 @@ exclude = [
[dev-dependencies]
png = "^0.17.2"
-[features]
-reference-encoder = []
-default = []
-
[target.'cfg(bench)'.dev-dependencies]
# to activate, pass RUSTFLAGS="--cfg bench" until cargo ... | 4 | 27 | 15 |
b290afbc0238c117710de17a76aa310625aa8381 | Ivan Smirnov | 2021-11-29T22:39:06 | Re-export Header type at the crate root | diff --git a/src/lib.rs b/src/lib.rs
index 69f22d6..c43d49f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,6 +10,7 @@ pub use crate::colorspace::ColorSpace;
pub use crate::decode::qoi_decode_to_vec;
pub use crate::encode::qoi_encode_to_vec;
pub use crate::error::{Error, Result};
+pub use crate::header::Header;
#... | 1 | 1 | 0 |
62a659eb03c516ffe1d528ac6887a7d7a9558449 | Ivan Smirnov | 2021-11-29T22:38:09 | Change magic type to u32 (like in reference impl) | diff --git a/src/consts.rs b/src/consts.rs
index 6cb53c2..ee13ee0 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -22,4 +22,5 @@ pub const QOI_MASK_4: u8 = 0xf0; // (1111)0000
pub const QOI_HEADER_SIZE: usize = 14;
pub const QOI_PADDING: usize = 4;
-pub const QOI_MAGIC: [u8; 4] = [b'q', b'o', b'i', b'f'];
+pub co... | 3 | 6 | 5 |
f19c0ee64187e53b2bd28fd2ba63fd6f672f5a0d | Ivan Smirnov | 2021-11-29T22:33:27 | Remove unused imports from decode module | diff --git a/src/decode.rs b/src/decode.rs
index d70d930..59e898d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -1,9 +1,6 @@
use std::mem;
-use crate::consts::{
- QOI_COLOR, QOI_DIFF_16, QOI_DIFF_24, QOI_DIFF_8, QOI_HEADER_SIZE, QOI_INDEX, QOI_MAGIC,
- QOI_MASK_2, QOI_MASK_3, QOI_MASK_4, QOI_PADDING, QOI_R... | 1 | 1 | 4 |
fd71a24506b448f3b6b65d34d59715936511fa00 | Ivan Smirnov | 2021-11-29T22:32:04 | Mark tag masks in consts mod as allow(unused) | diff --git a/src/consts.rs b/src/consts.rs
index 05b0cd1..6cb53c2 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -12,8 +12,11 @@ pub const QOI_DIFF_24: u8 = 0xe0; // (1110)0000
pub const QOI_COLOR: u8 = 0xf0; // (1111)0000
// tag masks
+#[allow(unused)]
pub const QOI_MASK_2: u8 = 0xc0; // (11)000000
+#[allow(un... | 1 | 3 | 0 |
236f55ed3c0717233065237952ccd678f14c61b3 | Ivan Smirnov | 2021-11-29T22:30:53 | Change Header::default() impl so it's a valid one | diff --git a/src/header.rs b/src/header.rs
index 1ef95df..8bc6a71 100644
--- a/src/header.rs
+++ b/src/header.rs
@@ -14,8 +14,8 @@ impl Default for Header {
fn default() -> Self {
Self {
magic: QOI_MAGIC,
- width: 0,
- height: 0,
+ width: 1,
+ heigh... | 1 | 2 | 2 |
7d0b0a5b62ed7fdfa8b349878279264880745084 | Ivan Smirnov | 2021-11-29T22:30:29 | Change colorspace in Header to ColorSpace type | diff --git a/src/encode.rs b/src/encode.rs
index 1ca5df6..5e8487c 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -151,7 +151,7 @@ where
header.width = width;
header.height = height;
header.channels = N as u8;
- header.colorspace = colorspace.into();
+ header.colorspace = colorspace;
buf.wri... | 2 | 12 | 5 |
83e75b1b6534d03211ebe9e6664124894027e10c | Ivan Smirnov | 2021-11-29T22:26:20 | Add colorspace support to qoi_encode_to_vec() | diff --git a/src/encode.rs b/src/encode.rs
index 3d68ebe..1ca5df6 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -1,5 +1,6 @@
use std::slice;
+use crate::colorspace::ColorSpace;
use crate::consts::{
QOI_COLOR, QOI_DIFF_16, QOI_DIFF_24, QOI_DIFF_8, QOI_HEADER_SIZE, QOI_INDEX, QOI_PADDING,
QOI_RUN_16, QO... | 2 | 10 | 7 |
9ef519164b27de5e14d5c5d135dc565034b16dbb | Ivan Smirnov | 2021-11-29T22:23:39 | Add ColorSpace type | diff --git a/src/colorspace.rs b/src/colorspace.rs
new file mode 100644
index 0000000..6b8b600
--- /dev/null
+++ b/src/colorspace.rs
@@ -0,0 +1,58 @@
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct ColorSpace {
+ pub r_linear: bool,
+ pub g_linear: bool,
+ pub b_linear: bool,
+ pub a_linear:... | 2 | 60 | 0 |
3dc0d6adabed190d9910a5eda306d810c992e246 | Ivan Smirnov | 2021-11-29T13:58:11 | Add mask comments to consts module | diff --git a/src/consts.rs b/src/consts.rs
index d0a7e8f..05b0cd1 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -1,14 +1,20 @@
-pub const QOI_INDEX: u8 = 0x00;
-pub const QOI_RUN_8: u8 = 0x40;
-pub const QOI_RUN_16: u8 = 0x60;
-pub const QOI_DIFF_8: u8 = 0x80;
-pub const QOI_DIFF_16: u8 = 0xc0;
-pub const QOI_DIFF_... | 1 | 16 | 10 |
899270e42e34561edc8d866531de8b439cbf2364 | Ivan Smirnov | 2021-11-29T11:30:09 | Rework all branching in the decoder | diff --git a/src/decode.rs b/src/decode.rs
index 75951f7..d70d930 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -71,70 +71,79 @@ where
// TODO: check for safety that ReadBuf is not over yet
if run != 0 {
run -= 1;
- } else {
- let b1 = buf.read();
- match ... | 1 | 69 | 60 |
cbae67b07d910d97ac689a00693cbf466dc2566a | Ivan Smirnov | 2021-11-29T04:21:50 | No bound checks when indexing during decoding | diff --git a/src/decode.rs b/src/decode.rs
index f4250bd..75951f7 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -75,7 +75,10 @@ where
let b1 = buf.read();
match b1 & QOI_MASK_2 {
QOI_INDEX => {
- px = index[usize::from(b1 ^ QOI_INDEX)];
+ ... | 1 | 4 | 1 |
afe6dd1ab39472a2b19482f3b9cfff589b0dbc73 | Ivan Smirnov | 2021-11-28T16:54:16 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index f0c81b6..a2c1aaa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,18 +1,23 @@
[package]
name = "qoi-fast"
-version = "0.1.0"
+version = "0.0.1"
+description = "Fast encoder/decoder for QOI (Quite Okay Image) format"
authors = ["Ivan Smirnov <rust@ivan.smirnov.ie>"]
edition =... | 1 | 12 | 7 |
abeae765dd546dfff60b278f0757dcc71beb8ab1 | Daniel Sonbolian | 2026-02-28T13:19:10 | Add rustdoc attribute to ansi module | diff --git a/src/lib.rs b/src/lib.rs
index eb1ae0b..60bd823 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,6 +39,7 @@ use arrayvec::ArrayVec;
mod params;
#[cfg(feature = "ansi")]
+#[cfg_attr(docsrs, doc(cfg(feature = "ansi")))]
pub mod ansi;
pub use params::{Params, ParamsIter}; | 1 | 1 | 0 |
56c708f78b294065a49da06776141cc10b8457e3 | Georg Semmler | 2025-10-01T06:58:23 | Exclude test data from being published to crates.io
These data are "binary" so somewhat hard to review. Also they increase
the package size by quite a bit. This changes reduces the package size
from 17 files, 316.5KiB (56.8KiB compressed) to 10 files, 155.0KiB
(34.1KiB compressed) which results in a ~34GB/month traffi... | diff --git a/Cargo.toml b/Cargo.toml
index e645212..5d482f4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ version = "0.15.0"
name = "vte"
edition = "2021"
rust-version = "1.62.1"
+include = ["README.md", "LICENSE-APACHE", "LICENSE-MIT", "Cargo.toml", "src/**/*.rs"]
[features]
ansi = ["log", "cursor-... | 1 | 1 | 0 |
c94b6e3060a481ae0ddfb90607323109ec2b62f4 | Georg Semmler | 2025-10-01T13:22:22 | Fix nightly feature usage | diff --git a/src/lib.rs b/src/lib.rs
index 8f08b6b..eb1ae0b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,7 +28,7 @@
//! [Paul Williams' ANSI parser state machine]: https://vt100.net/emu/dec_ansi_parser
#![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)]
#![cfg_attr(not(feature = "std"), no_std)]
-#!... | 1 | 1 | 1 |
85894d42cb8f9684154555bce0e6b7638e753c8b | Rafal | 2025-01-28T18:12:03 | Disable default-features for memchr
Fixes an issue with std not being disabled when building
vte without std feature. | diff --git a/Cargo.toml b/Cargo.toml
index d5611cc..888ec09 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,5 +24,5 @@ arrayvec = { version = "0.7.2", default-features = false }
bitflags = { version = "2.3.3", default-features = false, optional = true }
cursor-icon = { version = "1.0.0", default-features = false, opt... | 1 | 1 | 1 |
c18ef2206af630f729835da237381628650005aa | Kirill Chibisov | 2025-01-12T08:59:01 | Fix crash when valid char was split
If the valid character was split across reads of partial utf8 and
got terminated by invalid byte, we should print it and advance, instead
of trying to discard it entirely. | diff --git a/src/lib.rs b/src/lib.rs
index 3c2f863..1f229a3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -460,6 +460,22 @@ impl<const OSC_RAW_BUF_SIZE: usize> Parser<OSC_RAW_BUF_SIZE> {
c.len_utf8() - old_bytes
},
Err(err) => {
+ let valid_bytes = err.valid_up_to... | 1 | 32 | 20 |
ff21c30b7a376e93b9a4df4812a05567f27e73fa | Christian Duerr | 2025-01-09T07:21:50 | Bump vte_generate_state_changes to 0.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index f88ba09..629057d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,4 +29,4 @@ cursor-icon = { version = "1.0.0", default-features = false, optional = true }
log = { version = "0.4.17", optional = true }
memchr = "2.7.4"
serde = { version = "1.0.160", features = ["derive"], op... | 2 | 2 | 2 |
40af63902e0af313722dfdc19a6d10a1d2ba29f4 | Kirill Chibisov | 2024-12-28T21:18:14 | Improve attrs_from_sgr_parameters performance
Instead of collecting all the data into the vector just dispatch it
right away avoiding allocations. | diff --git a/src/ansi.rs b/src/ansi.rs
index 59b17e6..8cac26d 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -1620,12 +1620,7 @@ where
if params.is_empty() {
handler.terminal_attribute(Attr::Reset);
} else {
- for attr in attrs_from_sgr_parameters... | 3 | 10 | 15 |
ebc4a4d7259678a8626f5c269ea9348dfc3e79b2 | Christian Duerr | 2024-06-08T07:07:09 | Bump crate versions missing license files
This patch bumps utf8parse/vte_generate_state_changes versions to
release the change which included the license files into the crates.io
package.
Closes #113. | diff --git a/utf8parse/Cargo.toml b/utf8parse/Cargo.toml
index 5af8fb5..71ea44b 100644
--- a/utf8parse/Cargo.toml
+++ b/utf8parse/Cargo.toml
@@ -6,7 +6,7 @@ repository = "https://github.com/alacritty/vte"
keywords = ["utf8", "parse", "table"]
categories = ["parsing", "no-std"]
license = "Apache-2.0 OR MIT"
-version ... | 2 | 2 | 2 |
a971e86f8545cd4fe9ed4fd28e31758e9460c6ed | Mohammad AlSaleh | 2024-04-01T12:38:46 | Add SCP control support
Modern usage of this control function comes from the BiDi draft
proposal:
https://terminal-wg.pages.freedesktop.org/bidi/recommendation/escape-sequences.html
The draft slightly extends the definition in ECMA-48.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com> | diff --git a/src/ansi.rs b/src/ansi.rs
index e5011e9..59b17e6 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -677,6 +677,9 @@ pub trait Handler {
///
/// The output is of form `CSI > 4 ; mode m`.
fn report_modify_other_keys(&mut self) {}
+
+ // Set SCP control.
+ fn set_scp(&mut self, _char_path: Sc... | 1 | 53 | 0 |
645b23e0904a2526171a96789c9084bb848ed2b7 | Kirill Chibisov | 2023-11-07T19:06:08 | Bump version to 0.12.1 | diff --git a/Cargo.toml b/Cargo.toml
index bc639a7..98c30e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ categories = ["parsing", "no-std"]
exclude = ["/.travis.yml"]
readme = "README.md"
license = "Apache-2.0 OR MIT"
-version = "0.12.0"
+version = "0.12.1"
name = "vte"
edition = "2021"
rust-version =... | 1 | 1 | 1 |
1e66833034d11c2867ccf0a92e75e29dbb64abc8 | Ethan Pailes | 2023-11-04T07:38:20 | Ensure proper enum representation | diff --git a/src/definitions.rs b/src/definitions.rs
index a1f264d..218c1eb 100644
--- a/src/definitions.rs
+++ b/src/definitions.rs
@@ -1,6 +1,7 @@
use core::mem;
#[allow(dead_code)]
+#[repr(u8)]
#[derive(Debug, Default, Copy, Clone)]
pub enum State {
Anywhere = 0,
@@ -23,6 +24,7 @@ pub enum State {
}
#... | 1 | 2 | 0 |
76b565ada7f9511b0bd718d25bfd2ce26ba78578 | Christian Duerr | 2023-09-19T16:04:55 | Switch sync escape from DCS to CSI
See alacritty/alacritty#6845. | diff --git a/src/ansi.rs b/src/ansi.rs
index f71b773..918e35b 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -39,14 +39,14 @@ const SYNC_UPDATE_TIMEOUT: Duration = Duration::from_millis(150);
/// Maximum number of bytes read in one synchronized update (2MiB).
const SYNC_BUFFER_SIZE: usize = 0x20_0000;
-/// Number of... | 1 | 36 | 80 |
94e74f3a64f42d5dad4e3d42dbe8c23291038214 | Jonathan 'theJPster' Pallant | 2023-07-16T21:26:55 | Add const generic for no-std OSC buffer limit
The OSC buffer limit was set to 1024 bytes by default for no-std
targets. Especially when operating in a restricted environment where OSC
escapes are irrelevant, this consumes a lot of unnecessary memory.
This patch adds a const generic that allows controlling the tar... | diff --git a/src/lib.rs b/src/lib.rs
index a1b6fc3..0ff6a91 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,7 +52,6 @@ use definitions::{unpack, Action, State};
const MAX_INTERMEDIATES: usize = 2;
const MAX_OSC_PARAMS: usize = 16;
-#[cfg(any(feature = "no_std", test))]
const MAX_OSC_RAW: usize = 1024;
struct Vt... | 1 | 112 | 4 |
d5036ab2c20dfb0853cb1c7b9bc41a58c24c5bf2 | Christian Duerr | 2023-05-15T03:11:33 | Remove unused floats feature from Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 4b3c0b5..d330e64 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,6 @@ serde = { version = "1.0.160", features = ["derive"], optional = true }
ansi = ["log"]
serde = ["dep:serde"]
default = ["no_std"]
-floats = []
no_std = ["arrayvec"]
nightly = ["utf8parse/nightly"] | 1 | 0 | 1 |
aba7d319b621609ab4244d1fe25187a319b04664 | Christian Duerr | 2023-03-09T14:46:41 | Bump utf8parse to 0.2.1 | diff --git a/utf8parse/Cargo.toml b/utf8parse/Cargo.toml
index f270975..5af8fb5 100644
--- a/utf8parse/Cargo.toml
+++ b/utf8parse/Cargo.toml
@@ -6,7 +6,7 @@ repository = "https://github.com/alacritty/vte"
keywords = ["utf8", "parse", "table"]
categories = ["parsing", "no-std"]
license = "Apache-2.0 OR MIT"
-version ... | 1 | 1 | 1 |
8b415320df73b54808ae06d0bf22adcb7dc706ee | Ed Page | 2023-03-08T16:53:10 | Add trivial derives to `utf8parser::Parser`
Much like `std::ops::Range`, we likely don't want this to be `Copy` as
that makes it too easy to get mixed up on what state you are using but
`Clone` should be explicit enough to be safe.
`PartialOrd` / `Ord` were left off because there isn't really a
user-facing order... | diff --git a/utf8parse/src/lib.rs b/utf8parse/src/lib.rs
index 947a0aa..093de81 100644
--- a/utf8parse/src/lib.rs
+++ b/utf8parse/src/lib.rs
@@ -25,7 +25,7 @@ pub trait Receiver {
/// A parser for Utf8 Characters
///
/// Repeatedly call `advance` with bytes to emit Utf8 characters
-#[derive(Default)]
+#[derive(Clone... | 2 | 2 | 2 |
45670c47cebd7af050def2f80a307bdeec7caba3 | Nikhil Benesch | 2022-07-18T03:18:30 | Bump arrayvec to 0.7.2 | diff --git a/Cargo.toml b/Cargo.toml
index 2b1e184..2b0a1fb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ rust-version = "1.56.0"
[dependencies]
vte_generate_state_changes = { version = "0.1.0", path = "vte_generate_state_changes" }
-arrayvec = { version = "0.5.1", default-features = false, optional = ... | 2 | 2 | 2 |
1f1a92938e0d8f5b54c89a76c34c628727c9c0bf | Christian Duerr | 2021-02-21T19:58:20 | Refactor test code
This changes the test code to use only a single dispatcher instead of
having a dispatcher for every single type of escape sequence.
This makes it trivial to test transitions between the two separate
escape sequence types. | diff --git a/src/lib.rs b/src/lib.rs
index 9d7931f..157392a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -431,178 +431,224 @@ mod tests {
];
#[derive(Default)]
- struct OscDispatcher {
- dispatched_osc: bool,
- bell_terminated: bool,
- params: Vec<Vec<u8>>,
+ struct Dispatcher {
+ ... | 1 | 263 | 197 |
59bb331d5e702a4cb608636d4b8b534a3903f7bb | Christian Duerr | 2021-02-21T19:57:02 | Fix intermediate reset when going from DCS to ESC
This resolves a bug when transitioning between DCS and ESC sequences,
which would cause the intermediates of the ESC dispatch to contain data
from the DCS sequence. | diff --git a/src/lib.rs b/src/lib.rs
index b6d2658..9d7931f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -165,28 +165,26 @@ impl Parser {
match self.state {
State::DcsPassthrough => {
self.perform_action(performer, Action::Unhook, byte);
- ... | 1 | 15 | 17 |
4f44023dab081f7da74fee14bc53b10ee8f96a1e | Christian Duerr | 2020-08-05T00:36:41 | Add CSI subparameter support
This adds support for CSI subparameters like `\x1b[38:2:255:0:255m`,
which allows the combination of truecolor SGR commands together with
other SGR parameters like bold text, without any ambiguity.
This implements subparameters by storing them in a list together with
all other parame... | diff --git a/examples/parselog.rs b/examples/parselog.rs
index c310182..dfd0aee 100644
--- a/examples/parselog.rs
+++ b/examples/parselog.rs
@@ -1,12 +1,12 @@
//! Parse input from stdin and log actions on stdout
use std::io::{self, Read};
-use vte;
+use vte::{Params, Parser, Perform};
/// A type implementing Per... | 4 | 225 | 69 |
0310be12d3007e32be614c5df94653d29fcc1a8b | Christian Duerr | 2020-07-27T22:37:20 | Improve parser performance | diff --git a/src/definitions.rs b/src/definitions.rs
index 5d01623..fe7952d 100644
--- a/src/definitions.rs
+++ b/src/definitions.rs
@@ -48,27 +48,6 @@ pub enum Action {
BeginUtf8 = 15,
}
-impl State {
- #[inline]
- pub fn entry_action(self) -> Action {
- match self {
- State::CsiEntry |... | 2 | 43 | 31 |
408b1584646338e9e1e8e4fd7e2d127aef8ebd0a | Dan Gohman | 2020-06-15T17:30:44 | Rename example variable to match trait | diff --git a/examples/parselog.rs b/examples/parselog.rs
index 4878f34..c310182 100644
--- a/examples/parselog.rs
+++ b/examples/parselog.rs
@@ -54,7 +54,7 @@ fn main() {
let mut handle = input.lock();
let mut statemachine = vte::Parser::new();
- let mut parser = Log;
+ let mut performer = Log;
... | 1 | 2 | 2 |
582731cf9d3bdb4ba453e189fb114583f0b8f0f0 | Dan Gohman | 2020-06-15T16:04:32 | Remove redundant `.to_string()` | diff --git a/utf8parse/tests/utf-8-demo.rs b/utf8parse/tests/utf-8-demo.rs
index e60ce22..51df492 100644
--- a/utf8parse/tests/utf-8-demo.rs
+++ b/utf8parse/tests/utf-8-demo.rs
@@ -25,7 +25,7 @@ fn utf8parse_test() {
}
// standard library implementation
- let expected = String::from_utf8_lossy(UTF8_DEMO)... | 1 | 1 | 1 |
e61e9652241a8e85ffdbb6dc6e48375e30ea9d40 | Christian Duerr | 2020-01-29T15:57:04 | Pass terminator to osc dispatcher
Even though the ST terminator is the only officially supported
terminator, some applications still rely on BEL to work properly. Both
have been supported historically, however there was no way for the
terminal to tell which terminator was used.
Since OSC escapes frequently offer... | diff --git a/examples/parselog.rs b/examples/parselog.rs
index 83ba2b5..331a003 100644
--- a/examples/parselog.rs
+++ b/examples/parselog.rs
@@ -30,8 +30,8 @@ impl vte::Perform for Log {
println!("[unhook]");
}
- fn osc_dispatch(&mut self, params: &[&[u8]]) {
- println!("[osc_dispatch] params=... | 7 | 83 | 57 |
1712405055f5d97f6dc7b6156885c940982ec20d | Christian Duerr | 2020-01-12T15:57:00 | Bump vte_generate_state_changes version to 0.1.1 | diff --git a/vte_generate_state_changes/Cargo.toml b/vte_generate_state_changes/Cargo.toml
index 1a4bb17..9bdfb64 100644
--- a/vte_generate_state_changes/Cargo.toml
+++ b/vte_generate_state_changes/Cargo.toml
@@ -4,7 +4,7 @@ description = "Proc macro for generating VTE state changes"
repository = "https://github.com/j... | 1 | 1 | 1 |
b844c38d5d4b8eff5db07b1d4d5a14d626411698 | Vojtěch Štěpančík | 2019-12-28T21:49:48 | Discard CSI sequences with too many parameters
Fixes #24. | diff --git a/src/lib.rs b/src/lib.rs
index 50eddb8..e0f4331 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -272,8 +272,12 @@ impl Parser {
},
Action::Unhook => performer.unhook(),
Action::CsiDispatch => {
- self.params[self.num_params] = self.param;
- se... | 1 | 53 | 18 |
92f7b13d96f6a708c4b5a1a5d7cfa3bb59fd7cbc | Christian Duerr | 2019-12-10T20:04:10 | Rename generate_state_changes proc macro
This renames the generate_state_changes proc macro to include the `vte_`
prefix, since it's not useful to anyone other than our `vte` crate. | diff --git a/Cargo.toml b/Cargo.toml
index 1425fb6..f67878c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,9 +13,9 @@ name = "vte"
edition = "2018"
[dependencies]
-generate_state_changes = { version = "0.1.0", path = "generate_state_changes" }
+vte_generate_state_changes = { version = "0.1.0", path = "vte_generate... | 4 | 9 | 6 |
5e5d7de9c8054f837a2d34d0d9a8c3791ab15bf8 | Christian Duerr | 2019-12-10T19:58:39 | Bump utf8parse to 0.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 73fd4b7..0eef1a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ edition = "2018"
[dependencies]
generate_state_changes = { version = "0.1.0", path = "generate_state_changes" }
arrayvec = { version = "0.5.1", default-features = false, optional = true }
-utf8parse... | 2 | 2 | 2 |
82fc09895ec76cd07dda39f127ca5e5c21f8abf4 | Jesse Luehrs | 2019-11-03T17:41:01 | fix dcs handling, and add a test for it | diff --git a/examples/parselog.rs b/examples/parselog.rs
index a2c3b2f..acd56dc 100644
--- a/examples/parselog.rs
+++ b/examples/parselog.rs
@@ -15,9 +15,9 @@ impl vte::Perform for Log {
println!("[execute] {:02x}", byte);
}
- fn hook(&mut self, params: &[i64], intermediates: &[u8], ignore: bool) {
-... | 2 | 59 | 8 |
1f9db05de259c4fb5862d449f1428d6183eadae2 | VojtechStep | 2019-08-06T19:52:10 | Address stylistic issues | diff --git a/src/lib.rs b/src/lib.rs
index 71ea79b..ba28e7c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -292,7 +292,6 @@ impl Parser {
},
Action::Unhook => performer.unhook(),
Action::CsiDispatch => {
-
self.params[self.num_params] = self.param;
s... | 1 | 1 | 2 |
bcad429a53cade02f7ec1ebf26c902e55a75acdc | VojtechStep | 2019-08-06T19:38:42 | Simplify csi dispatching | diff --git a/src/lib.rs b/src/lib.rs
index 0813a4d..71ea79b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -89,7 +89,6 @@ pub struct Parser {
intermediate_idx: usize,
params: [i64; MAX_PARAMS],
param: i64,
- collecting_param: bool,
num_params: usize,
osc_raw: [u8; MAX_OSC_RAW],
osc_params:... | 1 | 2 | 17 |
e2151a4ff6039aecda1eb20e38e7a8b0bb066465 | VojtechStep | 2019-08-06T10:16:08 | Add an implicit zero after trailing semicolon | diff --git a/src/lib.rs b/src/lib.rs
index 7fa4c22..0813a4d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -298,7 +298,16 @@ impl Parser {
let idx = self.num_params;
self.params[idx] = self.param;
self.num_params += 1;
+ } else {
+ ... | 1 | 22 | 0 |
f5113133d934aa5e0cf9d48be598efd118001f83 | Felix Rabe | 2019-04-24T11:54:00 | Use correct md code fence | diff --git a/src/lib.rs b/src/lib.rs
index 7272230..7fa4c22 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,7 +13,7 @@
//! there simply logs all the actions [`Perform`] does. One quick thing to see it in action is to
//! pipe `vim` into it
//!
-//! ```ignore
+//! ```sh
//! cargo build --release --example parselog
... | 1 | 1 | 1 |
b684bb8bd80637da85693daff48f3a84bb073a0c | Christian Duerr | 2018-08-11T14:52:13 | Fix off-by-one error when parsing CSI escapes
The CSI escape sequences are limited to 16 parameters using the
`MAX_PARAMS` constant.
To make sure no more params are parsed, the CSI parser stops when the
parameter index reaches `MAX_PARAMS`, however this means that it stops
at index 16, which means that the number of ... | diff --git a/src/lib.rs b/src/lib.rs
index f2a38b5..7272230 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -332,7 +332,7 @@ impl Parser {
// Completed a param
let idx = self.num_params;
- if idx == MAX_PARAMS {
+ if idx == MAX_PARAMS - 1 {
... | 1 | 3 | 2 |
fe116505000826c42f6f0ac2e598d7fe19217588 | Peter Holloway | 2018-03-09T23:48:24 | Fix typo in parselog example
osc_dispatch calls were being logged as csi_dispatch | diff --git a/examples/parselog.rs b/examples/parselog.rs
index 86751c9..a2c3b2f 100644
--- a/examples/parselog.rs
+++ b/examples/parselog.rs
@@ -29,7 +29,7 @@ impl vte::Perform for Log {
}
fn osc_dispatch(&mut self, params: &[&[u8]]) {
- println!("[csi_dispatch] params={:?}", params);
+ printl... | 1 | 1 | 1 |
76ad2fa73d360a959bf4d7f0505903576514e3ec | Nathan Lilienthal | 2018-01-12T18:55:32 | Remove leading './' from utf8parse's path.
This is a purely cosmetic change at the moment. | diff --git a/Cargo.toml b/Cargo.toml
index 27a028f..9374466 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ documentation = "https://docs.rs/vte/"
readme = "README.md"
[dependencies.utf8parse]
-path = "./utf8parse"
+path = "utf8parse"
version = "0.1"
[workspace] | 1 | 1 | 1 |
9603a95a8d16b62a6bd378cec5e53a868a0ac270 | Nathan Lilienthal | 2018-01-12T18:45:54 | Make this a workspace.
Allows testing everything with `cargo test --all`. | diff --git a/Cargo.toml b/Cargo.toml
index fd51683..27a028f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,3 +12,6 @@ readme = "README.md"
[dependencies.utf8parse]
path = "./utf8parse"
version = "0.1"
+
+[workspace]
+ | 1 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.