Index: src/natools-smaz_implementations-base_64.adb ================================================================== --- src/natools-smaz_implementations-base_64.adb +++ src/natools-smaz_implementations-base_64.adb @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ --- Copyright (c) 2016, Natacha Porté -- +-- Copyright (c) 2016-2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- @@ -34,12 +34,19 @@ Last_Code : in Natools.Smaz_Implementations.Base_64_Tools.Base_64_Digit; Variable_Length_Verbatim : in Boolean) is Ignored : String (1 .. 2); Offset_Backup : Ada.Streams.Stream_Element_Offset; + Finished : Boolean; begin - Tools.Next_Digit (Input, Offset, Code); + Tools.Next_Digit_Or_End (Input, Offset, Code, Finished); + + if Finished then + Code := Base_64_Tools.Base_64_Digit'Last; + Verbatim_Length := 0; + return; + end if; if Code <= Last_Code then Verbatim_Length := 0; elsif Variable_Length_Verbatim then