Skip to content

Commit

Permalink
Revert previous change and fix non zero issue
Browse files Browse the repository at this point in the history
  • Loading branch information
efeyuk committed Dec 12, 2018
1 parent 5a41de4 commit e124595
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dcmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *DcmiGetMcIdResponse) UnmarshalBinary(buf []byte) error {
r.CompletionCode = CompletionCode(buf[0])
r.GroupExtensionId = buf[1]
r.NumBytes = buf[2]
ending := len(buf) - 1
ending := len(buf)
for idx, b := range buf[3:] {
if b == 0x00 {
ending = idx + 3
Expand Down
4 changes: 1 addition & 3 deletions tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ func responseFromBytes(msg []byte, r Response) error {

func responseFromString(s string, r Response) error {
// Remove trailing spaces and newlines from string received.
// Add some zeros to avoid endianess problems during unmarshaling in border cases
// fmt.Printf("Message received: %s\n", s)
msg := rawDecode(fmt.Sprintf("%s0000", strings.Replace(strings.TrimSpace(s), "\n", "", -1)))
msg := rawDecode(strings.Replace(strings.TrimSpace(s), "\n", "", -1))
return responseFromBytes(msg, r)
}

Expand Down

0 comments on commit e124595

Please sign in to comment.