~nytpu/tlsada

778f2ee217a6ef5a27199dd359cdc5261fd78d84 — nytpu 1 year, 9 months ago 52aab19
TLS.Get_Delim: fix really annoying 'delimeter' typo
2 files changed, 16 insertions(+), 16 deletions(-)

M src/tls.adb
M src/tls.ads
M src/tls.adb => src/tls.adb +7 -7
@@ 39,7 39,7 @@ package body TLS is

	function Get_Delim
		(Stream : access Ada.Streams.Root_Stream_Type'Class;
		Delimeters : Character_Set;
		Delimiters : Character_Set;
		Encountered_Delim : out Boolean;
		Max_Length : Natural := 0)
		return String


@@ 51,7 51,7 @@ package body TLS is
		loop
			begin
				Character'Read(Stream, C);
				if Is_In(C, Delimeters) then
				if Is_In(C, Delimiters) then
					Encountered_Delim := True;
					exit;
				end if;


@@ 67,12 67,12 @@ package body TLS is

	function Get_Delim
		(Stream : access Ada.Streams.Root_Stream_Type'Class;
		Delimeter : String;
		Delimiter : String;
		Encountered_Delim : out Boolean;
		Max_Length : Natural := 0)
		return String
	is
		Sliding : String(Delimeter'Range);
		Sliding : String(Delimiter'Range);
		C : Character;
		O : Unbounded_String := Null_Unbounded_String;
	begin


@@ 90,7 90,7 @@ package body TLS is
					return Sliding(Sliding'First .. I - 1);
			end;
		end loop;
		if Sliding = Delimeter then
		if Sliding = Delimiter then
			Encountered_Delim := True;
			return "";
		end if;


@@ 99,12 99,12 @@ package body TLS is
			begin
				Character'Read(Stream, C);
				Append(O, Sliding(Sliding'First));
				if Max_Length > 0 and Length(O) >= (Max_Length - Delimeter'Length) then
				if Max_Length > 0 and Length(O) >= (Max_Length - Delimiter'Length) then
					Append(O, Sliding(Sliding'First + 1 .. Sliding'Last));
					exit;
				end if;
				Sliding := Sliding(Sliding'First + 1 .. Sliding'Last) & C;
				if Sliding = Delimeter then
				if Sliding = Delimiter then
					Encountered_Delim := True;
					exit;
				end if;

M src/tls.ads => src/tls.ads +9 -9
@@ 24,36 24,36 @@ package TLS is

	-- Helper funtion to read an arbitrary-length string from a stream (up
	-- to the length given in Max_Length if Max_Length /= 0) until a character
	-- in the Delimeters set is encountered.  The string is returned, NOT
	-- including the delimeter.
	-- in the Delimiters set is encountered.  The string is returned, NOT
	-- including the delimiter.
	-- Encountered_Delim will be set to True if the line was returned due to
	-- encountering a delimeter, and will be set to False if the line was
	-- encountering a delimiter, and will be set to False if the line was
	-- returned due to reaching the end of the available data (i.e. an
	-- End_Error was raised).
	function Get_Delim (
		Stream : access Ada.Streams.Root_Stream_Type'Class;
		Delimeters : Character_Set;
		Delimiters : Character_Set;
		Encountered_Delim : out Boolean;
		Max_Length : Natural := 0
	) return String
		with Post =>
			(if Max_Length > 0 then Get_Delim'Result'Length <= Max_Length) and
			(for all C of Get_Delim'Result =>
				not Is_In(C, Delimeters));
				not Is_In(C, Delimiters));

	-- Equivalent to the previous Get_Delim, but use the given string as a
	-- delimeter instead of a single character from a set.
	-- delimiter instead of a single character from a set.
	function Get_Delim (
		Stream : access Ada.Streams.Root_Stream_Type'Class;
		Delimeter : String;
		Delimiter : String;
		Encountered_Delim : out Boolean;
		Max_Length : Natural := 0
	) return String
		with
			Pre => Delimeter'Length > 0,
			Pre => Delimiter'Length > 0,
			Post =>
				(if Max_Length > 0 then Get_Delim'Result'Length <= Max_Length) and
				Delimeter not in Get_Delim'Result;
				Delimiter not in Get_Delim'Result;


	------------