diff options
Diffstat (limited to 'ace/OS_NS_dirent.cpp')
-rw-r--r-- | ace/OS_NS_dirent.cpp | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/ace/OS_NS_dirent.cpp b/ace/OS_NS_dirent.cpp index 57446ce5364..9b58d284683 100644 --- a/ace/OS_NS_dirent.cpp +++ b/ace/OS_NS_dirent.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_dirent.h" @@ -42,6 +41,8 @@ extern "C" # endif /* INVALID_SET_FILE_POINTER */ #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_OS::closedir_emulation (ACE_DIR *d) { @@ -121,7 +122,7 @@ ACE_OS::opendir_emulation (const ACE_TCHAR *filename) #endif /* WIN32 && ACE_LACKS_OPENDIR */ } -dirent * +struct ACE_DIRENT * ACE_OS::readdir_emulation (ACE_DIR *d) { #if defined (ACE_WIN32) && defined (ACE_LACKS_READDIR) @@ -152,8 +153,8 @@ ACE_OS::readdir_emulation (ACE_DIR *d) if (d->current_handle_ != INVALID_HANDLE_VALUE) { - d->dirent_ = (dirent *) - ACE_OS::malloc (sizeof (dirent)); + d->dirent_ = (ACE_DIRENT *) + ACE_OS::malloc (sizeof (ACE_DIRENT)); if (d->dirent_ != 0) { @@ -161,7 +162,7 @@ ACE_OS::readdir_emulation (ACE_DIR *d) ACE_OS::malloc ((ACE_OS::strlen (d->fdata_.cFileName) + 1) * sizeof (ACE_TCHAR)); ACE_OS::strcpy (d->dirent_->d_name, d->fdata_.cFileName); - d->dirent_->d_reclen = sizeof (dirent); + d->dirent_->d_reclen = sizeof (ACE_DIRENT); } return d->dirent_; @@ -176,10 +177,10 @@ ACE_OS::readdir_emulation (ACE_DIR *d) int ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, - dirent **namelist[], - int (*selector) (const dirent *entry), - int (*comparator) (const dirent **f1, - const dirent **f2)) + ACE_DIRENT **namelist[], + int (*selector) (const ACE_DIRENT *entry), + int (*comparator) (const ACE_DIRENT **f1, + const ACE_DIRENT **f2)) { ACE_DIR *dirp = ACE_OS::opendir (dirname); @@ -189,8 +190,8 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, else if (namelist == 0) return -1; - dirent **vector = 0; - dirent *dp; + ACE_DIRENT **vector = 0; + ACE_DIRENT *dp = 0; int arena_size = 0; int nfiles = 0; @@ -207,14 +208,14 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, // If we get here, we have a dirent that the user likes. if (nfiles == arena_size) { - dirent **newv; + ACE_DIRENT **newv = 0; if (arena_size == 0) arena_size = 10; else arena_size *= 2; - newv = (dirent **) ACE_OS::realloc (vector, - arena_size * sizeof (dirent *)); + newv = (ACE_DIRENT **) ACE_OS::realloc (vector, + arena_size * sizeof (ACE_DIRENT *)); if (newv == 0) { fail = 1; @@ -224,12 +225,12 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, } #if defined (ACE_LACKS_STRUCT_DIR) - dirent *newdp = (dirent *) ACE_OS::malloc (sizeof (dirent)); + ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (sizeof (ACE_DIRENT)); #else size_t dsize = - sizeof (dirent) + + sizeof (ACE_DIRENT) + ((ACE_OS::strlen (dp->d_name) + 1) * sizeof (ACE_TCHAR)); - dirent *newdp = (dirent *) ACE_OS::malloc (dsize); + ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (dsize); #endif /* ACE_LACKS_STRUCT_DIR */ if (newdp == 0) @@ -256,7 +257,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, ACE_OS::strcpy (newdp->d_name, dp->d_name); vector[nfiles++] = newdp; #else - vector[nfiles++] = (dirent *) ACE_OS::memcpy (newdp, dp, dsize); + vector[nfiles++] = (ACE_DIRENT *) ACE_OS::memcpy (newdp, dp, dsize); #endif /* ACE_LACKS_STRUCT_DIR */ } @@ -281,8 +282,10 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, if (comparator) ACE_OS::qsort (*namelist, nfiles, - sizeof (dirent *), + sizeof (ACE_DIRENT *), (ACE_SCANDIR_COMPARATOR) comparator); return nfiles; } + +ACE_END_VERSIONED_NAMESPACE_DECL |