(b []byte, old map[string]any, depth int)
| 1143 | } |
| 1144 | |
| 1145 | func readMapStrIntfBytesDepth(b []byte, old map[string]any, depth int) (v map[string]any, o []byte, err error) { |
| 1146 | if depth >= recursionLimit { |
| 1147 | err = ErrRecursion |
| 1148 | return |
| 1149 | } |
| 1150 | |
| 1151 | var sz uint32 |
| 1152 | o = b |
| 1153 | sz, o, err = ReadMapHeaderBytes(o) |
| 1154 | |
| 1155 | if err != nil { |
| 1156 | return |
| 1157 | } |
| 1158 | // Map key, min size is 2 bytes. Value min 1 byte. |
| 1159 | if int64(len(b)) < int64(sz)*3 { |
| 1160 | err = ErrShortBytes |
| 1161 | return |
| 1162 | } |
| 1163 | if old != nil { |
| 1164 | for key := range old { |
| 1165 | delete(old, key) |
| 1166 | } |
| 1167 | v = old |
| 1168 | } else { |
| 1169 | v = make(map[string]any, int(sz)) |
| 1170 | } |
| 1171 | |
| 1172 | for z := uint32(0); z < sz; z++ { |
| 1173 | if len(o) < 1 { |
| 1174 | err = ErrShortBytes |
| 1175 | return |
| 1176 | } |
| 1177 | var key []byte |
| 1178 | key, o, err = ReadMapKeyZC(o) |
| 1179 | if err != nil { |
| 1180 | return |
| 1181 | } |
| 1182 | var val any |
| 1183 | val, o, err = readIntfBytesDepth(o, depth) |
| 1184 | if err != nil { |
| 1185 | return |
| 1186 | } |
| 1187 | v[string(key)] = val |
| 1188 | } |
| 1189 | return |
| 1190 | } |
| 1191 | |
| 1192 | // ReadIntfBytes attempts to read |
| 1193 | // the next object out of 'b' as a raw interface{} and |
no test coverage detected
searching dependent graphs…