pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.595 2005/04/02 12:24:43 mast Exp $ + || $Id: builtin_functions.c,v 1.596 2005/04/02 15:06:02 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin_functions.c:2099:    if (len == in->len) {    /* 7bit in == 7bit out */    pop_n_elems(args-1);    return;    }       out = begin_wide_shared_string(len, shift);       switch (shift) {    case 0: { -  p_wchar0 *out_str = (p_wchar0 *) out->str; +  p_wchar0 *out_str = STR0 (out);    for(j=i=0; i < in->len;) {    unsigned int c = STR0(in)[i++];    /* NOTE: No tests here since we've already tested the string above. */    if (c & 0x80) {    /* 11bit */    unsigned int c2 = STR0(in)[i++] & 0x3f;    c &= 0x1f;    c = (c << 6) | c2;    }    out_str[j++] = c;    }    break;    }       case 1: { -  p_wchar1 *out_str = (p_wchar1 *) out->str; +  p_wchar1 *out_str = STR1 (out);    for(j=i=0; i < in->len;) {    unsigned int c = STR0(in)[i++];    /* NOTE: No tests here since we've already tested the string above. */    if (c & 0x80) {    if ((c & 0xe0) == 0xc0) {    /* 11bit */    unsigned int c2 = STR0(in)[i++] & 0x3f;    c &= 0x1f;    c = (c << 6) | c2;    } else {
pike.git/src/builtin_functions.c:2139:    c &= 0x0f;    c = (c << 12) | (c2 << 6) | c3;    }    }    out_str[j++] = c;    }    break;    }       case 2: { -  p_wchar2 *out_str = (p_wchar2 *) out->str; +  p_wchar2 *out_str = STR2 (out);    for(j=i=0; i < in->len;) {    unsigned int c = STR0(in)[i++];    /* NOTE: No tests here since we've already tested the string above. */    if (c & 0x80) {    int cont = 0;    if ((c & 0xe0) == 0xc0) {    /* 11bit */    cont = 1;    c &= 0x1f;    } else if ((c & 0xf0) == 0xe0) {
pike.git/src/builtin_functions.c:2188:    }    }      #ifdef PIKE_DEBUG    if (j != len) {    Pike_fatal("utf8_to_string(): Calculated and actual lengths differ: %d != %d\n",    len, j);    }   #endif /* PIKE_DEBUG */    out = low_end_shared_string(out); + #ifdef PIKE_DEBUG +  check_string (out); + #endif    pop_n_elems(args);    push_string(out);   }      /*! @decl string __parse_pike_type(string t)    */   static void f_parse_pike_type( INT32 args )   {    struct pike_type *t;