Don't expose implementation detail for opaque DIRENT structures.
This commit is contained in:
parent
f4ec874328
commit
36ccb620ec
|
@ -1,3 +1,12 @@
|
||||||
|
2011-08-27 Keith Marshall <keithmarshall@users.sourceforge.net>
|
||||||
|
|
||||||
|
Don't expose implementation detail for opaque DIRENT structures.
|
||||||
|
|
||||||
|
* include/dirent.h (DIR, _WDIR): Declare as opaque data types.
|
||||||
|
(__dirstream_t, __wdirstream_t): Add these tags for their underlying
|
||||||
|
structures, respectively; move their detailed declarations to...
|
||||||
|
* mingwex/dirent.c: ...here.
|
||||||
|
|
||||||
2011-08-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
|
2011-08-23 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
|
||||||
|
|
||||||
* include/_mingw.h: Increment version to 3.20.
|
* include/_mingw.h: Increment version to 3.20.
|
||||||
|
|
|
@ -28,34 +28,10 @@ struct dirent
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an internal data structure. Good programmers will not use it
|
* This opaque data type represents the private structure
|
||||||
* except as an argument to one of the functions below.
|
* through which a directory stream is referenced.
|
||||||
* dd_stat field is now int (was short in older versions).
|
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct __dirstream_t DIR;
|
||||||
{
|
|
||||||
/* disk transfer area for this dir */
|
|
||||||
struct _finddata_t dd_dta;
|
|
||||||
|
|
||||||
/* dirent struct to return from dir (NOTE: this makes this thread
|
|
||||||
* safe as long as only one thread uses a particular DIR struct at
|
|
||||||
* a time) */
|
|
||||||
struct dirent dd_dir;
|
|
||||||
|
|
||||||
/* _findnext handle */
|
|
||||||
intptr_t dd_handle;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Status of search:
|
|
||||||
* 0 = not started yet (next entry to read is first entry)
|
|
||||||
* -1 = off the end
|
|
||||||
* positive = 0 based index of next entry
|
|
||||||
*/
|
|
||||||
int dd_stat;
|
|
||||||
|
|
||||||
/* given path for dir with search pattern (struct is extended) */
|
|
||||||
char dd_name[1];
|
|
||||||
} DIR;
|
|
||||||
|
|
||||||
DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
|
DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
|
||||||
struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
|
struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
|
||||||
|
@ -76,33 +52,10 @@ struct _wdirent
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an internal data structure. Good programmers will not use it
|
* This opaque data type represents the private structure
|
||||||
* except as an argument to one of the functions below.
|
* through which a wide directory stream is referenced.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct __wdirstream_t _WDIR;
|
||||||
{
|
|
||||||
/* disk transfer area for this dir */
|
|
||||||
struct _wfinddata_t dd_dta;
|
|
||||||
|
|
||||||
/* dirent struct to return from dir (NOTE: this makes this thread
|
|
||||||
* safe as long as only one thread uses a particular DIR struct at
|
|
||||||
* a time) */
|
|
||||||
struct _wdirent dd_dir;
|
|
||||||
|
|
||||||
/* _findnext handle */
|
|
||||||
intptr_t dd_handle;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Status of search:
|
|
||||||
* 0 = not started yet (next entry to read is first entry)
|
|
||||||
* -1 = off the end
|
|
||||||
* positive = 0 based index of next entry
|
|
||||||
*/
|
|
||||||
int dd_stat;
|
|
||||||
|
|
||||||
/* given path for dir with search pattern (struct is extended) */
|
|
||||||
wchar_t dd_name[1];
|
|
||||||
} _WDIR;
|
|
||||||
|
|
||||||
_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
|
_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
|
||||||
struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
|
struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
|
||||||
|
|
|
@ -28,6 +28,60 @@
|
||||||
#define SUFFIX _T("*")
|
#define SUFFIX _T("*")
|
||||||
#define SLASH _T("\\")
|
#define SLASH _T("\\")
|
||||||
|
|
||||||
|
struct __dirstream_t
|
||||||
|
{
|
||||||
|
/* Actual (private) declaration for opaque data type "DIR". */
|
||||||
|
|
||||||
|
/* disk transfer area for this dir */
|
||||||
|
struct _finddata_t dd_dta;
|
||||||
|
|
||||||
|
/* dirent struct to return from dir (NOTE: this makes this thread
|
||||||
|
* safe as long as only one thread uses a particular DIR struct at
|
||||||
|
* a time) */
|
||||||
|
struct dirent dd_dir;
|
||||||
|
|
||||||
|
/* _findnext handle */
|
||||||
|
intptr_t dd_handle;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Status of search:
|
||||||
|
* (type is now int -- was short in older versions).
|
||||||
|
* 0 = not started yet (next entry to read is first entry)
|
||||||
|
* -1 = off the end
|
||||||
|
* positive = 0 based index of next entry
|
||||||
|
*/
|
||||||
|
int dd_stat;
|
||||||
|
|
||||||
|
/* given path for dir with search pattern (struct is extended) */
|
||||||
|
char dd_name[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct __wdirstream_t
|
||||||
|
{
|
||||||
|
/* Actual (private) declaration for opaque data type "_WDIR". */
|
||||||
|
|
||||||
|
/* disk transfer area for this dir */
|
||||||
|
struct _wfinddata_t dd_dta;
|
||||||
|
|
||||||
|
/* dirent struct to return from dir (NOTE: this makes this thread
|
||||||
|
* safe as long as only one thread uses a particular DIR struct at
|
||||||
|
* a time) */
|
||||||
|
struct _wdirent dd_dir;
|
||||||
|
|
||||||
|
/* _findnext handle */
|
||||||
|
intptr_t dd_handle;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Status of search:
|
||||||
|
* 0 = not started yet (next entry to read is first entry)
|
||||||
|
* -1 = off the end
|
||||||
|
* positive = 0 based index of next entry
|
||||||
|
*/
|
||||||
|
int dd_stat;
|
||||||
|
|
||||||
|
/* given path for dir with search pattern (struct is extended) */
|
||||||
|
wchar_t dd_name[1];
|
||||||
|
};
|
||||||
|
|
||||||
/* Helper for opendir(). */
|
/* Helper for opendir(). */
|
||||||
static inline unsigned _tGetFileAttributes (const _TCHAR * tPath)
|
static inline unsigned _tGetFileAttributes (const _TCHAR * tPath)
|
||||||
|
|
Loading…
Reference in New Issue