diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-02 10:59:38 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-02 10:59:38 +0000 |
commit | 0677679e44594e7e70f7dbb11c071f4ceb37b216 (patch) | |
tree | 6dd29d3994fb3995d4ffbea69a6fab5906bdc0a2 /gcc/ada/a-ststio.adb | |
parent | 7ebd8248e0ac5c545f454a70e5839a4e9465e021 (diff) | |
download | gcc-0677679e44594e7e70f7dbb11c071f4ceb37b216.tar.gz |
2013-01-02 Thomas Quinot <quinot@adacore.com>
* sem_ch3.adb: Minor reformatting.
2013-01-02 Pascal Obry <obry@adacore.com>
* cstreams.c (__gnat_ftell64): New routine. Use _ftelli64 on
Win64 and default to ftell on other platforms.
(__gnat_fsek64): Likewise.
* i-cstrea.ads: Add fssek64 and ftell64 specs.
* s-crtl.ads: Likewise.
* a-ststio.adb, s-direio.adb (Size): Use 64 bits version when required.
(Set_Position): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194797 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-ststio.adb')
-rw-r--r-- | gcc/ada/a-ststio.adb | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/gcc/ada/a-ststio.adb b/gcc/ada/a-ststio.adb index c5da571495f..91e1ef249e0 100644 --- a/gcc/ada/a-ststio.adb +++ b/gcc/ada/a-ststio.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -367,7 +367,13 @@ package body Ada.Streams.Stream_IO is FIO.Append_Set (AP (File)); if File.Mode = FCB.Append_File then - File.Index := Count (ftell (File.Stream)) + 1; + pragma Warnings (Off, "*condition is always*"); + if Standard'Address_Size = 64 then + File.Index := Count (ftell64 (File.Stream)) + 1; + else + File.Index := Count (ftell (File.Stream)) + 1; + end if; + pragma Warnings (On, "*condition is always*"); end if; File.Last_Op := Op_Other; @@ -379,10 +385,20 @@ package body Ada.Streams.Stream_IO is procedure Set_Position (File : File_Type) is use type System.CRTL.long; + use type System.CRTL.ssize_t; + R : int; begin - if fseek (File.Stream, - System.CRTL.long (File.Index) - 1, SEEK_SET) /= 0 - then + pragma Warnings (Off, "*condition is always*"); + if Standard'Address_Size = 64 then + R := fseek64 (File.Stream, + System.CRTL.ssize_t (File.Index) - 1, SEEK_SET); + else + R := fseek (File.Stream, + System.CRTL.long (File.Index) - 1, SEEK_SET); + end if; + pragma Warnings (On, "*condition is always*"); + + if R /= 0 then raise Use_Error; end if; end Set_Position; @@ -402,7 +418,13 @@ package body Ada.Streams.Stream_IO is raise Device_Error; end if; - File.File_Size := Stream_Element_Offset (ftell (File.Stream)); + pragma Warnings (Off, "*condition is always*"); + if Standard'Address_Size = 64 then + File.File_Size := Stream_Element_Offset (ftell64 (File.Stream)); + else + File.File_Size := Stream_Element_Offset (ftell (File.Stream)); + end if; + pragma Warnings (On, "*condition is always*"); end if; return Count (File.File_Size); |