getBytesLength finds the length of a bytes encoding.
(b []byte, e escapes)
| 845 | |
| 846 | // getBytesLength finds the length of a bytes encoding. |
| 847 | func getBytesLength(b []byte, e escapes) (int, error) { |
| 848 | // Skip the tag. |
| 849 | skipped := 1 |
| 850 | for { |
| 851 | i := bytes.IndexByte(b[skipped:], e.escape) |
| 852 | if i == -1 { |
| 853 | return 0, errors.Errorf("did not find terminator %#x in buffer %#x", e.escape, b) |
| 854 | } |
| 855 | if i+1 >= len(b) { |
| 856 | return 0, errors.Errorf("malformed escape in buffer %#x", b) |
| 857 | } |
| 858 | skipped += i + escapeLength |
| 859 | if b[skipped-1] == e.escapedTerm { |
| 860 | return skipped, nil |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | // prettyPrintInvertedIndexKey returns a string representation of the path part of a JSON inverted |
| 866 | // index. |
no test coverage detected
searching dependent graphs…