Skip to content

Conversation

@damaki
Copy link
Owner

@damaki damaki commented Feb 7, 2020

This overhauls the way in which ksum reads input files to ensure that --text mode is properly respected.

The major change is to change ksum from using Ada.Text_IO.Text_Streams to Ada.Streams.Stream_IO when reading files, as Text_Streams always reads in binary mode, whereas with Stream_IO we can force it into text mode using the Interfaces.C_Streams API.

The implementation of the various file hashing algorithms has been changed to work on Root_Stream_Type rather than File_Type. This makes the code much more flexible and allows it to work with any (or mixed) stream implementations. The files have also been renamed to reflect their streaming nature (e.g. file_hashing.ads -> stream_hashing.ads).

The implementation of the Checksums package has also been refactored into two child packages to decouple generation of checksums from verification.

A new test is also added to check that text translation works properly on Windows platforms.

This fixes #9

This overhauls the way in which ksum reads input files to ensure that
`--text` mode is properly respected.

The major change is to change ksum from using `Ada.Text_IO.Text_Streams` to
`Ada.Streams.Stream_IO` when reading files, as `Text_Streams` always reads
in binary mode, whereas with `Stream_IO` we can force it into text mode
using the `Interfaces.C_Streams` API.

The implementation of the various file hashing algorithms has been changed
to work on `Root_Stream_Type` rather than `File_Type`. This makes the code
much more flexible and allows it to work with any (or mixed) stream
implementations. The files have also been renamed to reflect their streaming
nature (e.g. `file_hashing.ads` -> `stream_hashing.ads`).

The implementation of the `Checksums` package has also been refactored into two
child packages to decouple generation of checksums from verification.
This test verifies that CRLF are converted to LF on Windows
platforms when `--text` mode is used.
@damaki damaki self-assigned this Feb 7, 2020
@damaki damaki merged commit 3765311 into master Feb 7, 2020
@damaki damaki deleted the fix-text-mode branch February 8, 2020 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text mode is ignored on Windows.

2 participants