From 2302957c535e3507b5c8920ab93c3dea7bf82f4a Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Wed, 18 Jun 2003 13:54:47 +0000 Subject: [PATCH] * include/dirent.h (dirent): Make d_name and array instead of a pointer. * mingwex/dirent.c: Modifications througout to fill d_name array. * Makefile.in (LIBS): Add new MSVCRT libraries libmsvcr70 and libmsvcr71, including debug versions. (msvcr70.def, msvcr70d.def, msvcr71.def, msvcr71.def): New targets. --- winsup/mingw/Makefile.in | 16 +++++++++++++--- winsup/mingw/include/dirent.h | 6 ++---- winsup/mingw/mingwex/dirent.c | 12 +++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/winsup/mingw/Makefile.in b/winsup/mingw/Makefile.in index 0404d84b4..dd7a951be 100644 --- a/winsup/mingw/Makefile.in +++ b/winsup/mingw/Makefile.in @@ -157,8 +157,15 @@ MINGW_OBJS = CRTglob.o CRTfmode.o CRTinit.o dllmain.o gccmain.o \ MOLD_OBJS = isascii.o iscsym.o iscsymf.o toascii.o \ strcasecmp.o strncasecmp.o wcscmpi.o -LIBS = libcrtdll.a libmsvcrt.a libmsvcrtd.a libmingw32.a \ - libcoldname.a libmoldname.a libmoldnamed.a $(LIBM_A) libmingwthrd.a +LIBS = libcrtdll.a \ + libmsvcrt.a libmsvcrtd.a \ + libmsvcr70.a libmsvcr70d.a \ + libmsvcr71.a libmsvcr71d.a \ + libmingw32.a \ + libcoldname.a \ + libmoldname.a libmoldnamed.a \ + $(LIBM_A) \ + libmingwthrd.a DLLS = $(THREAD_DLL_NAME) @@ -234,7 +241,10 @@ libmingw32.a: $(MINGW_OBJS) $(AR) rc $@ $(MINGW_OBJS) $(RANLIB) $@ -msvcrt.def msvcrtd.def: msvcrt.def.in +msvcrt.def msvcrtd.def \ +msvcr70.def msvcr70d.def \ +msvcr71.def msvcr71d.def \ +: msvcrt.def.in $(CC) -DRUNTIME=$(basename $(notdir $@)) \ -D__FILENAME__=$@ \ -D__MSVCRT__ -C -E -P \ diff --git a/winsup/mingw/include/dirent.h b/winsup/mingw/include/dirent.h index 5a9246a4a..4e787d841 100644 --- a/winsup/mingw/include/dirent.h +++ b/winsup/mingw/include/dirent.h @@ -42,9 +42,7 @@ struct dirent long d_ino; /* Always zero. */ unsigned short d_reclen; /* Always zero. */ unsigned short d_namlen; /* Length of name in d_name. */ - char* d_name; /* File name. */ - /* NOTE: The name in the dirent structure points to the name in the - * finddata_t structure in the DIR. */ + char d_name[FILENAME_MAX]; /* File name. */ }; /* @@ -92,7 +90,7 @@ struct _wdirent long d_ino; /* Always zero. */ unsigned short d_reclen; /* Always zero. */ unsigned short d_namlen; /* Length of name in d_name. */ - wchar_t* d_name; /* File name. */ + wchar_t d_name[FILENAME_MAX]; /* File name. */ /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ }; diff --git a/winsup/mingw/mingwex/dirent.c b/winsup/mingw/mingwex/dirent.c index cdca6de35..20d1921d7 100644 --- a/winsup/mingw/mingwex/dirent.c +++ b/winsup/mingw/mingwex/dirent.c @@ -113,7 +113,7 @@ _topendir (const _TCHAR *szPath) nd->dd_dir.d_ino = 0; nd->dd_dir.d_reclen = 0; nd->dd_dir.d_namlen = 0; - nd->dd_dir.d_name = nd->dd_dta.name; + memset (nd->dd_dir.d_name, 0, FILENAME_MAX); return nd; } @@ -137,13 +137,6 @@ _treaddir (_TDIR * dirp) return (struct _tdirent *) 0; } - if (dirp->dd_dir.d_name != dirp->dd_dta.name) - { - /* The structure does not seem to be set up correctly. */ - errno = EINVAL; - return (struct _tdirent *) 0; - } - if (dirp->dd_stat < 0) { /* We have already returned all files in the directory @@ -190,7 +183,8 @@ _treaddir (_TDIR * dirp) /* Successfully got an entry. Everything about the file is * already appropriately filled in except the length of the * file name. */ - dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dir.d_name); + dirp->dd_dir.d_namlen = _tcslen (dirp->dd_dta.name); + _tcscpy (dirp->dd_dir.d_name, dirp->dd_dta.name); return &dirp->dd_dir; }