From 9cf8d31583575cec04933ef4eab03bfdcafeed98 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Wed, 25 Sep 2019 17:59:28 -0400 Subject: [PATCH] [cgo][libc] refs #105 Restore to []bytes in C.GoSlice_ that generate error in SWIG --- lib/cgo/cipher.crypto.go | 10 ++++++---- lib/cgo/coin.block.go | 5 +++-- lib/cgo/coin.transactions.go | 4 ++-- lib/cgo/params.distribution.go | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/cgo/cipher.crypto.go b/lib/cgo/cipher.crypto.go index fcf57df8a..38faf5ea4 100644 --- a/lib/cgo/cipher.crypto.go +++ b/lib/cgo/cipher.crypto.go @@ -171,9 +171,10 @@ func SKY_cipher_SigFromHex(_s string, _arg1 *C.cipher__Sig) (____error_code uint } //export SKY_cipher_Sig_Hex -func SKY_cipher_Sig_Hex(_s *C.cipher__Sig, _arg1 *string) (____error_code uint32) { +func SKY_cipher_Sig_Hex(_s *C.cipher__Sig, _arg1 *C.GoString_) (____error_code uint32) { s := (*cipher.Sig)(unsafe.Pointer(_s)) - *_arg1 = s.Hex() + __arg1 := s.Hex() + copyString(__arg1,_arg1) return } @@ -287,9 +288,10 @@ func SKY_cipher_CheckSecKeyHash(_seckey *C.cipher__SecKey, _hash *C.cipher__SHA2 } //export SKY_cipher_Sig_String -func SKY_cipher_Sig_String(_s *C.cipher__Sig, _arg1 *string) (____error_code uint32) { +func SKY_cipher_Sig_String(_s *C.cipher__Sig, _arg1 *C.GoString_) (____error_code uint32) { s := (*cipher.Sig)(unsafe.Pointer(_s)) - *_arg1 = s.String() + __arg1 := s.String() + copyString(__arg1,_arg1) return } diff --git a/lib/cgo/coin.block.go b/lib/cgo/coin.block.go index 933034eb5..7e712132f 100644 --- a/lib/cgo/coin.block.go +++ b/lib/cgo/coin.block.go @@ -210,13 +210,14 @@ func SKY_coin_BlockBody_Size(_bb *C.BlockBody__Handle, _arg0 *uint32) (____error } //export SKY_coin_BlockBody_Bytes -func SKY_coin_BlockBody_Bytes(_bb C.BlockBody__Handle, _arg0 *[]byte) (____error_code uint32) { +func SKY_coin_BlockBody_Bytes(_bb C.BlockBody__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { bb, ok := lookupBlockBodyHandle(_bb) if !ok { ____error_code = SKY_BAD_HANDLE return } - *_arg0 = bb.Bytes() + __arg0 := bb.Bytes() + copyToGoSlice(reflect.ValueOf(__arg0), _arg0) return } diff --git a/lib/cgo/coin.transactions.go b/lib/cgo/coin.transactions.go index 53981872c..9b61e766d 100644 --- a/lib/cgo/coin.transactions.go +++ b/lib/cgo/coin.transactions.go @@ -345,7 +345,7 @@ func SKY_coin_Transaction_HashInner(handle C.Transaction__Handle, _arg0 *C.ciphe } //export SKY_coin_Transaction_Serialize -func SKY_coin_Transaction_Serialize(handle C.Transaction__Handle, _arg0 *[]byte) (____error_code uint32) { +func SKY_coin_Transaction_Serialize(handle C.Transaction__Handle, _arg0 *C.GoSlice_) (____error_code uint32) { txn, ok := lookupTransactionHandle(handle) if !ok { ____error_code = SKY_BAD_HANDLE @@ -354,7 +354,7 @@ func SKY_coin_Transaction_Serialize(handle C.Transaction__Handle, _arg0 *[]byte) __arg0, ____return_err := txn.Serialize() ____error_code = libErrorCode(____return_err) if ____return_err == nil { - *_arg0 = __arg0 + copyToGoSlice(reflect.ValueOf(__arg0), _arg0) } return } diff --git a/lib/cgo/params.distribution.go b/lib/cgo/params.distribution.go index 384b6ba0f..fc29f1906 100644 --- a/lib/cgo/params.distribution.go +++ b/lib/cgo/params.distribution.go @@ -125,13 +125,13 @@ func SKY_params_Distribution_GetAddresses(_d C.Distribution__Handle, _arg0 *C.Go // nolint megacheck //export SKY_params_Distribution_SetAddresses -func SKY_params_Distribution_SetAddresses(_d C.Distribution__Handle, _arg0 *[]string) (____error_code uint32) { +func SKY_params_Distribution_SetAddresses(_d C.Distribution__Handle, _arg0 []string) (____error_code uint32) { d, ok := lookupDistributionHandle(_d) if !ok { ____error_code = SKY_BAD_HANDLE return } - d.Addresses = *_arg0 + d.Addresses = _arg0 _d = registerDistributionHandle(d) return }