Natools

Check-in [b9f0155723]
Login
Overview
Comment:smaz_generic: update semantics of Read_Code to signal end-of-input
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b9f0155723f3f6a22e46810490b81840ac1d1658
User & Date: nat on 2017-02-25 20:45:22
Other Links: manifest | tags
Context
2017-02-26
21:43
smaz_implementations-base_64_tools: new primitive to check end of input check-in: b05bcfb847 user: nat tags: trunk
2017-02-25
20:45
smaz_generic: update semantics of Read_Code to signal end-of-input check-in: b9f0155723 user: nat tags: trunk
2017-02-24
20:21
smaz_tests: check constraint error in hash-to-code conversion check-in: ec0159cb57 user: nat tags: trunk
Changes

Modified src/natools-smaz_generic.adb from [c2e4810a49] to [f4b07b4eb0].

196
197
198
199
200
201
202

203
204
205
206
207
208
209
            Code, Verbatim_Length,
            Dict.Last_Code, Dict.Variable_Length_Verbatim);

         if Verbatim_Length > 0 then
            Skip_Verbatim (Input, Input_Index, Verbatim_Length);
            Result := Result + Verbatim_Length;
         else

            Result := Result + Dict_Entry_Length (Dict, Code);
         end if;
      end loop;

      return Result;
   end Decompressed_Length;








>







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
            Code, Verbatim_Length,
            Dict.Last_Code, Dict.Variable_Length_Verbatim);

         if Verbatim_Length > 0 then
            Skip_Verbatim (Input, Input_Index, Verbatim_Length);
            Result := Result + Verbatim_Length;
         else
            exit when not Is_Valid_Code (Dict, Code);
            Result := Result + Dict_Entry_Length (Dict, Code);
         end if;
      end loop;

      return Result;
   end Decompressed_Length;

229
230
231
232
233
234
235


236
237
238
239
240
241
242
         if Verbatim_Length > 0 then
            Read_Verbatim
              (Input, Input_Index,
               Output_Buffer
                 (Output_Last + 1 .. Output_Last + Verbatim_Length));
            Output_Last := Output_Last + Verbatim_Length;
         else


            declare
               Decoded : constant String := Dict_Entry (Dict, Code);
            begin
               Output_Buffer (Output_Last + 1 .. Output_Last + Decoded'Length)
                 := Decoded;
               Output_Last := Output_Last + Decoded'Length;
            end;







>
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
         if Verbatim_Length > 0 then
            Read_Verbatim
              (Input, Input_Index,
               Output_Buffer
                 (Output_Last + 1 .. Output_Last + Verbatim_Length));
            Output_Last := Output_Last + Verbatim_Length;
         else
            exit when not Is_Valid_Code (Dict, Code);

            declare
               Decoded : constant String := Dict_Entry (Dict, Code);
            begin
               Output_Buffer (Output_Last + 1 .. Output_Last + Decoded'Length)
                 := Decoded;
               Output_Last := Output_Last + Decoded'Length;
            end;