From 6e23d00099312495addb7639d7062aab71a9cbfe Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 12 Oct 2011 19:43:09 -0700 Subject: Bug #34538 * lib.h (wli): This macro now does the pointer displacement by 1. (auto_str, static_str): #if/#else/#endif gone. These functions just add the type tag. The + 1 logic was incorrect; it should have been + sizeof(wchar_t). But even that was not right because other code expects a wchli_t * to point to the first character, such as the string_out_put_char function. --- ChangeLog | 11 +++++++++++ lib.h | 10 +--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9f9119a..4f7746d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-10-12 Kaz Kylheku + + Bug #34538 + + * lib.h (wli): This macro now does the pointer displacement by 1. + (auto_str, static_str): #if/#else/#endif gone. These functions just + add the type tag. The + 1 logic was incorrect; it should have + been + sizeof(wchar_t). But even that was not right because other + code expects a wchli_t * to point to the first character, + such as the string_out_put_char function. + 2011-10-10 Kaz Kylheku Improved support for broken unicode. diff --git a/lib.h b/lib.h index 235ab169..7255e4f1 100644 --- a/lib.h +++ b/lib.h @@ -191,7 +191,7 @@ INLINE type_t type(val obj) typedef struct wli wchli_t; #if LIT_ALIGN < 4 -#define wli(lit) ((const wchli_t *) L"\0" L ## lit L"\0") +#define wli(lit) ((const wchli_t *) (L"\0" L ## lit L"\0" + 1)) #define wini(ini) L"\0" L ## ini L"\0" #define wref(arr) ((arr) + 1) #else @@ -202,20 +202,12 @@ typedef struct wli wchli_t; INLINE val auto_str(const wchli_t *str) { -#if LIT_ALIGN < 4 - return (val) (((cnum) str + 1) | TAG_LIT); -#else return (val) (((cnum) str) | TAG_LIT); -#endif } INLINE val static_str(const wchli_t *str) { -#if LIT_ALIGN < 4 - return (val) (((cnum) str + 1) | TAG_LIT); -#else return (val) (((cnum) str) | TAG_LIT); -#endif } INLINE wchar_t *litptr(val obj) -- cgit v1.2.3