Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 63 additions & 29 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ use uucore::error::{FromIo, strip_errno};
use uucore::error::{UError, UResult, USimpleError, UUsageError};
use uucore::extendedbigdecimal::ExtendedBigDecimal;
use uucore::format_usage;
use uucore::i18n::decimal::locale_decimal_separator;
use uucore::line_ending::LineEnding;
use uucore::parser::num_parser::{ExtendedParser, ExtendedParserError};
use uucore::parser::parse_size::{ParseSizeError, Parser};
Expand Down Expand Up @@ -111,8 +112,6 @@ mod options {
pub const FILES: &str = "files";
}

const DECIMAL_PT: u8 = b'.';

const NEGATIVE: &u8 = &b'-';
const POSITIVE: &u8 = &b'+';

Expand Down Expand Up @@ -2048,7 +2047,10 @@ fn get_leading_gen(inp: &[u8]) -> Range<usize> {
continue;
}

if c == DECIMAL_PT && !had_decimal_pt && !had_e_notation {
if locale_decimal_separator().as_bytes().first() == Some(&c)
&& !had_decimal_pt
&& !had_e_notation
{
had_decimal_pt = true;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/uucore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ i18n-decimal = ["i18n-common", "icu_decimal", "icu_provider"]
mode = ["libc"]
perms = ["entries", "libc", "walkdir"]
buf-copy = []
parser-num = ["extendedbigdecimal", "num-traits"]
parser-num = ["extendedbigdecimal", "num-traits", "i18n-decimal"]
parser-size = ["parser-num", "procfs"]
parser-glob = ["glob"]
parser = ["parser-num", "parser-size", "parser-glob"]
Expand Down
5 changes: 3 additions & 2 deletions src/uucore/src/lib/features/parser/num_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use num_traits::ToPrimitive;
use num_traits::Zero;

use crate::extendedbigdecimal::ExtendedBigDecimal;
use crate::i18n::decimal::locale_decimal_separator;

/// Base for number parsing
#[derive(Clone, Copy, PartialEq)]
Expand Down Expand Up @@ -291,9 +292,9 @@ fn parse_digits(base: Base, str: &str, fractional: bool) -> (Option<BigUint>, i6
let (digits, rest) = base.parse_digits(str);

// If allowed, parse the fractional part of the number if there can be one and the
// input contains a '.' decimal separator.
// input contains the locale-specific decimal separator.
if fractional {
if let Some(rest) = rest.strip_prefix('.') {
if let Some(rest) = rest.strip_prefix(locale_decimal_separator()) {
return base.parse_digits_count(rest, digits);
}
}
Expand Down
Loading