pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.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: stralloc.c,v 1.225 2008/06/29 21:08:14 grubba Exp $ + || $Id: stralloc.c,v 1.226 2008/06/29 21:21:46 marcus Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "dynamic_buffer.h"   #include "pike_macros.h"   #include "pike_memory.h"   #include "pike_error.h"   #include "gc.h"
pike.git/src/stralloc.c:110:    DO_HASHMEM(h, s, len__<<size_shift, HASH_PREFIX<<size_shift);    return h;   }      static INLINE size_t do_hash(struct pike_string *s)   {    return low_do_hash(s->str, s->len, s->size_shift);   }       - static INLINE int find_magnitude1(const unsigned INT16 *s, ptrdiff_t len) + static INLINE int find_magnitude1(const p_wchar1 *s, ptrdiff_t len)   {    while(--len>=0)    if(s[len]>=256)    return 1;    return 0;   }    - static INLINE int find_magnitude2(const unsigned INT32 *s, ptrdiff_t len) + static INLINE int find_magnitude2(const p_wchar2 *s, ptrdiff_t len)   {    while(--len>=0)    { -  if(s[len]>=256) +  if((unsigned INT32)s[len]>=256)    {    do    { -  if(s[len]>=65536) +  if((unsigned INT32)s[len]>=65536)    return 2;    }while(--len>=0);    return 1;    }    }    return 0;   }    - static INLINE int min_magnitude(const unsigned INT32 c) + static INLINE int min_magnitude(p_wchar2 c)   { -  +  if(c<0) return 2;    if(c<256) return 0;    if(c<65536) return 1;    return 2;   }      static INLINE unsigned INT32 generic_extract (const void *str, int size, ptrdiff_t pos)   {    switch(size)    {    case 0: return ((unsigned char *)str)[pos];
pike.git/src/stralloc.c:2527:   PMOD_EXPORT ptrdiff_t string_builder_quote_string(struct string_builder *buf,    struct pike_string *str,    ptrdiff_t i,    ptrdiff_t max_len,    int flags)   {    ptrdiff_t old_len = buf->s->len;       for (; i < str->len; i++) {    p_wchar2 ch = index_shared_string(str, i); -  if (ch > 0xffff) { +  if (ch < 0 || ch > 0xffff) {    /* Huge character. */    string_builder_binary_strcat(buf, "\\U", 2);    string_builder_append_integer(buf, ch, 16, APPEND_ZERO_PAD, 8, 8);    } else if (ch > 0xff) {    /* Unicode character. */    string_builder_binary_strcat(buf, "\\u", 2);    string_builder_append_integer(buf, ch, 16, APPEND_ZERO_PAD, 4, 4);    } else if (ch & 0x60) {    /* Printable character or DEL. */    if (ch == '\177') {