Decode the backlen and returns it. If the encoding looks invalid (more than * 5 bytes are used), UINT64_MAX is returned to report the problem. */
| 365 | /* Decode the backlen and returns it. If the encoding looks invalid (more than |
| 366 | * 5 bytes are used), UINT64_MAX is returned to report the problem. */ |
| 367 | uint64_t lpDecodeBacklen(unsigned char *p) { |
| 368 | uint64_t val = 0; |
| 369 | uint64_t shift = 0; |
| 370 | do { |
| 371 | val |= (uint64_t)(p[0] & 127) << shift; |
| 372 | if (!(p[0] & 128)) break; |
| 373 | shift += 7; |
| 374 | p--; |
| 375 | if (shift > 28) return UINT64_MAX; |
| 376 | } while(1); |
| 377 | return val; |
| 378 | } |
| 379 | |
| 380 | /* Encode the string element pointed by 's' of size 'len' in the target |
| 381 | * buffer 's'. The function should be called with 'buf' having always enough |
no outgoing calls
no test coverage detected