chore(i18n): finish translating code comments and scripts to English
CI / Format and clippy (push) Successful in 1m57s
CI / Dependency audit (push) Successful in 13s
CI / Check desktop app (Linux) (push) Successful in 3m54s
CI / Tests (Linux) (push) Failing after 7m25s
Release / Create release (push) Successful in 6s
Release / CLI (linux-aarch64) (push) Successful in 1m48s
Release / CLI (linux-x86_64) (push) Successful in 2m39s
Release / Desktop app (linux-aarch64) (push) Successful in 10m9s
Release / Desktop app (linux-x86_64) (push) Successful in 12m20s
Release / Desktop app (windows) (push) Successful in 7m32s
Release / Build latest.json (push) Successful in 5s

Completes the English-only standardization for code, comments, scripts
and CI templates (UI/CLI-facing strings stay bilingual pt-BR/en,
untouched). Covers the remaining crates/, apps/gui/ui/ and
apps/gui/src-tauri/ comments, .gitea/ workflow and template comments,
.githooks/ hooks, and the scripts/ source comments for the files
already renamed in a prior commit (check.sh, generate-logo.py,
install-hooks.sh).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAyr8d7HuAdUGB6aA5xmDD
This commit is contained in:
Lucas RayanandClaude Sonnet 5 committed 2026-10-30 20:43:02 -03:00
1 parent da212e6926
commit 6328220c60
129 files changed
+1961 -1834

No files matched your search

