Overview
Comment: | smaz_implementations-base_64: fix multi-block verbatim size computation |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c49fad3790f41bc2a2d9f0a03a2ccec5 |
User & Date: | nat on 2017-01-01 21:43:54 |
Other Links: | manifest | tags |
Context
2017-01-02
| ||
20:22 | smaz_tests: ASCIIfy the base-64 dictionary, to make it more portable check-in: 8f0534e6a4 user: nat tags: trunk | |
2017-01-01
| ||
21:43 | smaz_implementations-base_64: fix multi-block verbatim size computation check-in: c49fad3790 user: nat tags: trunk | |
2016-12-31
| ||
16:57 | smaz_tests: add a check to show a bug in long verbatim size computation check-in: 4f0ae7072f user: nat tags: trunk | |
Changes
Modified src/natools-smaz_implementations-base_64.adb from [106572d0cd] to [1a162cf272].
︙ | ︙ | |||
122 123 124 125 126 127 128 | Last_Run_Size : constant Positive := Input_Length - (Run_Count - 1) * Largest_Run; begin return Ada.Streams.Stream_Element_Count (Run_Count - 1) * (Tools.Image_Length (Largest_Run) + 1) + Tools.Image_Length (Last_Run_Size) + 1; end; | | < | | > | | < | | < < < < < | | < | | | > > | | | < < < | | < < < < < < | < < | > < < | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | Last_Run_Size : constant Positive := Input_Length - (Run_Count - 1) * Largest_Run; begin return Ada.Streams.Stream_Element_Count (Run_Count - 1) * (Tools.Image_Length (Largest_Run) + 1) + Tools.Image_Length (Last_Run_Size) + 1; end; else declare Largest_Prefix : constant Natural := (case Input_Length mod 3 is when 1 => 15 * 3 + 1, when 2 => ((62 - Natural (Last_Code)) * 4 - 1) * 3 + 2, when others => 0); Prefix_Header_Size : constant Ada.Streams.Stream_Element_Count := (if Largest_Prefix > 0 then 1 else 0); Largest_Run : constant Positive := 64 * 3; Prefix_Size : constant Natural := Natural'Min (Largest_Prefix, Input_Length); Run_Count : constant Natural := (Input_Length - Prefix_Size + Largest_Run - 1) / Largest_Run; begin if Run_Count > 0 then return Prefix_Header_Size + Tools.Image_Length (Prefix_Size) + Ada.Streams.Stream_Element_Count (Run_Count - 1) * (Tools.Image_Length (Largest_Run) + 2) + Tools.Image_Length (Input_Length - Prefix_Size - (Run_Count - 1) * Largest_Run) + 2; else return Prefix_Header_Size + Tools.Image_Length (Prefix_Size); end if; end; end if; end Verbatim_Size; procedure Write_Code (Output : in out Ada.Streams.Stream_Element_Array; Offset : in out Ada.Streams.Stream_Element_Offset; |
︙ | ︙ |