addName adds the file with the given name to the index. It returns the assigned file ID number.
(name string)
| 240 | // addName adds the file with the given name to the index. |
| 241 | // It returns the assigned file ID number. |
| 242 | func (ix *IndexWriter) addName(name string) uint32 { |
| 243 | if strings.Contains(name, "\x00") { |
| 244 | log.Fatalf("%q: file has NUL byte in name", name) |
| 245 | } |
| 246 | |
| 247 | ix.nameIndex.writeUint32(ix.nameData.offset()) |
| 248 | ix.nameData.writeString(name) |
| 249 | ix.nameData.writeByte(0) |
| 250 | id := ix.numName |
| 251 | ix.numName++ |
| 252 | return uint32(id) |
| 253 | } |
| 254 | |
| 255 | // flushPost writes ix.post to a new temporary file and |
| 256 | // clears the slice. |
no test coverage detected