qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [06/10] qpid-proton git commit: PROTON-1390: Go fix use of unsafe.Sizeof(0)
Date Wed, 18 Jan 2017 01:16:22 GMT
PROTON-1390: Go fix use of unsafe.Sizeof(0)

Work around gccgo bug by using unsafe.Sizeof(int(0)). This is in any case better
as it makes the type clearer.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9fc393a4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9fc393a4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9fc393a4

Branch: refs/heads/go1
Commit: 9fc393a4584cafddfba3666e30f6d8762bae837f
Parents: bbf8a6a
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Jan 17 17:12:13 2017 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Jan 17 19:41:56 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go   | 4 ++--
 proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9fc393a4/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
index bce7323..e3d4e10 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
@@ -143,7 +143,7 @@ func marshal(v interface{}, data *C.pn_data_t) {
 	case int64:
 		C.pn_data_put_long(data, C.int64_t(v))
 	case int:
-		if unsafe.Sizeof(0) == 8 {
+		if unsafe.Sizeof(int(0)) == 8 {
 			C.pn_data_put_long(data, C.int64_t(v))
 		} else {
 			C.pn_data_put_int(data, C.int32_t(v))
@@ -157,7 +157,7 @@ func marshal(v interface{}, data *C.pn_data_t) {
 	case uint64:
 		C.pn_data_put_ulong(data, C.uint64_t(v))
 	case uint:
-		if unsafe.Sizeof(0) == 8 {
+		if unsafe.Sizeof(int(0)) == 8 {
 			C.pn_data_put_ulong(data, C.uint64_t(v))
 		} else {
 			C.pn_data_put_uint(data, C.uint32_t(v))

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9fc393a4/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
index 8f380a7..9b9cfd3 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/unmarshal.go
@@ -330,7 +330,7 @@ func unmarshal(v interface{}, data *C.pn_data_t) {
 		case C.PN_INT:
 			*v = int(C.pn_data_get_int(data))
 		case C.PN_LONG:
-			if unsafe.Sizeof(0) == 8 {
+			if unsafe.Sizeof(int(0)) == 8 {
 				*v = int(C.pn_data_get_long(data))
 			} else {
 				panic(newUnmarshalError(pnType, v))
@@ -350,7 +350,7 @@ func unmarshal(v interface{}, data *C.pn_data_t) {
 		case C.PN_UINT:
 			*v = uint(C.pn_data_get_uint(data))
 		case C.PN_ULONG:
-			if unsafe.Sizeof(0) == 8 {
+			if unsafe.Sizeof(int(0)) == 8 {
 				*v = uint(C.pn_data_get_ulong(data))
 			} else {
 				panic(newUnmarshalError(pnType, v))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message