diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-05 15:32:47 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-05 15:32:47 +0000 |
commit | f987f9a415ab997804c18c49eabf22ac6f73ca89 (patch) | |
tree | f8390ea2012871d27ab62dacec81c19158fa933a /gcc/ada/a-cbmutr.adb | |
parent | 13acb9daf1da6b1d718e61992923a125809d6d16 (diff) | |
download | gcc-f987f9a415ab997804c18c49eabf22ac6f73ca89.tar.gz |
2011-08-05 Matthew Heaney <heaney@adacore.com>
* a-comutr.adb, a-cimutr.adb, a-cbmutr.adb (Read): do not use T'Valid
to check count, check sign of value instead.
* a-comutr.adb, a-cimutr.adb (Write): return immediately if tree empty
(Copy_Subtree): allocate copy of source element
(Equal_Subtree): compare elements, not access objects
2011-08-05 Vincent Celier <celier@adacore.com>
* gnat_ugn.texi: Fix VMS alternative.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177457 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-cbmutr.adb')
-rw-r--r-- | gcc/ada/a-cbmutr.adb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ada/a-cbmutr.adb b/gcc/ada/a-cbmutr.adb index 6e22e0e8756..1392a4fdc17 100644 --- a/gcc/ada/a-cbmutr.adb +++ b/gcc/ada/a-cbmutr.adb @@ -2117,20 +2117,26 @@ package body Ada.Containers.Bounded_Multiway_Trees is NN : Tree_Node_Array renames Container.Nodes; - Total_Count, Read_Count : Count_Type; + Total_Count : Count_Type'Base; + -- Value read from the stream that says how many elements follow + + Read_Count : Count_Type'Base; + -- Actual number of elements read from the stream ------------------- -- Read_Children -- ------------------- procedure Read_Children (Subtree : Count_Type) is - Count : Count_Type; -- number of child subtrees - CC : Children_Type; + Count : Count_Type'Base; + -- number of child subtrees + + CC : Children_Type; begin Count_Type'Read (Stream, Count); - if not Count'Valid then -- Is this check necessary??? + if Count < 0 then raise Program_Error with "attempt to read from corrupt stream"; end if; @@ -2180,7 +2186,7 @@ package body Ada.Containers.Bounded_Multiway_Trees is Count_Type'Read (Stream, Total_Count); - if not Total_Count'Valid then -- Is this check necessary??? + if Total_Count < 0 then raise Program_Error with "attempt to read from corrupt stream"; end if; |