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.

82 lines
1.7 KiB

  1. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  2. //
  3. // string.cpp
  4. //
  5. // String functions used by cdfview that are not in shlwapi.h.
  6. //
  7. // History:
  8. //
  9. // 5/15/97 edwardp Created.
  10. //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // Includes
  14. //
  15. #include "stdinc.h"
  16. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  17. //
  18. // *** StrEqlA ***
  19. //
  20. // Compares two ANSI strings for equality.
  21. //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. BOOL
  24. StrEqlA(LPCSTR p1, LPCSTR p2)
  25. {
  26. ASSERT(p1);
  27. ASSERT(p2);
  28. while ((*p1 == *p2) && *p1 && *p2)
  29. {
  30. p1++; p2++;
  31. }
  32. return (*p1 == *p2);
  33. }
  34. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  35. //
  36. // *** StrEqlW ***
  37. //
  38. // Compares two WIDE strings for equality.
  39. //
  40. ////////////////////////////////////////////////////////////////////////////////
  41. BOOL
  42. StrEqlW(LPCWSTR p1, LPCWSTR p2)
  43. {
  44. ASSERT(p1);
  45. ASSERT(p2);
  46. while ((*p1 == *p2) && *p1 && *p2)
  47. {
  48. p1++; p2++;
  49. }
  50. return (*p1 == *p2);
  51. }
  52. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  53. //
  54. // *** StrLocallyDisplayable ***
  55. //
  56. // Determines if the given wide char string can be displayed on the current
  57. // system.
  58. //
  59. ////////////////////////////////////////////////////////////////////////////////
  60. BOOL
  61. StrLocallyDisplayable(
  62. LPCWSTR pwsz
  63. )
  64. {
  65. ASSERT(pwsz);
  66. BOOL fRet = FALSE;
  67. if (0 == WideCharToMultiByte(CP_ACP, 0, pwsz, -1, NULL, 0, NULL, &fRet))
  68. fRet = TRUE;
  69. return !fRet;
  70. }