Skip to content

Commit

Permalink
[fix] Skip test
Browse files Browse the repository at this point in the history
  • Loading branch information
reindexer-bot committed Sep 1, 2024
1 parent f058ec1 commit cbd95d5
Show file tree
Hide file tree
Showing 31 changed files with 513 additions and 606 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.10..3.13)

project(reindexer)
cmake_minimum_required(VERSION 3.10)

enable_testing()
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
20 changes: 17 additions & 3 deletions cjson/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func (dec *Decoder) decodeSlice(pl *payloadIface, rdser *Serializer, v *reflect.
var ptr unsafe.Pointer

k := v.Kind()

offset := 0
switch k {
case reflect.Slice:
Expand All @@ -331,7 +332,11 @@ func (dec *Decoder) decodeSlice(pl *payloadIface, rdser *Serializer, v *reflect.
// offset is 0
// No concatenation for the fixed size arrays
default:
panic(fmt.Errorf("can not convert '%s' to 'array'", v.Type().Kind().String()))
if count == 0 { // Allows empty slice for any scalar type (using default value)
return
} else {
panic(fmt.Errorf("can not convert '%s' to 'array'", v.Type().Kind().String()))
}
}

if subtag != TAG_OBJECT {
Expand Down Expand Up @@ -583,6 +588,7 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
ctagName := ctag.Name()

k := v.Kind()
initialV := v
if k == reflect.Ptr {
if v.IsNil() {
v.Set(reflect.New(v.Type().Elem()))
Expand Down Expand Up @@ -641,6 +647,7 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
} else {
panic(fmt.Errorf("err: intf=%s, name='%s' %s", v.Type().Name(), dec.state.tagsMatcher.tag2name(ctagName), ctag.Dump()))
}
initialV = v
k = v.Kind()
if k == reflect.Ptr {
if v.IsNil() {
Expand All @@ -659,8 +666,12 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
switch ctagType {
case TAG_ARRAY:
count := int(rdser.GetVarUInt())
pl.getArray(int(ctagField), *cnt, count, v)
*cnt += count
if k == reflect.Slice || k == reflect.Array || count != 0 { // Allows empty slice for any scalar type (using default value)
pl.getArray(int(ctagField), *cnt, count, v)
*cnt += count
} else {
initialV.Set(reflect.Zero(initialV.Type())) // Set nil to scalar pointers, intialized with empty arrays
}
default:
pl.getValue(int(ctagField), *cnt, v)
(*cnt)++
Expand All @@ -670,6 +681,9 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
switch ctagType {
case TAG_ARRAY:
dec.decodeSlice(pl, rdser, &v, fieldsoutcnt, cctagsPath)
if v.Kind() != reflect.Array && v.Kind() != reflect.Slice && v.Kind() != reflect.Interface {
initialV.Set(reflect.Zero(initialV.Type())) // Set nil to scalar pointers, intialized with empty arrays
}
case TAG_OBJECT:
for dec.decodeValue(pl, rdser, v, fieldsoutcnt, cctagsPath) {
}
Expand Down
31 changes: 0 additions & 31 deletions clang-tidy/.clang-tidy

This file was deleted.

10 changes: 0 additions & 10 deletions clang-tidy/.clang-tidy-ignore

This file was deleted.

Loading

0 comments on commit cbd95d5

Please sign in to comment.