mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-24 07:00:29 +08:00
adaint.h, adaint.c (__gnat_file_length): Returns an __int64.
2014-08-01 Pascal Obry <obry@adacore.com> * adaint.h, adaint.c (__gnat_file_length): Returns an __int64. (__gnat_named_file_length): Likewise. (__gnat_file_length_attr): Likewise. * a-direct.adb (C_Size): Use size_t as returned type. * osint.adb (File_Length): Adjust spec for Internal routine (returns size_t). * s-os_lib.adb (File_Length): Now returns a CRTL.size_t. (System.CRTL): With claused moved to spec. * s-os_lib.ads (System.CRTL): With clause moved to here. From-SVN: r213412
This commit is contained in:
parent
479f90598a
commit
148c744a17
@ -1,3 +1,15 @@
|
||||
2014-08-01 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* adaint.h, adaint.c (__gnat_file_length): Returns an __int64.
|
||||
(__gnat_named_file_length): Likewise.
|
||||
(__gnat_file_length_attr): Likewise.
|
||||
* a-direct.adb (C_Size): Use size_t as returned type.
|
||||
* osint.adb (File_Length): Adjust spec for Internal routine
|
||||
(returns size_t).
|
||||
* s-os_lib.adb (File_Length): Now returns a CRTL.size_t.
|
||||
(System.CRTL): With claused moved to spec.
|
||||
* s-os_lib.ads (System.CRTL): With clause moved to here.
|
||||
|
||||
2014-08-01 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* adaint.h, adaint.c (__gnat_open): Added.
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2004-2013, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2004-2014, 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- --
|
||||
@ -1250,7 +1250,7 @@ package body Ada.Directories is
|
||||
function Size (Name : String) return File_Size is
|
||||
C_Name : String (1 .. Name'Length + 1);
|
||||
|
||||
function C_Size (Name : Address) return Long_Integer;
|
||||
function C_Size (Name : Address) return size_t;
|
||||
pragma Import (C, C_Size, "__gnat_named_file_length");
|
||||
|
||||
begin
|
||||
|
@ -1308,7 +1308,7 @@ __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr)
|
||||
** Return the number of bytes in the specified file
|
||||
****************************************************************/
|
||||
|
||||
long
|
||||
__int64
|
||||
__gnat_file_length_attr (int fd, char* name, struct file_attributes* attr)
|
||||
{
|
||||
if (attr->file_length == -1) {
|
||||
@ -1318,7 +1318,7 @@ __gnat_file_length_attr (int fd, char* name, struct file_attributes* attr)
|
||||
return attr->file_length;
|
||||
}
|
||||
|
||||
long
|
||||
__int64
|
||||
__gnat_file_length (int fd)
|
||||
{
|
||||
struct file_attributes attr;
|
||||
@ -1326,7 +1326,7 @@ __gnat_file_length (int fd)
|
||||
return __gnat_file_length_attr (fd, NULL, &attr);
|
||||
}
|
||||
|
||||
long
|
||||
__int64
|
||||
__gnat_named_file_length (char *name)
|
||||
{
|
||||
struct file_attributes attr;
|
||||
|
@ -98,7 +98,7 @@ struct file_attributes {
|
||||
unsigned char directory;
|
||||
|
||||
OS_Time timestamp;
|
||||
long file_length;
|
||||
__int64 file_length;
|
||||
};
|
||||
/* WARNING: changing the size here might require changing the constant
|
||||
* File_Attributes_Size in osint.ads (which should be big enough to
|
||||
@ -151,8 +151,8 @@ extern int __gnat_create_output_file (char *);
|
||||
extern int __gnat_create_output_file_new (char *);
|
||||
|
||||
extern int __gnat_open_append (char *, int);
|
||||
extern long __gnat_file_length (int);
|
||||
extern long __gnat_named_file_length (char *);
|
||||
extern __int64 __gnat_file_length (int);
|
||||
extern __int64 __gnat_named_file_length (char *);
|
||||
extern void __gnat_tmp_name (char *);
|
||||
extern DIR *__gnat_opendir (char *);
|
||||
extern char *__gnat_readdir (DIR *, char *, int *);
|
||||
@ -177,7 +177,7 @@ extern int __gnat_is_executable_file (char *name);
|
||||
|
||||
extern void __gnat_reset_attributes (struct file_attributes *);
|
||||
extern int __gnat_error_attributes (struct file_attributes *);
|
||||
extern long __gnat_file_length_attr (int, char *, struct file_attributes *);
|
||||
extern __int64 __gnat_file_length_attr (int, char *, struct file_attributes *);
|
||||
extern OS_Time __gnat_file_time_name_attr (char *, struct file_attributes *);
|
||||
extern OS_Time __gnat_file_time_fd_attr (int, struct file_attributes *);
|
||||
extern int __gnat_file_exists_attr (char *, struct file_attributes *);
|
||||
|
@ -1076,10 +1076,13 @@ package body Osint is
|
||||
function Internal
|
||||
(F : Integer;
|
||||
N : C_File_Name;
|
||||
A : System.Address) return Long_Integer;
|
||||
A : System.Address) return size_t;
|
||||
pragma Import (C, Internal, "__gnat_file_length_attr");
|
||||
begin
|
||||
return Internal (-1, Name, Attr.all'Address);
|
||||
-- The conversion from size_t to Long_Integer is ok here as this
|
||||
-- routine is only to be used by the compiler and we do not expect
|
||||
-- a unit to be larger than a 32bit integer.
|
||||
return Long_Integer (Internal (-1, Name, Attr.all'Address));
|
||||
end File_Length;
|
||||
|
||||
---------------------
|
||||
|
@ -35,7 +35,6 @@ with Ada.Unchecked_Conversion;
|
||||
with Ada.Unchecked_Deallocation;
|
||||
with System; use System;
|
||||
with System.Case_Util;
|
||||
with System.CRTL;
|
||||
with System.Soft_Links;
|
||||
|
||||
package body System.OS_Lib is
|
||||
|
@ -56,6 +56,8 @@ pragma Compiler_Unit_Warning;
|
||||
with System;
|
||||
with System.Strings;
|
||||
|
||||
with System.CRTL;
|
||||
|
||||
package System.OS_Lib is
|
||||
pragma Preelaborate;
|
||||
|
||||
@ -432,7 +434,7 @@ package System.OS_Lib is
|
||||
-- to the current position (origin = SEEK_CUR), end of file (origin =
|
||||
-- SEEK_END), or start of file (origin = SEEK_SET).
|
||||
|
||||
function File_Length (FD : File_Descriptor) return Long_Integer;
|
||||
function File_Length (FD : File_Descriptor) return CRTL.size_t;
|
||||
pragma Import (C, File_Length, "__gnat_file_length");
|
||||
-- Get length of file from file descriptor FD
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user