File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ func (e *MQReturn) Error() string {
122
122
}
123
123
124
124
var endian binary.ByteOrder // Used by structure formatters such as MQCFH
125
+ const space8 = " "
125
126
126
127
/*
127
128
* Copy a Go string in "strings"
Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ func (dlh *MQDLH) Bytes() []byte {
100
100
offset += 4
101
101
endian .PutUint32 (buf [offset :], uint32 (dlh .CodedCharSetId ))
102
102
offset += 4
103
- copy (buf [offset :], dlh .Format )
103
+ // Make sure the format is space padded to the correct length
104
+ copy (buf [offset :], (dlh .Format + space8 )[0 :8 ])
104
105
offset += int (MQ_FORMAT_LENGTH )
105
106
endian .PutUint32 (buf [offset :], uint32 (dlh .PutApplType ))
106
107
offset += 4
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ func NewMQMD() *MQMD {
78
78
md .Feedback = int32 (C .MQFB_NONE )
79
79
md .Encoding = int32 (C .MQENC_NATIVE )
80
80
md .CodedCharSetId = int32 (C .MQCCSI_Q_MGR )
81
- md .Format = " "
81
+ md .Format = space8
82
82
md .Priority = int32 (C .MQPRI_PRIORITY_AS_Q_DEF )
83
83
md .Persistence = int32 (C .MQPER_PERSISTENCE_AS_Q_DEF )
84
84
md .MsgId = bytes .Repeat ([]byte {0 }, C .MQ_MSG_ID_LENGTH )
@@ -113,7 +113,8 @@ func copyMDtoC(mqmd *C.MQMD, gomd *MQMD) {
113
113
mqmd .Feedback = C .MQLONG (gomd .Feedback )
114
114
mqmd .Encoding = C .MQLONG (gomd .Encoding )
115
115
mqmd .CodedCharSetId = C .MQLONG (gomd .CodedCharSetId )
116
- setMQIString ((* C .char )(& mqmd .Format [0 ]), gomd .Format , C .MQ_FORMAT_LENGTH )
116
+ // Make sure Format is space padded
117
+ setMQIString ((* C .char )(& mqmd .Format [0 ]), (gomd .Format + space8 ), C .MQ_FORMAT_LENGTH )
117
118
mqmd .Priority = C .MQLONG (gomd .Priority )
118
119
mqmd .Persistence = C .MQLONG (gomd .Persistence )
119
120
You can’t perform that action at this time.
0 commit comments