mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve object_array
This commit is contained in:
parent
b5b081429f
commit
8046e91439
@ -3,6 +3,7 @@
|
||||
2024/11/07
|
||||
* 修复locale_infos_unref接口释放info对象无法清除assets_manager上的野指针导致崩溃的问题(感谢雨欣提供补丁)
|
||||
* 完善object_hash(感谢兆坤提供补丁)
|
||||
* 完善object_array(感谢兆坤提供补丁)
|
||||
* 统一是否可从名字中获取index的判断逻辑(感谢兆坤提供补丁)
|
||||
|
||||
2024/11/06
|
||||
|
@ -400,7 +400,7 @@ static ret_t object_array_find_props(tk_object_t* obj, tk_compare_t cmp, const v
|
||||
value_t* iter = &o->props[i];
|
||||
tk_snprintf(name, TK_NAME_LEN, "%" PRIu32, i);
|
||||
value_copy(&(nv.value), iter);
|
||||
if (0 == cmp(data, &nv)) {
|
||||
if (0 == cmp(&nv, data)) {
|
||||
ret = darray_push(matched, iter);
|
||||
}
|
||||
}
|
||||
@ -422,7 +422,7 @@ static value_t* object_array_find_prop(tk_object_t* obj, tk_compare_t cmp, const
|
||||
value_t* iter = &o->props[i];
|
||||
tk_snprintf(name, TK_NAME_LEN, "%" PRIu32, i);
|
||||
value_copy(&(nv.value), iter);
|
||||
if (0 == cmp(ctx, &nv)) {
|
||||
if (0 == cmp(&nv, ctx)) {
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ TEST(ObjectArray, push_and_remove) {
|
||||
TK_OBJECT_UNREF(obj);
|
||||
}
|
||||
|
||||
static int is_even(const void* ctx, const void* data) {
|
||||
static int is_even(const void* data, const void* ctx) {
|
||||
const named_value_t* nv = (const named_value_t*)(data);
|
||||
uint32_t num = value_uint32(&nv->value);
|
||||
return (num % 2 == 0) ? 0 : -1;
|
||||
|
Loading…
Reference in New Issue
Block a user