Data returns a slice pointing to the unmanaged object memory. You must make sure the object is referenced for at least as long as the slice is used.
()
| 371 | // Data returns a slice pointing to the unmanaged object memory. You must make |
| 372 | // sure the object is referenced for at least as long as the slice is used. |
| 373 | func (object *OdbObject) Data() (data []byte) { |
| 374 | var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr) |
| 375 | var blob []byte |
| 376 | |
| 377 | len := int(C.git_odb_object_size(object.ptr)) |
| 378 | |
| 379 | sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob))) |
| 380 | sliceHeader.Cap = len |
| 381 | sliceHeader.Len = len |
| 382 | sliceHeader.Data = uintptr(c_blob) |
| 383 | |
| 384 | return blob |
| 385 | } |
| 386 | |
| 387 | type OdbReadStream struct { |
| 388 | doNotCompare |
no outgoing calls