diff --git a/src/builtin_functions.c b/src/builtin_functions.c index b596e15243e1e214b46e9059e41964090cc887fa..f6d874658eadc948e827859abc10ef89c845fbc2 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.133 1998/10/15 18:47:51 grubba Exp $"); +RCSID("$Id: builtin_functions.c,v 1.134 1998/10/15 18:54:31 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -636,8 +636,8 @@ void f_string_to_unicode(INT32 args) p_wchar1 *str1 = STR1(in); for(i = in->len; i--;) { unsigned INT32 c = str1[i]; - out->str[i * 2] = c >> 8; out->str[i * 2 + 1] = c & 0xff; + out->str[i * 2] = c >> 8; } } #endif @@ -736,7 +736,8 @@ void f_unicode_to_string(INT32 args) p_wchar1 *str1 = STR1(out); for (i = len; i--;) { - str1[i] = (in->str[i*2]<<8) + in->str[i*2 + 1]; + str1[i] = (((unsigned char *)in->str)[i*2]<<8) + + ((unsigned char *)in->str)[i*2 + 1]; } } #endif /* BYTEORDER == 4321 */