Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1374)

Delta Between Two Patch Sets: src/pkg/net/dnsmsg.go

Issue 6818043: code review 6818043: net: fix a bad cast in dnsmsg.go (Closed)
Left Patch Set: Created 11 years, 5 months ago
Right Patch Set: diff -r ab32e21a9e1c https://code.google.com/p/go/ Created 11 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // DNS packet assembly. See RFC 1035. 5 // DNS packet assembly. See RFC 1035.
6 // 6 //
7 // This is intended to support name resolution during Dial. 7 // This is intended to support name resolution during Dial.
8 // It doesn't have to be blazing fast. 8 // It doesn't have to be blazing fast.
9 // 9 //
10 // Each message structure has a Walk method that is used by 10 // Each message structure has a Walk method that is used by
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 s := "{" 611 s := "{"
612 i := 0 612 i := 0
613 any.Walk(func(val interface{}, name, tag string) bool { 613 any.Walk(func(val interface{}, name, tag string) bool {
614 i++ 614 i++
615 if i > 1 { 615 if i > 1 {
616 s += ", " 616 s += ", "
617 } 617 }
618 s += name + "=" 618 s += name + "="
619 switch tag { 619 switch tag {
620 case "ipv4": 620 case "ipv4":
621 » » » i := val.(uint32) 621 » » » i := *val.(*uint32)
622 s += IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i)) .String() 622 s += IPv4(byte(i>>24), byte(i>>16), byte(i>>8), byte(i)) .String()
623 case "ipv6": 623 case "ipv6":
624 i := val.([]byte) 624 i := val.([]byte)
625 s += IP(i).String() 625 s += IP(i).String()
626 default: 626 default:
627 var i int64 627 var i int64
628 switch v := val.(type) { 628 switch v := val.(type) {
629 default: 629 default:
630 // can't really happen. 630 // can't really happen.
631 s += "<unknown type>" 631 s += "<unknown type>"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 878 }
879 } 879 }
880 if len(dns.extra) > 0 { 880 if len(dns.extra) > 0 {
881 s += "-- Extra\n" 881 s += "-- Extra\n"
882 for i := 0; i < len(dns.extra); i++ { 882 for i := 0; i < len(dns.extra); i++ {
883 s += printStruct(dns.extra[i]) + "\n" 883 s += printStruct(dns.extra[i]) + "\n"
884 } 884 }
885 } 885 }
886 return s 886 return s
887 } 887 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b