getBytesLength finds the length of a bytes encoding.
(b []byte, e escapes)
| 613 | |
| 614 | // getBytesLength finds the length of a bytes encoding. |
| 615 | func getBytesLength(b []byte, e escapes) (int, error) { |
| 616 | // Skip the tag. |
| 617 | skipped := 1 |
| 618 | for { |
| 619 | i := bytes.IndexByte(b[skipped:], e.escape) |
| 620 | if i == -1 { |
| 621 | return 0, errors.Errorf("did not find terminator %#x in buffer %#x", e.escape, b) |
| 622 | } |
| 623 | if i+1 >= len(b) { |
| 624 | return 0, errors.Errorf("malformed escape in buffer %#x", b) |
| 625 | } |
| 626 | skipped += i + escapeLength |
| 627 | if b[skipped-1] == e.escapedTerm { |
| 628 | return skipped, nil |
| 629 | } |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | // prettyPrintInvertedIndexKey returns a string representation of the path part of a JSON inverted |
| 634 | // index. |
no outgoing calls
no test coverage detected
searching dependent graphs…