Source code of Windows XP (NT5)
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.

69 lines
1014 B

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. wcsfuncs.c
  5. Abstract:
  6. Temporary unicode-only string functions until languages supply
  7. real run-times
  8. _wcsnicmp
  9. towupper
  10. iswalpha
  11. iswdigit
  12. _wcsupr
  13. wcstomb
  14. Author:
  15. Richard L Firth (rfirth) 09-Mar-1992
  16. Revision History:
  17. --*/
  18. #ifdef UNICODE
  19. #include <windows.h>
  20. #include <ctype.h>
  21. int _wcsnicmp(LPWSTR s1, LPWSTR s2, DWORD len) {
  22. int result = 0;
  23. while (*s1 && *s2 && !(result = (toupper(*s1) - toupper(*s2))) && len) {
  24. ++s1;
  25. ++s2;
  26. --len;
  27. }
  28. return result;
  29. }
  30. #if 0
  31. int iswalpha(WCHAR ch) {
  32. return isalpha(ch);
  33. }
  34. int iswdigit(WCHAR ch) {
  35. return isdigit(ch);
  36. }
  37. #endif
  38. LPWSTR _wcsupr(LPWSTR str) {
  39. LPWSTR start = str;
  40. while (*str) {
  41. *str = toupper(*str);
  42. ++str;
  43. }
  44. return start;
  45. }
  46. int wcstomb(LPSTR str, LPWSTR wstr) {
  47. while (*wstr) {
  48. *str++ = (char)*wstr++;
  49. }
  50. return 0; //?
  51. }
  52. #endif
  53.