Skip to content

Commit 1ec40fd

Browse files
committed
✨ Read Array stick to uint16
1 parent 93e0d80 commit 1ec40fd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

parameters/readers/arrays.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ func ReadStringArray(reader *parser.Reader) ([]string, error) {
6565
}
6666

6767
// ReadArray reads a generic typed array from the reader.
68-
// Format: uint32 size, Type byte, then size elements of that type.
68+
// Format: uint16 size, Type byte, then size elements of that type.
6969
// All elements in the array have the same type.
7070
// Returns a slice of any containing the decoded elements.
7171
//
7272
// Example wire format for []int32{100, 200}:
7373
//
74-
// 0x00 0x00 0x00 0x02 // size = 2 (uint32)
74+
// 0x00 0x02 // size = 2 (uint16)
7575
// 0x69 // type = Int32Type
7676
// 0x00 0x00 0x00 0x64 // 100
7777
// 0x00 0x00 0x00 0xC8 // 200
7878
func ReadArray(reader *parser.Reader) ([]any, error) {
7979

80-
size, err := parser.ReadPrimitive[uint32](reader)
80+
size, err := parser.ReadPrimitive[uint16](reader)
8181

8282
if err != nil {
8383
return nil, err
@@ -91,7 +91,7 @@ func ReadArray(reader *parser.Reader) ([]any, error) {
9191

9292
val := make([]any, size)
9393

94-
for i := uint32(0); i < size; i++ {
94+
for i := uint16(0); i < size; i++ {
9595
input, err := Decode(reader, ttype)
9696
if err != nil {
9797
return nil, err

0 commit comments

Comments
 (0)