diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-21 16:08:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 16:08:38 +0100 |
commit | 73855d0a5f617bcda1f33e730f3bc7cf8afbef6c (patch) | |
tree | 1616abfd6c9449e08d55563875f8c15546020a52 /cshared/objects_cshared.go | |
parent | 867b10692e5f8a34a82cc0a783bdb63e2b5ff398 (diff) | |
parent | 47666e18adfa70201efc951432ab3c204c1d2ed8 (diff) | |
download | go-git-73855d0a5f617bcda1f33e730f3bc7cf8afbef6c.tar.gz |
Merge pull request #277 from ajnavarro/remove-cshared
cshared: remove directory (Fix #236)
Diffstat (limited to 'cshared/objects_cshared.go')
-rw-r--r-- | cshared/objects_cshared.go | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/cshared/objects_cshared.go b/cshared/objects_cshared.go deleted file mode 100644 index 49ddeb7..0000000 --- a/cshared/objects_cshared.go +++ /dev/null @@ -1,109 +0,0 @@ -// +build ignore -package main - -import ( - "C" - "io/ioutil" - "time" - - "srcd.works/go-git.v4/plumbing" - "srcd.works/go-git.v4/plumbing/object" -) - -//export c_Signature_Name -func c_Signature_Name(s uint64) *C.char { - obj, ok := GetObject(Handle(s)) - if !ok { - return nil - } - sign := obj.(*object.Signature) - return C.CString(sign.Name) -} - -//export c_Signature_Email -func c_Signature_Email(s uint64) *C.char { - obj, ok := GetObject(Handle(s)) - if !ok { - return nil - } - sign := obj.(*object.Signature) - return C.CString(sign.Email) -} - -//export c_Signature_When -func c_Signature_When(s uint64) *C.char { - obj, ok := GetObject(Handle(s)) - if !ok { - return nil - } - sign := obj.(*object.Signature) - return C.CString(sign.When.Format(time.RFC3339)) -} - -//export c_Signature_Decode -func c_Signature_Decode(b []byte) uint64 { - sign := object.Signature{} - sign.Decode(b) - return uint64(RegisterObject(&sign)) -} - -//export c_Blob_get_Hash -func c_Blob_get_Hash(b uint64) *C.char { - obj, ok := GetObject(Handle(b)) - if !ok { - return nil - } - blob := obj.(*object.Blob) - return CBytes(blob.Hash[:]) -} - -//export c_Blob_Size -func c_Blob_Size(b uint64) int64 { - obj, ok := GetObject(Handle(b)) - if !ok { - return -1 - } - blob := obj.(*object.Blob) - return blob.Size -} - -//export c_Blob_Decode -func c_Blob_Decode(o uint64) uint64 { - obj, ok := GetObject(Handle(o)) - if !ok { - return IH - } - cobj := obj.(*plumbing.EncodedObject) - blob := object.Blob{} - blob.Decode(*cobj) - return uint64(RegisterObject(&blob)) -} - -//export c_Blob_Read -func c_Blob_Read(b uint64) (int, *C.char) { - obj, ok := GetObject(Handle(b)) - if !ok { - return ErrorCodeNotFound, C.CString(MessageNotFound) - } - blob := obj.(*object.Blob) - reader, err := blob.Reader() - if err != nil { - return ErrorCodeInternal, C.CString(err.Error()) - } - data, err := ioutil.ReadAll(reader) - reader.Close() - if err != nil { - return ErrorCodeInternal, C.CString(err.Error()) - } - return len(data), CBytes(data) -} - -//export c_Blob_Type -func c_Blob_Type(c uint64) int8 { - obj, ok := GetObject(Handle(c)) - if !ok { - return -1 - } - blob := obj.(*object.Blob) - return int8(blob.Type()) -} |