pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:817:    push_svalue(val);    apply(encoder_codec (data), "nameof", 1);    EDB(5, fprintf(stderr, "%*s->nameof: ", data->depth, "");    print_svalue(stderr, Pike_sp-1);    fputc('\n', stderr););    switch(TYPEOF(Pike_sp[-1]))    {    case T_INT:    if(SUBTYPEOF(Pike_sp[-1]) == NUMBER_UNDEFINED)    { -  int to_change = data->buf.s.len; +  int to_change = buffer_content_length(&data->buf);    struct svalue tmp = entry_id;       EDB(5,fprintf(stderr, "%*s(UNDEFINED)\n", data->depth, ""));       if (SUBTYPEOF(*val)) {    /* Subtyped object.    *    * Encode the subtype, and then try encoding the plain object.    */    code_entry(TAG_OBJECT, 4, data);
pike.git/src/encode.c:862:    if(!low_mapping_lookup(data->encoded, val))    {    int fun;    EDB(1,fprintf(stderr, "%*sZapping 3 -> 1 in TAG_OBJECT\n",    data->depth, ""));       /* This causes the code_entry above to    * become: code_entry(TAG_OBJECT, 1, data);    * -Hubbe    */ -  data->buf.s.str[to_change] = 99; +  ((char*)buffer_ptr(&data->buf))[to_change] = 99;       fun = find_identifier("encode_object",    encoder_codec (data)->prog);    if (fun < 0)    Pike_error("Cannot encode objects without an "    "\"encode_object\" function in the codec.\n");    apply_low(data->codec,fun,1);       /* Put value back in cache for future reference -Hubbe */    mapping_insert(data->encoded, val, &tmp);