mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
2005-04-23 Wu Yongwei <adah@sh163.net>
mingwex/dirent.c: Formatting changes. mingwex/dirent.c (_topendir): Make the end-of-path slash check MBCS-safe.
This commit is contained in:
parent
bc79d16453
commit
4fc953d6a1
@ -1,3 +1,10 @@
|
|||||||
|
2005-04-23 Wu Yongwei <adah@sh163.net>
|
||||||
|
|
||||||
|
mingwex/dirent.c: Formatting changes.
|
||||||
|
|
||||||
|
mingwex/dirent.c (_topendir): Make the end-of-path slash check
|
||||||
|
MBCS-safe.
|
||||||
|
|
||||||
2005-03-31 Danny Smith <dannysmith@users.sourceforge.net>
|
2005-03-31 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
* include/_mingw.h (__MINGW_ATTRIB_NONNULL): Define.
|
* include/_mingw.h (__MINGW_ATTRIB_NONNULL): Define.
|
||||||
|
@ -75,8 +75,10 @@ _topendir (const _TCHAR *szPath)
|
|||||||
|
|
||||||
/* Allocate enough space to store DIR structure and the complete
|
/* Allocate enough space to store DIR structure and the complete
|
||||||
* directory path given. */
|
* directory path given. */
|
||||||
nd = (_TDIR *) malloc (sizeof (_TDIR) + (_tcslen(szFullPath) + _tcslen (SLASH) +
|
nd = (_TDIR *) malloc (sizeof (_TDIR) + (_tcslen (szFullPath)
|
||||||
_tcslen(SUFFIX) + 1) * sizeof(_TCHAR));
|
+ _tcslen (SLASH)
|
||||||
|
+ _tcslen (SUFFIX) + 1)
|
||||||
|
* sizeof (_TCHAR));
|
||||||
|
|
||||||
if (!nd)
|
if (!nd)
|
||||||
{
|
{
|
||||||
@ -89,9 +91,11 @@ _topendir (const _TCHAR *szPath)
|
|||||||
_tcscpy (nd->dd_name, szFullPath);
|
_tcscpy (nd->dd_name, szFullPath);
|
||||||
|
|
||||||
/* Add on a slash if the path does not end with one. */
|
/* Add on a slash if the path does not end with one. */
|
||||||
if (nd->dd_name[0] != _T('\0') &&
|
if (nd->dd_name[0] != _T('\0')
|
||||||
nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('/') &&
|
&& _tcsrchr (nd->dd_name, _T('/')) != nd->dd_name
|
||||||
nd->dd_name[_tcslen (nd->dd_name) - 1] != _T('\\'))
|
+ _tcslen (nd->dd_name) - 1
|
||||||
|
&& _tcsrchr (nd->dd_name, _T('\\')) != nd->dd_name
|
||||||
|
+ _tcslen (nd->dd_name) - 1)
|
||||||
{
|
{
|
||||||
_tcscat (nd->dd_name, SLASH);
|
_tcscat (nd->dd_name, SLASH);
|
||||||
}
|
}
|
||||||
@ -148,7 +152,7 @@ _treaddir (_TDIR * dirp)
|
|||||||
/* Start the search */
|
/* Start the search */
|
||||||
dirp->dd_handle = _tfindfirst (dirp->dd_name, &(dirp->dd_dta));
|
dirp->dd_handle = _tfindfirst (dirp->dd_name, &(dirp->dd_dta));
|
||||||
|
|
||||||
if (dirp->dd_handle == -1)
|
if (dirp->dd_handle == -1)
|
||||||
{
|
{
|
||||||
/* Whoops! Seems there are no files in that
|
/* Whoops! Seems there are no files in that
|
||||||
* directory. */
|
* directory. */
|
||||||
@ -167,7 +171,7 @@ _treaddir (_TDIR * dirp)
|
|||||||
/* We are off the end or otherwise error.
|
/* We are off the end or otherwise error.
|
||||||
_findnext sets errno to ENOENT if no more file
|
_findnext sets errno to ENOENT if no more file
|
||||||
Undo this. */
|
Undo this. */
|
||||||
DWORD winerr = GetLastError();
|
DWORD winerr = GetLastError ();
|
||||||
if (winerr == ERROR_NO_MORE_FILES)
|
if (winerr == ERROR_NO_MORE_FILES)
|
||||||
errno = 0;
|
errno = 0;
|
||||||
_findclose (dirp->dd_handle);
|
_findclose (dirp->dd_handle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user