+23 -23
View File
@@ -1,24 +1,24 @@
//! Recomposição de arquivos fragmentados no carving.
//! Fragmented file reassembly during carving.
//!
//! Para JPEG: valida os bytes contíguos com o decodificador de entropia; se a imagem quebra,
//! procura entre os clusters "com cara de JPEG" próximos a continuação cujo DC de luminância
//! emenda sem salto, até três fragmentos. É o que dá para fazer sem tabela de alocação, e só
//! vale quando o sistema de arquivos não deixou metadados para o arquivo.
//! For JPEG: validates contiguous bytes with the entropy decoder; if the stream breaks,
//! searches nearby JPEG-like entropy clusters for a continuation whose luminance DC
//! splices smoothly across up to three fragments. Best-effort without an allocation table,
//! used when filesystem metadata is no longer available.
use crate::jpegscan::{self, Header, State, Stop};
use crate::source::{read_vec, Source};
use crate::types::Extent;
const MAX_FILE: usize = 48 << 20;
/// Janela de busca da continuação, em bytes, depois e antes do primeiro fragmento.
/// Search window in bytes (after and before the first fragment) for candidate continuations.
const WINDOW_AFTER: u64 = 512 << 20;
const WINDOW_BEFORE: u64 = 64 << 20;
const PROBE: usize = 8192;
pub const CLUSTER: u64 = 4096;
const MAX_PROBES: usize = 20_000;
/// Marca os clusters (de 4 KiB, alinhados ao início da origem) que parecem dados entropy-coded
/// de JPEG: sem marcadores no meio e com bytes bem distribuídos.
/// Bitmap of 4 KiB source-aligned clusters that look like JPEG entropy-coded data
/// (no embedded unescaped markers and high byte entropy).
#[derive(Default, Clone)]
pub struct ClusterIndex {
bits: Vec<u64>,
@@ -43,7 +43,7 @@ impl ClusterIndex {
.map(|w| w >> (c % 64) & 1 == 1)
.unwrap_or(false)
}
/// Examina um trecho lido e marca os clusters candidatos.
/// Scans a read buffer and marks candidate JPEG entropy clusters.
pub fn scan_chunk(&mut self, abs: u64, buf: &[u8]) {
let first = abs.div_ceil(CLUSTER) * CLUSTER;
let mut o = first;
@@ -90,7 +90,7 @@ pub fn jpeg_like(c: &[u8]) -> bool {
pub struct Pool<'a> {
pub index: &'a ClusterIndex,
/// Extents já atribuídos a outros arquivos.
/// Extents already claimed by other recovered files.
pub used: &'a [Extent],
}
@@ -105,17 +105,17 @@ impl Pool<'_> {
#[derive(Debug)]
pub enum Analysis {
/// Contíguo e consistente; `len` inclui o EOI.
/// Contiguous and valid; `len` includes the EOI marker.
Intact { len: u64 },
/// Remontado a partir de fragmentos.
/// Reassembled from multiple non-contiguous fragments.
Rebuilt { extents: Vec<Extent>, size: u64 },
/// Só o início é confiável.
/// Only the leading prefix is reliable.
Broken { good_len: u64 },
/// Formato que não sabemos validar (progressivo etc.).
/// JPEG variant we do not entropy-validate (progressive, arithmetic, etc.).
Unsupported,
}
/// Procura FF D9 logo depois do último MCU (até 64 bytes de preenchimento).
/// Looks for FF D9 immediately after the final MCU (allowing up to 64 padding bytes).
fn eoi_after(data: &[u8], pos: usize) -> Option<usize> {
let end = (pos + 64).min(data.len().saturating_sub(1));
(pos.saturating_sub(2)..end)
@@ -123,7 +123,7 @@ fn eoi_after(data: &[u8], pos: usize) -> Option<usize> {
.map(|i| i + 2)
}
/// Valida o JPEG que começa em `off` e, se estiver quebrado, tenta recompô-lo.
/// Validates the JPEG starting at `off` and attempts fragment reassembly if truncated/broken.
pub fn analyze_jpeg(
src: &dyn Source,
off: u64,
@@ -168,8 +168,8 @@ pub fn analyze_jpeg(
let mut pieces: Vec<(u64, usize)> = vec![];
let mut joined = buf;
let mut cur_base = off; // início absoluto do fragmento atual
let mut frag_start = 0usize; // posição em `joined` onde o fragmento atual começa
let mut cur_base = off; // absolute start offset of the current fragment
let mut frag_start = 0usize; // byte offset in `joined` where the current fragment starts
let mut snaps = d.snaps;
let mut suspect = stop_pos;
@@ -223,7 +223,7 @@ pub fn analyze_jpeg(
}
ranked.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());
ranked.truncate(120);
// Etapa 2: a continuação certa fecha a imagem exatamente no último MCU.
// Stage 2: the true continuation finishes the image right at the final MCU.
let mut longest: Option<(usize, u64, f64)> = None;
for (sc, q) in ranked {
let avail = (src.size() - q) as usize;
@@ -269,7 +269,7 @@ pub fn analyze_jpeg(
return finish(pieces);
}
}
// Quebrou de novo: onde?
// Broke again: find the new break point.
let mut sp = match d2.stop {
Stop::Marker(_, p) | Stop::Error(p) => p,
_ => joined.len(),
@@ -314,8 +314,8 @@ fn finish(pieces: Vec<(u64, usize)>) -> Analysis {
Analysis::Rebuilt { extents, size }
}
/// Pontuação (menor é melhor) de `q` como continuação de `prefix`: diferença média de pixels
/// nas bordas entre os MCUs novos e seus vizinhos. Natural: poucos níveis de cinza; lixo: dezenas.
/// Score (lower is better) for `q` as a continuation of `prefix`: mean pixel difference
/// along MCU borders between new blocks and their neighbors (smooth in natural images, high on noise).
fn probe_candidate(
src: &dyn Source,
h: &Header,
@@ -385,7 +385,7 @@ fn probe_candidate(
if n < 40 {
return None;
}
// Bytes por MCU depois da emenda, comparados com os do trecho anterior.
// Bytes per MCU after the splice compared against the preceding prefix.
let after = d.dc.len() as f64 - (seam.saturating_sub(snap.mcu)) as f64;
let used = d.state.pos.saturating_sub(prefix.len()) as f64;
let ratio = if after > 4.0 && used > 0.0 {