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/s-direio.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/s-direio.adb')
-rw-r--r-- | gcc/ada/s-direio.adb | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/gcc/ada/s-direio.adb b/gcc/ada/s-direio.adb index ef4c3ea9cf1..f7db2e2b262 100644 --- a/gcc/ada/s-direio.adb +++ b/gcc/ada/s-direio.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- -- @@ -29,13 +29,13 @@ -- -- ------------------------------------------------------------------------------ -with Ada.IO_Exceptions; use Ada.IO_Exceptions; -with Interfaces.C_Streams; use Interfaces.C_Streams; -with System; use System; +with Ada.IO_Exceptions; use Ada.IO_Exceptions; +with Ada.Unchecked_Deallocation; +with Interfaces.C_Streams; use Interfaces.C_Streams; +with System; use System; with System.CRTL; with System.File_IO; with System.Soft_Links; -with Ada.Unchecked_Deallocation; package body System.Direct_IO is @@ -280,11 +280,22 @@ package body System.Direct_IO is ------------------ procedure Set_Position (File : File_Type) is + use type System.CRTL.ssize_t; + R : int; begin - if fseek + pragma Warnings (Off, "*condition is always*"); + if Standard'Address_Size = 64 then + R := fseek64 + (File.Stream, ssize_t (File.Bytes) * + ssize_t (File.Index - 1), SEEK_SET); + else + R := fseek (File.Stream, long (File.Bytes) * - long (File.Index - 1), SEEK_SET) /= 0 - then + 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; @@ -294,6 +305,7 @@ package body System.Direct_IO is ---------- function Size (File : File_Type) return Count is + use type System.CRTL.ssize_t; begin FIO.Check_File_Open (AP (File)); File.Last_Op := Op_Other; @@ -302,7 +314,13 @@ package body System.Direct_IO is raise Device_Error; end if; - return Count (ftell (File.Stream) / long (File.Bytes)); + pragma Warnings (Off, "*condition is always*"); + if Standard'Address_Size = 64 then + return Count (ftell64 (File.Stream) / ssize_t (File.Bytes)); + else + return Count (ftell (File.Stream) / long (File.Bytes)); + end if; + pragma Warnings (On, "*condition is always*"); end Size; ----------- |