From aaae4123b9bcdf0a3d5d006fcb7daf10a1d95fbc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 24 Mar 2011 15:39:27 +1100 Subject: unistr: moved some UCS2 macros into util_unistr we need to move towards eliminating smb_ucs2_t. This moves a couple of the related macros into the only file they are used in Pair-Programmed-With: Andrew Bartlett --- source3/lib/util_unistr.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/lib/util_unistr.c') diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 14b5a8706b..7beb65c863 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -30,6 +30,15 @@ static uint8 *valid_table; static bool initialized; +/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */ +#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\ + ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest)) + + +/* return an ascii version of a ucs2 character */ +#define UCS2_TO_CHAR(c) (((c) >> UCS2_SHIFT) & 0xff) + + /** * Destroy global objects allocated by load_case_tables() **/ -- cgit