Skip to content

Commit

Permalink
Merge pull request #2261 from jwillemsen/jwi-bcc64xunicode
Browse files Browse the repository at this point in the history
bcc64x has different dirent support in unicode
  • Loading branch information
jwillemsen authored Jul 26, 2024
2 parents e69db0c + 1e38fc4 commit b2770e6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 25 deletions.
4 changes: 2 additions & 2 deletions ACE/ace/OS_NS_dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" {
* using the pre-processor.
*/
#if !defined (ACE_LACKS_REWINDDIR)
# if !defined (ACE_HAS_WREWINDDIR) || !defined (ACE_USES_WCHAR)
# if !defined (ACE_HAS_WREWINDDIR_EQUIVALENT) || !defined (ACE_USES_WCHAR)
inline void ace_rewinddir_helper (ACE_DIR *dir)
{
# if defined (rewinddir)
Expand All @@ -63,7 +63,7 @@ inline void ace_rewinddir_helper (ACE_DIR *dir)
# endif /* defined (rewinddir) */
}
# endif /* !defined (ACE_HAS_WREWINDDIR) && !defined (ACE_USES_WCHAR) */
#endif /* ACE_LACKS_REWINDDIR */
#endif /* ACE_HAS_WREWINDDIR_EQUIVALENT */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down
16 changes: 8 additions & 8 deletions ACE/ace/OS_NS_dirent.inl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ closedir (ACE_DIR *d)
ACE_OS::closedir_emulation (d);
delete [] d->directory_name_;
delete d;
# elif defined (ACE_HAS_WCLOSEDIR) && defined (ACE_USES_WCHAR)
::wclosedir (d);
# elif defined (ACE_HAS_WCLOSEDIR_EQUIVALENT) && defined (ACE_USES_WCHAR)
ACE_HAS_WCLOSEDIR_EQUIVALENT (d);
# else /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
::closedir (d);
# endif /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
Expand All @@ -35,8 +35,8 @@ opendir (const ACE_TCHAR *filename)
#if defined (ACE_HAS_DIRENT)
# if (defined (ACE_WIN32) || defined(ACE_MQX)) && defined (ACE_LACKS_OPENDIR)
return ::ACE_OS::opendir_emulation (filename);
# elif defined (ACE_HAS_WOPENDIR) && defined (ACE_USES_WCHAR)
return ::wopendir (filename);
# elif defined (ACE_HAS_WOPENDIR_EQUIVALENT) && defined (ACE_USES_WCHAR)
return ACE_HAS_WOPENDIR_EQUIVALENT (filename);
# else /* ! ACE_WIN32 && ACE_LACKS_OPENDIR */
return ::opendir (ACE_TEXT_ALWAYS_CHAR (filename));
# endif /* ACE_WIN32 && ACE_LACKS_OPENDIR */
Expand All @@ -52,8 +52,8 @@ readdir (ACE_DIR *d)
#if defined (ACE_HAS_DIRENT)
# if (defined (ACE_WIN32) || defined (ACE_MQX)) && defined (ACE_LACKS_READDIR)
return ACE_OS::readdir_emulation (d);
# elif defined (ACE_HAS_WREADDIR) && defined (ACE_USES_WCHAR)
return ::wreaddir (d);
# elif defined (ACE_HAS_WREADDIR_EQUIVALENT) && defined (ACE_USES_WCHAR)
return ACE_HAS_WREADDIR_EQUIVALENT (d);
# else /* ACE_WIN32 && ACE_LACKS_READDIR */
return ::readdir (d);
# endif /* ACE_WIN32 && ACE_LACKS_READDIR */
Expand All @@ -67,8 +67,8 @@ ACE_INLINE void
rewinddir (ACE_DIR *d)
{
#if defined (ACE_HAS_DIRENT)
# if defined (ACE_HAS_WREWINDDIR) && defined (ACE_USES_WCHAR)
::wrewinddir (d);
# if defined (ACE_HAS_WREWINDDIR_EQUIVALENT) && defined (ACE_USES_WCHAR)
ACE_HAS_WREWINDDIR_EQUIVALENT (d);
# elif !defined (ACE_LACKS_REWINDDIR)
ace_rewinddir_helper (d);
# else
Expand Down
18 changes: 9 additions & 9 deletions ACE/ace/OS_NS_time.inl
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ ACE_OS::ctime (const time_t *t)
// we've done this before, free the previous one. Yes, this leaves a
// small memory leak (26 characters) but there's no way around this
// that I know of. (Steve Huston, 12-Feb-2003).
static wchar_t *wide_time = 0;
if (wide_time != 0)
static wchar_t *wide_time = nullptr;
if (wide_time != nullptr)
delete [] wide_time;
wide_time = ACE_Ascii_To_Wide::convert (narrow_time);
return wide_time;
Expand All @@ -124,7 +124,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)

