|
|
@ -335,10 +335,6 @@ func (w *indexWriter) AddSymbols(sym map[string]struct{}) error {
|
|
|
|
|
|
|
|
|
|
|
|
for _, s := range symbols {
|
|
|
|
for _, s := range symbols {
|
|
|
|
w.symbols[s] = uint32(w.pos) + headerSize + uint32(w.buf2.len())
|
|
|
|
w.symbols[s] = uint32(w.pos) + headerSize + uint32(w.buf2.len())
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: len(s) gives the number of runes, not the number of bytes.
|
|
|
|
|
|
|
|
// Therefore the read-back length for strings with unicode characters will
|
|
|
|
|
|
|
|
// be off when not using putUvarintStr.
|
|
|
|
|
|
|
|
w.buf2.putUvarintStr(s)
|
|
|
|
w.buf2.putUvarintStr(s)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -636,7 +632,7 @@ func (r *indexReader) readOffsetTable(off uint64) (map[string]uint32, error) {
|
|
|
|
keys := make([]string, 0, keyCount)
|
|
|
|
keys := make([]string, 0, keyCount)
|
|
|
|
|
|
|
|
|
|
|
|
for i := 0; i < keyCount; i++ {
|
|
|
|
for i := 0; i < keyCount; i++ {
|
|
|
|
keys = append(keys, d2.uvarintStr())
|
|
|
|
keys = append(keys, d2.uvarintTempStr())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
res[strings.Join(keys, sep)] = uint32(d2.uvarint())
|
|
|
|
res[strings.Join(keys, sep)] = uint32(d2.uvarint())
|
|
|
|
|
|
|
|
|
|
|
@ -673,7 +669,7 @@ func (r *indexReader) section(o uint32) (byte, []byte, error) {
|
|
|
|
func (r *indexReader) lookupSymbol(o uint32) (string, error) {
|
|
|
|
func (r *indexReader) lookupSymbol(o uint32) (string, error) {
|
|
|
|
d := r.decbufAt(int(o))
|
|
|
|
d := r.decbufAt(int(o))
|
|
|
|
|
|
|
|
|
|
|
|
s := d.uvarintStr()
|
|
|
|
s := d.uvarintTempStr()
|
|
|
|
if d.err() != nil {
|
|
|
|
if d.err() != nil {
|
|
|
|
return "", errors.Wrapf(d.err(), "read symbol at %d", o)
|
|
|
|
return "", errors.Wrapf(d.err(), "read symbol at %d", o)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -688,7 +684,7 @@ func (r *indexReader) Symbols() (map[string]struct{}, error) {
|
|
|
|
sym := make(map[string]struct{}, count)
|
|
|
|
sym := make(map[string]struct{}, count)
|
|
|
|
|
|
|
|
|
|
|
|
for ; count > 0; count-- {
|
|
|
|
for ; count > 0; count-- {
|
|
|
|
s := d2.uvarintStr()
|
|
|
|
s := d2.uvarintTempStr()
|
|
|
|
sym[s] = struct{}{}
|
|
|
|
sym[s] = struct{}{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|