OSDN Git Service

2007-06-11 Bob Duff <duff@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-md5.adb
index 31cc1ad..158c9c7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                B o d y                                   --
 --                                                                          --
---            Copyright (C) 2002-2004 Ada Core Technologies, Inc.           --
+--                     Copyright (C) 2002-2006, AdaCore                     --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -16,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- As a special exception,  if other files  instantiate  generics from this --
 -- unit, or you link  this unit with other files  to produce an executable, --
@@ -138,7 +138,7 @@ package body GNAT.MD5 is
    procedure Transform
      (C     : in out Context;
       Block : String);
-   --  Process one block of 64 characters.
+   --  Process one block of 64 characters
 
    ------------
    -- Decode --
@@ -148,7 +148,7 @@ package body GNAT.MD5 is
      (Block : String;
       X     : out Sixteen_Words)
    is
-      Cur   : Positive := Block'First;
+      Cur : Positive := Block'First;
 
    begin
       pragma Assert (Block'Length = 64);
@@ -171,7 +171,7 @@ package body GNAT.MD5 is
       Result : Message_Digest;
 
       Cur : Natural := 1;
-      --  Index in Result where the next character will be placed.
+      --  Index in Result where the next character will be placed
 
       Last_Block : String (1 .. 64);
 
@@ -187,7 +187,6 @@ package body GNAT.MD5 is
 
       procedure Convert (X : Unsigned_32) is
          Y : Unsigned_32 := X;
-
       begin
          for J in 1 .. 4 loop
             Result (Cur + 1) := Hex_Digit (Y and Unsigned_32'(16#0F#));
@@ -205,7 +204,9 @@ package body GNAT.MD5 is
 
       Last_Block (1 .. C.Last) := C.Buffer (1 .. C.Last);
 
-      if C.Last > 56 then
+      --  Too many magic literals below, should be defined as constants ???
+
+      if C.Last > 55 then
          Last_Block (C.Last + 1 .. 64) := Padding (1 .. 64 - C.Last);
          Transform (C1, Last_Block);
          Last_Block := (others => ASCII.NUL);
@@ -519,7 +520,6 @@ package body GNAT.MD5 is
 
    function Wide_Digest (W : Wide_String) return Message_Digest is
       C : Context;
-
    begin
       Wide_Update (C, W);
       return Digest (C);
@@ -533,7 +533,6 @@ package body GNAT.MD5 is
      (C     : in out Context;
       Input : Wide_String)
    is
-
       String_Input : String (1 .. 2 * Input'Length);
       Cur          : Positive := 1;