Skip to content

Commit bc9bdee

Browse files
committed
Minor code reformatting and clean-up.
Part of S507-051.
1 parent 4979d07 commit bc9bdee

File tree

3 files changed

+16
-30
lines changed

3 files changed

+16
-30
lines changed

src/core/aws-client-http_utils.adb

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pragma Ada_2012;
3232
with Ada.Characters.Handling;
3333
with Ada.Exceptions;
3434
with Ada.Strings.Fixed;
35+
with Ada.Strings.Maps;
3536

3637
with AWS.Digest;
3738
with AWS.Headers.Values;
@@ -772,10 +773,10 @@ package body AWS.Client.HTTP_Utils is
772773
Headers : Header_List := Empty_Header_List)
773774
is
774775
use Real_Time;
775-
Stamp : constant Time := Clock;
776-
Pref_Suf : constant String := "--";
777-
Boundary : constant String :=
778-
"AWS_Attachment-" & Utils.Random_String (8);
776+
Stamp : constant Time := Clock;
777+
Pref_Suf : constant String := "--";
778+
Boundary : constant String :=
779+
"AWS_Attachment-" & Utils.Random_String (8);
779780

780781
Root_Content_Id : constant String := "<rootpart>";
781782
Root_Part_Header : AWS.Headers.List;
@@ -1081,10 +1082,7 @@ package body AWS.Client.HTTP_Utils is
10811082
Decrement_Authentication_Attempt
10821083
(Connection, Auth_Attempts, Auth_Is_Over);
10831084

1084-
if Auth_Is_Over then
1085-
exit Retry;
1086-
end if;
1087-
1085+
exit Retry when Auth_Is_Over;
10881086
exception
10891087
when E : Net.Socket_Error | Connection_Error =>
10901088
Error_Processing
@@ -1246,23 +1244,9 @@ package body AWS.Client.HTTP_Utils is
12461244
-- Returns "Keep-Alive" is we have a persistent connection and "Close"
12471245
-- otherwise.
12481246

1249-
function Encoded_URI return String;
1250-
-- Returns URI encoded (' ' -> '+')
1251-
1252-
-----------------
1253-
-- Encoded_URI --
1254-
-----------------
1255-
12561247
function Encoded_URI return String is
1257-
E_URI : String := URI;
1258-
begin
1259-
for K in E_URI'Range loop
1260-
if E_URI (K) = ' ' then
1261-
E_URI (K) := '+';
1262-
end if;
1263-
end loop;
1264-
return E_URI;
1265-
end Encoded_URI;
1248+
(Strings.Fixed.Translate (URI, Strings.Maps.To_Mapping (" ", "+")));
1249+
-- Returns URI encoded (' ' -> '+')
12661250

12671251
-----------------
12681252
-- Persistence --
@@ -1501,6 +1485,7 @@ package body AWS.Client.HTTP_Utils is
15011485
Response.Set.Append_Body
15021486
(Result, "..." & ASCII.LF & " Response Timeout");
15031487
end if;
1488+
15041489
Response.Set.Status_Code (Result, Messages.S408);
15051490
exit;
15061491
end if;
@@ -1886,8 +1871,7 @@ package body AWS.Client.HTTP_Utils is
18861871

18871872
-- Send the setting frame (stream id 0)
18881873

1889-
HTTP2.Frame.Settings.Create
1890-
(Settings).Send (Connection.Socket.all);
1874+
HTTP2.Frame.Settings.Create (Settings).Send (Connection.Socket.all);
18911875

18921876
-- We need to read the settings from server
18931877

src/core/aws-parameters.adb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ package body AWS.Parameters is
154154
---------
155155

156156
procedure Add
157-
(Parameter_List : in out List; Name, Value : String; Decode : Boolean) is
157+
(Parameter_List : in out List;
158+
Name, Value : String;
159+
Decode : Boolean) is
158160
begin
159161
if Decode then
160162
Parameter_List.Add (URL.Decode (Name), URL.Decode (Value));
@@ -283,9 +285,9 @@ package body AWS.Parameters is
283285
function URI_Format
284286
(Parameter_List : List; Limit : Positive := Positive'Last) return String
285287
is
286-
Delimiter : Character := '?';
288+
Delimiter : Character := '?';
287289
Parameters : Unbounded_String;
288-
Size : Positive := 1;
290+
Size : Positive := 1;
289291
begin
290292
for J in 1 .. Parameter_List.Count loop
291293
declare

src/core/aws-resources-streams.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ package body AWS.Resources.Streams is
9696
is
9797
use type Embedded.Buffer_Access;
9898

99-
Stream : Stream_Access;
10099
In_GZip : constant Boolean := GZip;
101100
Buffer : constant Embedded.Buffer_Access :=
102101
Embedded.Get_Buffer (Name, GZip);
102+
Stream : Stream_Access;
103103
begin
104104
if Buffer /= null then
105105
Stream := new Memory.Stream_Type;

0 commit comments

Comments
 (0)