pike.git / src / post_modules / BSON / bson.cmod

version» Context lines:

pike.git/src/post_modules/BSON/bson.cmod:62:      struct object * True;   struct object * False;   struct object * Null;   struct object * MinKey;   struct object * MaxKey;      struct program * Javascript;   struct svalue * Second;   struct program * ObjectId; + struct program * Binary;   struct program * Symbol;   struct program * Regex;   struct program * Timestamp;      static struct program *bignum_program;      struct svalue low_Second;      char * decode_next_value(struct pike_string * pike_slist, char * n, struct mapping * list);   
pike.git/src/post_modules/BSON/bson.cmod:244:    push_string(val);    f_utf8_to_string(1);    break;    }       case TYPE_BSON_BINARY:    {    struct pike_string * val;    INT32 bump = get_unaligned_le32(n);    INT32 left; +  INT8 subtype;    n+=4; -  +  subtype = *(INT8*)n; +  n++; +     left = pike_slist->len - (n - slist);       if(bump <= 0 || bump > left)    {    Pike_error("invalid BSON. not enough data 5.\n");    } -  val = make_shared_binary_string(n, bump-1); /* length includes null. */ +  +  if (!Binary) +  Binary = lookup_program("Standards.BSON.Binary"); +  +  val = make_shared_binary_string(n, bump);    n += (bump); -  +  +  ref_push_program(Binary);    push_string(val); -  +  push_int(subtype); +  +  apply_svalue( Pike_sp-3, 2 ); +  stack_swap(); +  pop_stack(); +     break;    }       case TYPE_BSON_INTEGER:    {    INT32 t;    INT32 left = pike_slist->len - (n - slist);    if(left < 4)    {    Pike_error("invalid BSON. not enough data 6.\n");