Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[go] Fix variable lengths in proton wrapper #233

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions go/genwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ package amqp

// #include <proton/version.h>
// #if PN_VERSION_MAJOR == %s && PN_VERSION_MINOR < %s
// #error module github.com/apache/qpid-proton requires Proton-C library version 0.10 or greater
// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater
// #endif
import "C"
`, splitVersion[0], splitVersion[1])
Expand Down Expand Up @@ -352,15 +352,15 @@ func mapType(ctype string) (g genType) {
case "C.int64_t":
g.Gotype = "int64"
case "C.int32_t":
g.Gotype = "int16"
case "C.int16_t":
g.Gotype = "int32"
case "C.int16_t":
g.Gotype = "int16"
case "C.uint64_t":
g.Gotype = "uint64"
case "C.uint32_t":
g.Gotype = "uint16"
case "C.uint16_t":
g.Gotype = "uint32"
case "C.uint16_t":
g.Gotype = "uint16"
case "C.const char *":
fallthrough
case "C.char *":
Expand Down
6 changes: 3 additions & 3 deletions go/pkg/amqp/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ func ExampleParseURL() {
"amqps://host",
"/path",
"",
":1234",
// Taken out because the go 1.4 URL parser isn't the same as later
// Taken out because url.Parse error formatting changed in 1.13
// ":1234",
// Taken out because the go 1.4 URL parser isn't the same as later
//"[::1]",
//"[::1",
// Output would be:
Expand All @@ -55,5 +56,4 @@ func ExampleParseURL() {
// amqps://host:amqps
// amqp://localhost:amqp/path
// amqp://localhost:amqp
// parse :1234: missing protocol scheme
}
10 changes: 4 additions & 6 deletions go/pkg/amqp/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ under the License.
// Update the generator and re-run if you need to modify this code.
//


package amqp

// Version check for compatible proton-c library.
//
// NOTE: the required version should NOT be increased unless the Go
// library is modified to require some new proton-c API. That hasn't
// happened for a long time.
// Version check for proton library.
// Done here because this is the lowest-level dependency for all the proton Go packages.

// #include <proton/version.h>
// #if PN_VERSION_MAJOR == 0 && PN_VERSION_MINOR < 10
// #if PN_VERSION_MAJOR == 0 && PN_VERSION_MINOR < 27
// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater
// #endif
import "C"
26 changes: 13 additions & 13 deletions go/pkg/proton/wrappers_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@ func (d Disposition) Condition() Condition {
func (d Disposition) Data() Data {
return Data{C.pn_disposition_data(d.pn)}
}
func (d Disposition) SectionNumber() uint16 {
return uint16(C.pn_disposition_get_section_number(d.pn))
func (d Disposition) SectionNumber() uint32 {
return uint32(C.pn_disposition_get_section_number(d.pn))
}
func (d Disposition) SetSectionNumber(section_number uint16) {
func (d Disposition) SetSectionNumber(section_number uint32) {
C.pn_disposition_set_section_number(d.pn, C.uint32_t(section_number))
}
func (d Disposition) SectionOffset() uint64 {
Expand Down Expand Up @@ -828,23 +828,23 @@ func (t Transport) Log(message string) {

C.pn_transport_log(t.pn, messageC)
}
func (t Transport) ChannelMax() uint32 {
return uint32(C.pn_transport_get_channel_max(t.pn))
func (t Transport) ChannelMax() uint16 {
return uint16(C.pn_transport_get_channel_max(t.pn))
}
func (t Transport) SetChannelMax(channel_max uint32) int {
func (t Transport) SetChannelMax(channel_max uint16) int {
return int(C.pn_transport_set_channel_max(t.pn, C.uint16_t(channel_max)))
}
func (t Transport) RemoteChannelMax() uint32 {
return uint32(C.pn_transport_remote_channel_max(t.pn))
func (t Transport) RemoteChannelMax() uint16 {
return uint16(C.pn_transport_remote_channel_max(t.pn))
}
func (t Transport) MaxFrame() uint16 {
return uint16(C.pn_transport_get_max_frame(t.pn))
func (t Transport) MaxFrame() uint32 {
return uint32(C.pn_transport_get_max_frame(t.pn))
}
func (t Transport) SetMaxFrame(size uint16) {
func (t Transport) SetMaxFrame(size uint32) {
C.pn_transport_set_max_frame(t.pn, C.uint32_t(size))
}
func (t Transport) RemoteMaxFrame() uint16 {
return uint16(C.pn_transport_get_remote_max_frame(t.pn))
func (t Transport) RemoteMaxFrame() uint32 {
return uint32(C.pn_transport_get_remote_max_frame(t.pn))
}
func (t Transport) IdleTimeout() time.Duration {
return (time.Duration(C.pn_transport_get_idle_timeout(t.pn)) * time.Millisecond)
Expand Down