*fixed a referenced usertype comparison bug.
This commit is contained in:
parent
d9d793f08a
commit
e73dee7008
1
HISTORY
1
HISTORY
@ -1,4 +1,5 @@
|
|||||||
Jan. 21 2016
|
Jan. 21 2016
|
||||||
|
Fixed a referenced usertype comparison bug
|
||||||
Fixed a wrong memory copy bug with the PRINT statement
|
Fixed a wrong memory copy bug with the PRINT statement
|
||||||
Added TOSTRING meta method to serialize a class instance
|
Added TOSTRING meta method to serialize a class instance
|
||||||
Improved type handling
|
Improved type handling
|
||||||
|
@ -2219,9 +2219,13 @@ unsigned int _ht_hash_object(void* ht, void* d) {
|
|||||||
result = 5 * h + _ht_hash_string(ht, o->data.string);
|
result = 5 * h + _ht_hash_string(ht, o->data.string);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#ifdef MB_ENABLE_CLASS
|
||||||
|
/* TODO : Use customized "HASH" function for case _DT_CLASS */
|
||||||
|
#endif /* MB_ENABLE_CLASS */
|
||||||
case _DT_USERTYPE_REF:
|
case _DT_USERTYPE_REF:
|
||||||
if(o->data.usertype_ref->hash) {
|
if(o->data.usertype_ref->hash) {
|
||||||
h = 5 * h + o->data.usertype_ref->hash(o->data.usertype_ref->ref.s, o->data.usertype_ref->usertype);
|
h = 5 * h + o->data.usertype_ref->hash(o->data.usertype_ref->ref.s, o->data.usertype_ref->usertype);
|
||||||
|
result = h % self->array_size;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2292,16 +2296,14 @@ int _ht_cmp_object(void* d1, void* d2) {
|
|||||||
switch(o1->type) {
|
switch(o1->type) {
|
||||||
case _DT_STRING:
|
case _DT_STRING:
|
||||||
return _ht_cmp_string(o1->data.string, o2->data.string);
|
return _ht_cmp_string(o1->data.string, o2->data.string);
|
||||||
|
#ifdef MB_ENABLE_CLASS
|
||||||
|
/* TODO : Use customized "COMPARE" function for case _DT_CLASS */
|
||||||
|
#endif /* MB_ENABLE_CLASS */
|
||||||
case _DT_USERTYPE_REF:
|
case _DT_USERTYPE_REF:
|
||||||
if(o1->data.usertype_ref->cmp) {
|
if(o1->data.usertype_ref->cmp)
|
||||||
o1->data.usertype_ref->cmp(o1->data.usertype_ref->ref.s, o1->data.usertype_ref->usertype, o2->data.usertype_ref->usertype);
|
return o1->data.usertype_ref->cmp(o1->data.usertype_ref->ref.s, o1->data.usertype_ref->usertype, o2->data.usertype_ref->usertype);
|
||||||
|
else if(o2->data.usertype_ref->cmp)
|
||||||
break;
|
return o2->data.usertype_ref->cmp(o1->data.usertype_ref->ref.s, o1->data.usertype_ref->usertype, o2->data.usertype_ref->usertype);
|
||||||
} else if(o2->data.usertype_ref->cmp) {
|
|
||||||
o2->data.usertype_ref->cmp(o1->data.usertype_ref->ref.s, o1->data.usertype_ref->usertype, o2->data.usertype_ref->usertype);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
default:
|
default:
|
||||||
for(i = 0; i < sizeof(_raw_t); ++i) {
|
for(i = 0; i < sizeof(_raw_t); ++i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user