You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
applicationDataDictionary is received as arg, but it is not used inside the function.
this function is in message.go line 138
// ParseMessageWithDataDictionary constructs a Message from a byte slice wrapping a FIX message using an optional session and application DataDictionary for reference.funcParseMessageWithDataDictionary(
msg*Message,
rawMessage*bytes.Buffer,
transportDataDictionary*datadictionary.DataDictionary,
applicationDataDictionary*datadictionary.DataDictionary,
) (errerror) {
msg.Header.Clear()
msg.Body.Clear()
msg.Trailer.Clear()
msg.rawMessage=rawMessagerawBytes:=rawMessage.Bytes()
//allocate fields in one chunkfieldCount:=0for_, b:=rangerawBytes {
ifb=='\001' {
fieldCount++
}
}
iffieldCount==0 {
returnparseError{OrigError: fmt.Sprintf("No Fields detected in %s", string(rawBytes))}
}
ifcap(msg.fields) <fieldCount {
msg.fields=make([]TagValue, fieldCount)
} else {
msg.fields=msg.fields[0:fieldCount]
}
fieldIndex:=0//message must start with begin string, body length, msg typeifrawBytes, err=extractSpecificField(&msg.fields[fieldIndex], tagBeginString, rawBytes); err!=nil {
return
}
msg.Header.add(msg.fields[fieldIndex : fieldIndex+1])
fieldIndex++parsedFieldBytes:=&msg.fields[fieldIndex]
ifrawBytes, err=extractSpecificField(parsedFieldBytes, tagBodyLength, rawBytes); err!=nil {
return
}
msg.Header.add(msg.fields[fieldIndex : fieldIndex+1])
fieldIndex++parsedFieldBytes=&msg.fields[fieldIndex]
ifrawBytes, err=extractSpecificField(parsedFieldBytes, tagMsgType, rawBytes); err!=nil {
return
}
msg.Header.add(msg.fields[fieldIndex : fieldIndex+1])
fieldIndex++trailerBytes:= []byte{}
foundBody:=falsefor {
parsedFieldBytes=&msg.fields[fieldIndex]
rawBytes, err=extractField(parsedFieldBytes, rawBytes)
iferr!=nil {
return
}
switch {
caseisHeaderField(parsedFieldBytes.tag, transportDataDictionary):
msg.Header.add(msg.fields[fieldIndex : fieldIndex+1])
caseisTrailerField(parsedFieldBytes.tag, transportDataDictionary):
msg.Trailer.add(msg.fields[fieldIndex : fieldIndex+1])
default:
foundBody=truetrailerBytes=rawBytesmsg.Body.add(msg.fields[fieldIndex : fieldIndex+1])
}
ifparsedFieldBytes.tag==tagCheckSum {
break
}
if!foundBody {
msg.bodyBytes=rawBytes
}
fieldIndex++
}
//body length would only be larger than trailer if fields out of orderiflen(msg.bodyBytes) >len(trailerBytes) {
msg.bodyBytes=msg.bodyBytes[:len(msg.bodyBytes)-len(trailerBytes)]
}
length:=0for_, field:=rangemsg.fields {
switchfield.tag {
casetagBeginString, tagBodyLength, tagCheckSum: //tags do not contribute to lengthdefault:
length+=field.length()
}
}
bodyLength, err:=msg.Header.GetInt(tagBodyLength)
iferr!=nil {
err=parseError{OrigError: err.Error()}
} elseiflength!=bodyLength {
err=parseError{OrigError: fmt.Sprintf("Incorrect Message Length, expected %d, got %d", bodyLength, length)}
}
return
}
The text was updated successfully, but these errors were encountered:
hyunw55
changed the title
applicationDataDictionary is received as arg, but it is not used inside the function.
ParseMessageWithDataDictionary has an unused arg.
Mar 23, 2023
applicationDataDictionary is received as arg, but it is not used inside the function.
this function is in message.go line 138
The text was updated successfully, but these errors were encountered: