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

version» Context lines:

pike.git/src/post_modules/BSON/bson.cmod:68:      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;      struct svalue low_Second;      char *decode_next_value(char *, size_t, struct mapping *);      struct object * lookup_object(const char * obj)   {
pike.git/src/post_modules/BSON/bson.cmod:220:    push_string( make_shared_binary_string(n, bump-1) ); /* length includes null. */    n += (bump);    f_utf8_to_string(1);    break;    }       case TYPE_BSON_BINARY:    {    INT32 bump = get_unaligned_le32(n);    INT32 left; +  INT8 subtype;    n+=4; -  +  subtype = *(INT8*)n; +  n++;    left = n_len - (n - slist);       if(bump <= 0 || bump > left)    {    Pike_error("Invalid BSON. Not enough data.\n");    } -  push_string( make_shared_binary_string(n, bump-1) ); /* length includes null. */ +  +  if (!Binary) +  Binary = lookup_program("Standards.BSON.Binary"); +  +  ref_push_program(Binary); +  push_string( make_shared_binary_string(n, bump) ); +  push_int(subtype); +  apply_svalue(Pike_sp - 3, 2); +  stack_swap(); +  pop_stack(); +     n += (bump);       break;    }       case TYPE_BSON_INTEGER:    {    INT32 left = n_len - (n - slist);    if(left < 4)    {