diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
commit | 99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch) | |
tree | bda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/ace/OS_NS_wchar.inl | |
parent | c4078c377d74290ebe4e66da0b4975da91732376 (diff) | |
download | ATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz |
undoing accidental deletion
Diffstat (limited to 'ACE/ace/OS_NS_wchar.inl')
-rw-r--r-- | ACE/ace/OS_NS_wchar.inl | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/ACE/ace/OS_NS_wchar.inl b/ACE/ace/OS_NS_wchar.inl new file mode 100644 index 00000000000..7f2abac8d8f --- /dev/null +++ b/ACE/ace/OS_NS_wchar.inl @@ -0,0 +1,87 @@ +// -*- C++ -*- +// +// $Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE wint_t +ACE_OS::fgetwc (FILE* fp) +{ +# if defined (ACE_LACKS_FGETWC) + ACE_UNUSED_ARG (fp); + ACE_NOTSUP_RETURN (0); +# else + ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetwc (fp), wint_t, WEOF); +# endif /* ACE_LACKS_FGETWC */ +} +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE u_int +ACE_OS::wslen (const WChar *s) +{ + u_int len = 0; + + while (*s++ != 0) + len++; + + return len; +} + +ACE_INLINE ACE_OS::WChar * +ACE_OS::wscpy (WChar *dest, const WChar *src) +{ + WChar *original_dest = dest; + + while ((*dest++ = *src++) != 0) + continue; + + return original_dest; +} + +ACE_INLINE int +ACE_OS::wscmp (const WChar *s, const WChar *t) +{ + const WChar *scan1 = s; + const WChar *scan2 = t; + + while (*scan1 != 0 && *scan1 == *scan2) + { + ++scan1; + ++scan2; + } + + return *scan1 - *scan2; +} + +ACE_INLINE int +ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len) +{ + const WChar *scan1 = s; + const WChar *scan2 = t; + + while (len != 0 && *scan1 != 0 && *scan1 == *scan2) + { + ++scan1; + ++scan2; + --len; + } + + return len == 0 ? 0 : *scan1 - *scan2; +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE wint_t +ACE_OS::ungetwc (wint_t c, FILE* fp) +{ +# if defined (ACE_LACKS_FGETWC) + ACE_UNUSED_ARG (c); + ACE_UNUSED_ARG (fp); + ACE_NOTSUP_RETURN (0); +# else + ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ungetwc (c, fp), wint_t, WEOF); +# endif /* ACE_LACKS_FGETWC */ +} +#endif /* ACE_HAS_WCHAR */ + +ACE_END_VERSIONED_NAMESPACE_DECL |