Skip to content

Commit

Permalink
[cgo][libc] refs fibercrypto#105 Restore to []bytes in C.GoSlice_ tha…
Browse files Browse the repository at this point in the history
…t generate error in SWIG
  • Loading branch information
Maykel Arias Torres committed Sep 25, 2019
1 parent e34fbf6 commit 9cf8d31
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
10 changes: 6 additions & 4 deletions lib/cgo/cipher.crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions lib/cgo/coin.block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cgo/coin.transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cgo/params.distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9cf8d31

Please sign in to comment.