Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB

  1. /***
  2. *wcslen.c - contains wcslen() routine
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * wcslen returns the length of a null-terminated wide-character string,
  8. * not including the null wchar_t itself.
  9. *
  10. *Revision History:
  11. * 09-09-91 ETC Created from strlen.c.
  12. * 04-07-92 KRS Updated and ripped out _INTL switches.
  13. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  14. * 02-07-94 CFW POSIXify.
  15. *
  16. *******************************************************************************/
  17. #ifndef _POSIX_
  18. #include <cruntime.h>
  19. #include <string.h>
  20. #if defined(_M_IA64)
  21. #pragma warning(disable:4163)
  22. #pragma function(wcslen)
  23. #endif
  24. /***
  25. *wcslen - return the length of a null-terminated wide-character string
  26. *
  27. *Purpose:
  28. * Finds the length in wchar_t's of the given string, not including
  29. * the final null wchar_t (wide-characters).
  30. *
  31. *Entry:
  32. * const wchar_t * wcs - string whose length is to be computed
  33. *
  34. *Exit:
  35. * length of the string "wcs", exclusive of the final null wchar_t
  36. *
  37. *Exceptions:
  38. *
  39. *******************************************************************************/
  40. size_t __cdecl wcslen (
  41. const wchar_t * wcs
  42. )
  43. {
  44. const wchar_t *eos = wcs;
  45. while( *eos++ ) ;
  46. return( (size_t)(eos - wcs - 1) );
  47. }
  48. #endif /* _POSIX_ */