Natools

Check-in [5bfb52fc1f]
Login
Overview
Comment:string_slices-slice_sets: fix Subset bug when lower bound is between slices
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5bfb52fc1fdbf7be4f159dbf063b3be8e2b6aa0d
User & Date: nat on 2013-11-14 22:56:49
Other Links: manifest | tags
Context
2013-11-18
20:21
chunked_strings-tests-coverage: test Trim with multiple-chunk prefix check-in: e0c2566ea5 user: nat tags: trunk
2013-11-14
22:56
string_slices-slice_sets: fix Subset bug when lower bound is between slices check-in: 5bfb52fc1f user: nat tags: trunk
2013-11-13
19:48
string_slice_set_tests: new test case showing a bug in Subset check-in: 7b0c5022d4 user: nat tags: trunk
Changes

Modified src/natools-string_slices-slice_sets.adb from [3e42d8700a] to [5c501d728f].

731
732
733
734
735
736
737
738

739
740
741
742
743

744
745
746
747
748
749
750
      if Bounds.Length = 0 or else Set.Bounds.Is_Empty then
         return Result;
      end if;

      Cursor := Set.Bounds.Floor (Bounds);
      if Range_Sets.Has_Element (Cursor) then
         R := Range_Sets.Element (Cursor);
         if R.First < Bounds.First and then Is_In (Bounds.First, R) then

            Set_First (R, Bounds.First);
            if Is_In (Last (Bounds), R) then
               Set_Last (R, Last (Bounds));
            end if;
            Result.Bounds.Insert (R);

            Range_Sets.Next (Cursor);
         end if;
      else
         Cursor := Set.Bounds.First;
      end if;

      while Range_Sets.Has_Element (Cursor) loop







|
>
|
|
|
|
|
>







731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
      if Bounds.Length = 0 or else Set.Bounds.Is_Empty then
         return Result;
      end if;

      Cursor := Set.Bounds.Floor (Bounds);
      if Range_Sets.Has_Element (Cursor) then
         R := Range_Sets.Element (Cursor);
         if R.First < Bounds.First then
            if Is_In (Bounds.First, R) then
               Set_First (R, Bounds.First);
               if Is_In (Last (Bounds), R) then
                  Set_Last (R, Last (Bounds));
               end if;
               Result.Bounds.Insert (R);
            end if;
            Range_Sets.Next (Cursor);
         end if;
      else
         Cursor := Set.Bounds.First;
      end if;

      while Range_Sets.Has_Element (Cursor) loop