#if defined (ACE_HAS_REENTRANT_FUNCTIONS)

char *bufp = 0;
char *bufp = nullptr;
# if defined (ACE_USES_WCHAR)
char narrow_buf[ctime_buf_size];
bufp = narrow_buf;
Expand All @@ -149,8 +149,8 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)

# endif /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */

if (bufp == 0)
return 0;
if (bufp == nullptr)
return nullptr;

# if defined (ACE_USES_WCHAR)
ACE_Ascii_To_Wide wide_buf (bufp);
Expand All @@ -164,7 +164,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
if (buflen < ctime_buf_size)
{
errno = ERANGE;
return 0;
return nullptr;
}
ACE_TCHAR *result = buf;
# if defined (ACE_USES_WCHAR)
Expand All @@ -178,16 +178,16 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
if (buflen < ctime_buf_size)
{
errno = ERANGE;
return 0;
return nullptr;
}

ACE_TCHAR *result = 0;
ACE_TCHAR *result = nullptr;
# if defined (ACE_USES_WCHAR)
ACE_OSCALL (::_wctime (t), wchar_t *, result);
# else /* ACE_USES_WCHAR */
ACE_OSCALL (::ctime (t), char *, result);
# endif /* ACE_USES_WCHAR */
if (result != 0)
if (result != nullptr)
ACE_OS::strsncpy (buf, result, buflen);
return buf;
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
Expand Down
15 changes: 11 additions & 4 deletions ACE/ace/config-win32-borland.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,17 @@

#undef ACE_LACKS_REWINDDIR

#define ACE_HAS_WOPENDIR
#define ACE_HAS_WCLOSEDIR
#define ACE_HAS_WREADDIR
#define ACE_HAS_WREWINDDIR
#if !defined (__MINGW64__)
# define ACE_HAS_WOPENDIR_EQUIVALENT ::wopendir
# define ACE_HAS_WCLOSEDIR_EQUIVALENT ::wclosedir
# define ACE_HAS_WREADDIR_EQUIVALENT ::wreaddir
# define ACE_HAS_WREWINDDIR_EQUIVALENT ::wrewinddir
#else
# define ACE_HAS_WOPENDIR_EQUIVALENT ::_wopendir
# define ACE_HAS_WCLOSEDIR_EQUIVALENT ::_wclosedir
# define ACE_HAS_WREADDIR_EQUIVALENT ::_wreaddir
# define ACE_HAS_WREWINDDIR_EQUIVALENT ::_wrewinddir
#endif

#define ACE_LACKS_STRRECVFD

Expand Down
7 changes: 6 additions & 1 deletion ACE/ace/os_include/os_dirent.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ struct ACE_DIR {
};
#elif defined (ACE_WIN32) && (__BORLANDC__) && defined (ACE_USES_WCHAR)
#define ACE_HAS_TCHAR_DIRENT
#define ACE_DIRENT wdirent
#if defined(__MINGW64__)
# define ACE_DIRENT _wdirent
typedef _WDIR ACE_DIR;
#else
# define ACE_DIRENT wdirent
typedef wDIR ACE_DIR;
#endif
#else
#define ACE_DIRENT dirent
typedef DIR ACE_DIR;
Expand Down
1 change: 0 additions & 1 deletion ACE/bin/MakeProjectCreator/config/acedefaults.mpb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ project: ipv6, vc_warnings, build_files, test_files, svc_conf_files, ace_unicode
// Support the alternative Borland Make project type
specific(bmake) {
unicode_flags += -DACE_USES_WCHAR
macros += MPC_LIB_MODIFIER=\\"$(LIBMODIFIER)$(ULIBMODIFIER)\\"
debug_macros += ACE_NO_INLINE=1
platform_libs += iphlpapi
lit_libs -= iphlpapi
Expand Down

0 comments on commit b2770e6

Please sign in to comment.