Skip to content

Commit

Permalink
Merge pull request #167 from LechevSpace/chore/set-msrv
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster authored Nov 26, 2024
2 parents cad9505 + fb8e5d2 commit 376035a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check

build-test:
runs-on: ubuntu-latest
strategy:
matrix:
# Always run MSRV too!
rust: ["stable", "1.76"]
features: ['log', 'defmt-log', '""']
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Build
run: cargo build --no-default-features --features ${{matrix.features}} --verbose
- name: Run Tests
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ readme = "README.md"
repository = "https://github.com/rust-embedded-community/embedded-sdmmc-rs"
version = "0.8.0"

# Make sure to update the CI too!
rust-version = "1.76"

[dependencies]
byteorder = {version = "1", default-features = false}
defmt = {version = "0.3", optional = true}
Expand Down
16 changes: 13 additions & 3 deletions src/fat/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ impl VolumeName {

/// Get name
pub fn name(&self) -> &[u8] {
self.contents.trim_ascii_end()
let mut bytes = &self.contents[..];
while let [rest @ .., last] = bytes {
if last.is_ascii_whitespace() {
bytes = rest;
} else {
break;
}
}
bytes
}

/// Create a new MS-DOS volume label.
Expand Down Expand Up @@ -595,7 +603,7 @@ impl FatVolume {
lfn_buffer.push(&buffer);
SeqState::Complete { csum }
}
(true, 0x02..0x14, _) => {
(true, sequence, _) if sequence >= 0x02 && sequence < 0x14 => {
lfn_buffer.clear();
lfn_buffer.push(&buffer);
SeqState::Remaining {
Expand All @@ -607,7 +615,9 @@ impl FatVolume {
lfn_buffer.push(&buffer);
SeqState::Complete { csum }
}
(false, 0x01..0x13, SeqState::Remaining { csum, next }) if next == sequence => {
(false, sequence, SeqState::Remaining { csum, next })
if sequence >= 0x01 && sequence < 0x13 && next == sequence =>
{
lfn_buffer.push(&buffer);
SeqState::Remaining {
csum,
Expand Down

0 comments on commit 376035a

Please sign in to comment.