pike.git/
src/
encode.c
Branch:
Tag:
Non-build tags
All tags
No tags
2000-08-27
2000-08-27 12:22:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>
89cd7df0bde7c87de80b7973d6b971eb042d4bd2 (
22
lines) (+
14
/-
8
)
[
Show
|
Annotate
]
Branch:
7.9
Fixed multiset decoding [Bug
19 (#19)
].
Rev: src/encode.c:1.69
25:
#include "version.h" #include "bignum.h"
-
RCSID("$Id: encode.c,v 1.
68
2000/08/
17
18
:
50
:
32
grubba Exp $");
+
RCSID("$Id: encode.c,v 1.
69
2000/08/
27
12
:
22
:
33
grubba Exp $");
/* #define ENCODE_DEBUG */
1148:
case TAG_MULTISET: { struct multiset *m;
+
struct array *a;
if(num<0) error("Failed to decode string. (multiset size is negative)\n");
1155:
if(data->ptr + num > data->len) error("Failed to decode multiset. (not enough data)\n");
-
m
=
mkmultiset(
low_allocate_array(
0
,
num
));
-
tmp.type=T_MULTISET;
-
tmp.u.multiset=m;
+
/* NOTE: This code knows stuff about the implementation of multisets...*/
+
a
=
low_allocate_array(
num
,
0
)
;
+
m = allocate_multiset(a
);
+
tmp.type
=
T_MULTISET;
+
tmp.u.multiset
=
m;
mapping_insert(data->decoded, & data->counter, &tmp); data->counter.u.integer++;
-
m->refs--;
+
debug_malloc_touch(m); for(e=0;e<num;e++) { decode_value2(data);
-
multiset_insert(m,
Pike_
sp-1
)
;
-
pop
_
stack
();
+
a->item[e]
=
sp
[
-1
]
;
+
sp--;
+
dmalloc
_
touch_svalue
(
sp
);
}
-
ref
_push_multiset(m);
+
array
_
fix_type_field(a);
+
order_multiset(m);
+
push_multiset(m);
return; }