UaStrFnc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994-1999.
  5. //
  6. // File: uastrfnc.h
  7. //
  8. // Contents: Unaligned UNICODE lstr functions for MIPS, PPC, ALPHA, ...
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. //
  15. //--------------------------------------------------------------------------
  16. // NOTE: This file assumes it is included from shellprv.h
  17. #ifndef _UASTRFNC_H_
  18. #define _UASTRFNC_H_
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. // If we are running on a platform that requires aligned data, we need
  23. // to provide custom string functions that can deal with unaligned
  24. // strings. On other platforms, these call directly to the normal string
  25. // functions.
  26. #ifndef _X86_
  27. #define ALIGNMENT_MACHINE
  28. #endif
  29. #ifdef ALIGNMENT_MACHINE
  30. #define IS_ALIGNED(p) (((ULONG_PTR)(p) & (sizeof(*(p))-1) )==0)
  31. UNALIGNED WCHAR * ualstrcpynW(UNALIGNED WCHAR * lpString1,
  32. UNALIGNED const WCHAR * lpString2,
  33. int iMaxLength);
  34. int ualstrcmpiW (UNALIGNED const WCHAR * dst,
  35. UNALIGNED const WCHAR * src);
  36. int ualstrcmpW (UNALIGNED const WCHAR * src,
  37. UNALIGNED const WCHAR * dst);
  38. size_t ualstrlenW (UNALIGNED const WCHAR * wcs);
  39. UNALIGNED WCHAR * ualstrcpyW (UNALIGNED WCHAR * dst,
  40. UNALIGNED const WCHAR * src);
  41. #else
  42. #define ualstrcpynW StrCpyNW // lstrcpynW is stubbed out on Windows 95
  43. #define ualstrcmpiW StrCmpIW // lstrcmpiW is stubbed out on Windows 95
  44. #define ualstrcmpW StrCmpW // lstrcmpW is stubbed out on Windows 95
  45. #define ualstrlenW lstrlenW
  46. #define ualstrcpyW StrCpyW // lstrcpyW is stubbed out on Windows 95
  47. #endif // ALIGNMENT_MACHINE
  48. #define ualstrcpynA lstrcpynA
  49. #define ualstrcmpiA lstrcmpiA
  50. #define ualstrcmpA lstrcmpA
  51. #define ualstrlenA lstrlenA
  52. #define ualstrcpyA lstrcpyA
  53. #ifdef UNICODE
  54. #define ualstrcpyn ualstrcpynW
  55. #define ualstrcmpi ualstrcmpiW
  56. #define ualstrcmp ualstrcmpW
  57. #define ualstrlen ualstrlenW
  58. #define ualstrcpy ualstrcpyW
  59. #else
  60. #define ualstrcpyn ualstrcpynA
  61. #define ualstrcmpi ualstrcmpiA
  62. #define ualstrcmp ualstrcmpA
  63. #define ualstrlen ualstrlenA
  64. #define ualstrcpy ualstrcpyA
  65. #endif
  66. #ifdef __cplusplus
  67. } // extern "C"
  68. #endif
  69. #endif // _UASTRFNC_H_