Commit 99ebea03 by Tobias Burnus Committed by Tobias Burnus

unix.c: Adapt stat DEFINEs since MinGW64 supports LFS.

2011-04-04  Tobias Burnus  <burnus@net-b.de>

        * unix.c: Adapt stat DEFINEs since MinGW64 supports LFS.
        (fallback_access, open_internal4, compare_file_filename,
        find_file, file_size, inquire_sequential, inquire_direct,
        inquire_formatted): Use "struct stat" instead of gfstat_t.

From-SVN: r171911
parent 6733afe1
2011-04-04 Tobias Burnus <burnus@net-b.de>
* unix.c: Adapt stat DEFINEs since MinGW64 supports LFS.
(fallback_access, open_internal4, compare_file_filename,
find_file, file_size, inquire_sequential, inquire_direct,
inquire_formatted): Use "struct stat" instead of gfstat_t.
2011-03-27 Tobias Burnus <burnus@net-b.de> 2011-03-27 Tobias Burnus <burnus@net-b.de>
PR fortran/18918 PR fortran/18918
......
...@@ -48,10 +48,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -48,10 +48,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
#undef lseek
#define lseek _lseeki64 #define lseek _lseeki64
#undef fstat
#define fstat _fstati64 #define fstat _fstati64
#undef stat
#define stat _stati64 #define stat _stati64
typedef struct _stati64 gfstat_t; #endif
#ifndef HAVE_WORKING_STAT #ifndef HAVE_WORKING_STAT
static uint64_t static uint64_t
...@@ -96,9 +100,6 @@ id_from_fd (const int fd) ...@@ -96,9 +100,6 @@ id_from_fd (const int fd)
} }
#endif #endif
#else
typedef struct stat gfstat_t;
#endif #endif
#ifndef PATH_MAX #ifndef PATH_MAX
...@@ -156,7 +157,7 @@ fallback_access (const char *path, int mode) ...@@ -156,7 +157,7 @@ fallback_access (const char *path, int mode)
if (mode == F_OK) if (mode == F_OK)
{ {
gfstat_t st; struct stat st;
return stat (path, &st); return stat (path, &st);
} }
...@@ -924,7 +925,7 @@ open_internal4 (char *base, int length, gfc_offset offset) ...@@ -924,7 +925,7 @@ open_internal4 (char *base, int length, gfc_offset offset)
static stream * static stream *
fd_to_stream (int fd) fd_to_stream (int fd)
{ {
gfstat_t statbuf; struct stat statbuf;
unix_stream *s; unix_stream *s;
s = get_mem (sizeof (unix_stream)); s = get_mem (sizeof (unix_stream));
...@@ -1405,7 +1406,7 @@ int ...@@ -1405,7 +1406,7 @@ int
compare_file_filename (gfc_unit *u, const char *name, int len) compare_file_filename (gfc_unit *u, const char *name, int len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t st; struct stat st;
#ifdef HAVE_WORKING_STAT #ifdef HAVE_WORKING_STAT
unix_stream *s; unix_stream *s;
#else #else
...@@ -1446,7 +1447,7 @@ compare_file_filename (gfc_unit *u, const char *name, int len) ...@@ -1446,7 +1447,7 @@ compare_file_filename (gfc_unit *u, const char *name, int len)
#ifdef HAVE_WORKING_STAT #ifdef HAVE_WORKING_STAT
# define FIND_FILE0_DECL gfstat_t *st # define FIND_FILE0_DECL struct stat *st
# define FIND_FILE0_ARGS st # define FIND_FILE0_ARGS st
#else #else
# define FIND_FILE0_DECL uint64_t id, const char *file, gfc_charlen_type file_len # define FIND_FILE0_DECL uint64_t id, const char *file, gfc_charlen_type file_len
...@@ -1505,7 +1506,7 @@ gfc_unit * ...@@ -1505,7 +1506,7 @@ gfc_unit *
find_file (const char *file, gfc_charlen_type file_len) find_file (const char *file, gfc_charlen_type file_len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t st[1]; struct stat st[1];
gfc_unit *u; gfc_unit *u;
#if defined(__MINGW32__) && !HAVE_WORKING_STAT #if defined(__MINGW32__) && !HAVE_WORKING_STAT
uint64_t id = 0ULL; uint64_t id = 0ULL;
...@@ -1656,7 +1657,7 @@ GFC_IO_INT ...@@ -1656,7 +1657,7 @@ GFC_IO_INT
file_size (const char *file, gfc_charlen_type file_len) file_size (const char *file, gfc_charlen_type file_len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t statbuf; struct stat statbuf;
if (unpack_filename (path, file, file_len)) if (unpack_filename (path, file, file_len))
return -1; return -1;
...@@ -1677,7 +1678,7 @@ const char * ...@@ -1677,7 +1678,7 @@ const char *
inquire_sequential (const char *string, int len) inquire_sequential (const char *string, int len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t statbuf; struct stat statbuf;
if (string == NULL || if (string == NULL ||
unpack_filename (path, string, len) || stat (path, &statbuf) < 0) unpack_filename (path, string, len) || stat (path, &statbuf) < 0)
...@@ -1701,7 +1702,7 @@ const char * ...@@ -1701,7 +1702,7 @@ const char *
inquire_direct (const char *string, int len) inquire_direct (const char *string, int len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t statbuf; struct stat statbuf;
if (string == NULL || if (string == NULL ||
unpack_filename (path, string, len) || stat (path, &statbuf) < 0) unpack_filename (path, string, len) || stat (path, &statbuf) < 0)
...@@ -1725,7 +1726,7 @@ const char * ...@@ -1725,7 +1726,7 @@ const char *
inquire_formatted (const char *string, int len) inquire_formatted (const char *string, int len)
{ {
char path[PATH_MAX + 1]; char path[PATH_MAX + 1];
gfstat_t statbuf; struct stat statbuf;
if (string == NULL || if (string == NULL ||
unpack_filename (path, string, len) || stat (path, &statbuf) < 0) unpack_filename (path, string, len) || stat (path, &statbuf) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment