summaryrefslogtreecommitdiff
path: root/gcc/ada/mlib.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-13 09:28:05 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-13 09:28:05 +0000
commit5b76e9f344761b6249f6cc142aefc8fb568ed758 (patch)
tree41ba0cda502a543970275f8680cecac1ddb0e6b3 /gcc/ada/mlib.adb
parent8234fccd5db937e45fb31ff3f3161744e776a6ab (diff)
downloadgcc-5b76e9f344761b6249f6cc142aefc8fb568ed758.tar.gz
2009-07-13 Thomas Quinot <quinot@adacore.com>
* rtsfind.ads, exp_dist.adb (RE_Allocate_Buffer): Runtime entry removed, not used anymore. (Exp_Dist.PolyORB_Support.Helpers.Assign_Opaque_From_Any): New subprogram, implements copy of an Any value into a limited object. (Exp_Dist.PolyORB_Support.Build_General_Calling_Stubs, Exp_Dist.PolyORB_Support.Build_Subprogram_Receiving_Stubs, Exp_Dist.PolyORB_Support.Helpers.Build_From_Any_Function): For the case of parameters of a limited type, use the above new subprogram. 2009-07-13 Emmanuel Briot <briot@adacore.com> * prj-nmsc.adb, prj-proc.adb, mlib.adb (Add_Source): new parameter Location. (Copy_ALI_Files): Avoid calls to read when pointing outside of the allocated space. (Error_Report): Remove global variable, replaced by parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/mlib.adb')
-rw-r--r--gcc/ada/mlib.adb11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ada/mlib.adb b/gcc/ada/mlib.adb
index 5d029dbf387..61fa0d7ada8 100644
--- a/gcc/ada/mlib.adb
+++ b/gcc/ada/mlib.adb
@@ -202,16 +202,21 @@ package body MLib is
if FD /= Invalid_FD then
Len := Integer (File_Length (FD));
+ -- ??? Why "+3" here
+
S := new String (1 .. Len + 3);
-- Read the file. Note that the loop is not necessary
-- since the whole file is read at once except on VMS.
- Curr := 1;
- Actual_Len := Len;
+ Curr := S'First;
- while Actual_Len /= 0 loop
+ while Curr <= Len loop
Actual_Len := Read (FD, S (Curr)'Address, Len);
+
+ -- Exit if we could not read for some reason
+ exit when Actual_Len = 0;
+
Curr := Curr + Actual_Len;
end loop;