Natools

Check-in [a4d12bf348]
Login
Overview
Comment:s_expressions-atom_buffers: fix exception when appending an empty atom to an empty buffer
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a4d12bf348c77479d21e57d6eb046d00d11d64e0
User & Date: nat on 2014-03-31 19:09:58
Other Links: manifest | tags
Context
2014-04-01
20:58
s_expressions-parsers: catch up with new version in overview comment check-in: a4503d0ae7 user: nat tags: trunk
2014-03-31
19:09
s_expressions-atom_buffers: fix exception when appending an empty atom to an empty buffer check-in: a4d12bf348 user: nat tags: trunk
2014-03-30
12:31
s_expressions-atom_buffers-tests: add a minimal test to show empty append bug check-in: 22bbf2ef8f user: nat tags: trunk
Changes

Modified src/natools-s_expressions-atom_buffers.adb from [e163901780] to [f7bbd4f802].

56
57
58
59
60
61
62

63
64
65
66






67
68
69
70
71
72
73
56
57
58
59
60
61
62
63




64
65
66
67
68
69
70
71
72
73
74
75
76







+
-
-
-
-
+
+
+
+
+
+








      Buffer.Available := New_Size;
   end Preallocate;


   procedure Append (Buffer : in out Atom_Buffer; Data : in Atom) is
   begin
      if Data'Length > 0 then
      Preallocate (Buffer, Data'Length);
      Buffer.Ref.Update.Data.all (Buffer.Used + 1 .. Buffer.Used + Data'Length)
        := Data;
      Buffer.Used := Buffer.Used + Data'Length;
         Preallocate (Buffer, Data'Length);
         Buffer.Ref.Update.Data.all
           (Buffer.Used + 1 .. Buffer.Used + Data'Length)
           := Data;
         Buffer.Used := Buffer.Used + Data'Length;
      end if;
   end Append;


   procedure Append (Buffer : in out Atom_Buffer; Data : in Octet) is
   begin
      Preallocate (Buffer, 1);
      Buffer.Ref.Update.Data.all (Buffer.Used + 1) := Data;