pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || 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.cmod,v 1.191 2006/07/05 19:24:18 mast Exp $ + || $Id: builtin.cmod,v 1.192 2007/08/06 08:09:36 nilsson 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.cmod:306:    *!    *! @seealso    *! @[hex2string()]    */   PMOD_EXPORT   PIKEFUN string string2hex(string s)    errname String.string2hex;    optflags OPT_TRY_OPTIMIZE;   {    struct pike_string *hex; -  unsigned char *st = s->str; +  unsigned char *st = (unsigned char *)s->str;    int i;       if (s->size_shift)    Pike_error("Bad argument 1 to string2hex(), expected 8-bit string.\n");       hex = begin_shared_string(2 * s->len);       for (i=0; i<s->len; i++) {    hex->str[i<<1] = hexchar(st[i]>>4);    hex->str[i<<1|1] = hexchar(st[i]&15);
pike.git/src/builtin.cmod:337:    *! @seealso    *! @[string2hex()]    */   PMOD_EXPORT   PIKEFUN string hex2string(string hex)    errname String.hex2string;    optflags OPT_TRY_OPTIMIZE;   {    struct pike_string *s;    int i, o=0; -  unsigned char *q = hex->str; +  unsigned char *q = (unsigned char *)hex->str;    int l = hex->len>>1;    if(hex->size_shift) Pike_error("Only hex digits allowed.\n");    if(hex->len&1) Pike_error("Can't have odd number of digits.\n");       s = begin_shared_string(l);    for (i=0; i<l; i++)    {    s->str[i] = (q[o]<='9' ? q[o]-'0' :((q[o]+9)&15))<<4; o++;    s->str[i] |= (q[o]<='9' ? q[o]-'0': ((q[o]+9)&15)); o++;    }