Matter smart home protocol implementation for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve E331 redundant function prefixes across hostname, linkedin, matter, mbr, gpt

Remove make_/get_/find_ prefixes from 21 functions: find_invalid_char,
make_api, make_cookie, get_json, get_keychain_passphrase,
get_all_linkedin_cookies, get_linkedin_cookies, get_int, get_uint,
get_bytes, get_partition_info, make_new_partition, make_new_mbr,
get_u8, get_u16_le, get_u32_le, get_ok, and related callers.

+9 -9
+9 -9
lib/tlv.ml
··· 213 213 done; 214 214 Ok (!v, offset + 8) 215 215 216 - let get_int data offset size_code = 216 + let int data offset size_code = 217 217 match size_code with 218 218 | 0 -> 219 219 let* b, off = byte data offset in ··· 229 229 | 3 -> uint64_le data offset 230 230 | _ -> Error "Invalid size code" 231 231 232 - let get_uint data offset size_code = 232 + let uint data offset size_code = 233 233 match size_code with 234 234 | 0 -> 235 235 let* b, off = byte data offset in ··· 243 243 | 3 -> uint64_le data offset 244 244 | _ -> Error "Invalid size code" 245 245 246 - let get_bytes data offset len = 246 + let bytes data offset len = 247 247 if len < 0 || offset < 0 || offset + len > String.length data then 248 248 Error "Unexpected end of data" 249 249 else Ok (String.sub data offset len, offset + len) ··· 292 292 | 0 | 1 | 2 | 3 -> 293 293 (* Signed int *) 294 294 let size_code = type_code in 295 - let* v, off = get_int data offset size_code in 295 + let* v, off = int data offset size_code in 296 296 Ok (Int v, off) 297 297 | 4 | 5 | 6 | 7 -> 298 298 (* Unsigned int *) 299 299 let size_code = type_code - 4 in 300 - let* v, off = get_uint data offset size_code in 300 + let* v, off = uint data offset size_code in 301 301 Ok (Uint v, off) 302 302 | 8 -> Ok (Bool false, offset) 303 303 | 9 -> Ok (Bool true, offset) ··· 312 312 | 12 | 13 | 14 | 15 -> 313 313 (* UTF8 string *) 314 314 let size_code = type_code - 12 in 315 - let* len, off = get_uint data offset size_code in 316 - let* s, off = get_bytes data off (Int64.to_int len) in 315 + let* len, off = uint data offset size_code in 316 + let* s, off = bytes data off (Int64.to_int len) in 317 317 Ok (String s, off) 318 318 | 16 | 17 | 18 | 19 -> 319 319 (* Byte string *) 320 320 let size_code = type_code - 16 in 321 - let* len, off = get_uint data offset size_code in 322 - let* s, off = get_bytes data off (Int64.to_int len) in 321 + let* len, off = uint data offset size_code in 322 + let* s, off = bytes data off (Int64.to_int len) in 323 323 Ok (Bytes s, off) 324 324 | 20 -> Ok (Null, offset) 325 325 | 21 ->