Example #1
0
func (object *OdbObject) Data() (data []byte) {
	var c_blob unsafe.Pointer = C.git_odb_object_data(object.ptr)
	var blob []byte

	len := int(C.git_odb_object_size(object.ptr))

	sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob)))
	sliceHeader.Cap = len
	sliceHeader.Len = len
	sliceHeader.Data = uintptr(c_blob)

	return blob
}
Example #2
0
func (obj *OdbObject) Data() []byte {
	data := C.git_odb_object_data(obj.git_odb_object)
	length := C.git_odb_object_size(obj.git_odb_object)
	return C.GoBytes(data, C.int(length))
}