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

Side by Side Diff: src/pkg/debug/goobj/read.go

Issue 91840044: code review 91840044: all: spelling tweaks, A-G (Closed)
Patch Set: diff -r 96cbc91bc15a https://code.google.com/p/go Created 10 years, 12 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/debug/elf/elf.go ('k') | src/pkg/encoding/asn1/asn1.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Go Authors. All rights reserved. 1 // Copyright 2013 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 // Package goobj implements reading of Go object files and archives. 5 // Package goobj implements reading of Go object files and archives.
6 // 6 //
7 // TODO(rsc): Decide where this package should live. (golang.org/issue/6932) 7 // TODO(rsc): Decide where this package should live. (golang.org/issue/6932)
8 // TODO(rsc): Decide the appropriate integer types for various fields. 8 // TODO(rsc): Decide the appropriate integer types for various fields.
9 // TODO(rsc): Write tests. (File format still up in the air a little.) 9 // TODO(rsc): Write tests. (File format still up in the air a little.)
10 package goobj 10 package goobj
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 // A SymID - the combination of Name and Version - uniquely identifies 130 // A SymID - the combination of Name and Version - uniquely identifies
131 // a symbol within a package. 131 // a symbol within a package.
132 type SymID struct { 132 type SymID struct {
133 // Name is the name of a symbol. 133 // Name is the name of a symbol.
134 Name string 134 Name string
135 135
136 // Version is zero for symbols with global visibility. 136 // Version is zero for symbols with global visibility.
137 // Symbols with only file visibility (such as file-level static 137 // Symbols with only file visibility (such as file-level static
138 » // declarations in C) have a non-zero version distinguising 138 » // declarations in C) have a non-zero version distinguishing
139 // a symbol in one file from a symbol of the same name 139 // a symbol in one file from a symbol of the same name
140 // in another file 140 // in another file
141 Version int 141 Version int
142 } 142 }
143 143
144 func (s SymID) String() string { 144 func (s SymID) String() string {
145 if s.Version == 0 { 145 if s.Version == 0 {
146 return s.Name 146 return s.Name
147 } 147 }
148 return fmt.Sprintf("%s<%d>", s.Name, s.Version) 148 return fmt.Sprintf("%s<%d>", s.Name, s.Version)
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // 40:48 mode 503 // 40:48 mode
504 // 48:58 size 504 // 48:58 size
505 // 58:60 magic - `\n 505 // 58:60 magic - `\n
506 // We only care about name, size, and magic. 506 // We only care about name, size, and magic.
507 // The fields are space-padded on the right. 507 // The fields are space-padded on the right.
508 // The size is in decimal. 508 // The size is in decimal.
509 // The file data - size bytes - follows the header. 509 // The file data - size bytes - follows the header.
510 // Headers are 2-byte aligned, so if size is odd, an extra paddi ng 510 // Headers are 2-byte aligned, so if size is odd, an extra paddi ng
511 // byte sits between the file data and the next header. 511 // byte sits between the file data and the next header.
512 // The file data that follows is padded to an even number of byt es: 512 // The file data that follows is padded to an even number of byt es:
513 » » // if size is odd, an extra padding byte is inserted betw the ne xt header. 513 » » // if size is odd, an extra padding byte is inserted after the d ata.
514 if len(data) < 60 { 514 if len(data) < 60 {
515 return errTruncatedArchive 515 return errTruncatedArchive
516 } 516 }
517 if !bytes.Equal(data[58:60], archiveMagic) { 517 if !bytes.Equal(data[58:60], archiveMagic) {
518 return errCorruptArchive 518 return errCorruptArchive
519 } 519 }
520 name := trimSpace(data[0:16]) 520 name := trimSpace(data[0:16])
521 size, err := strconv.ParseInt(trimSpace(data[48:58]), 10, 64) 521 size, err := strconv.ParseInt(trimSpace(data[48:58]), 10, 64)
522 if err != nil { 522 if err != nil {
523 return errCorruptArchive 523 return errCorruptArchive
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 655 }
656 } 656 }
657 657
658 r.readFull(r.tmp[:7]) 658 r.readFull(r.tmp[:7])
659 if !bytes.Equal(r.tmp[:7], []byte("\xffgo13ld")) { 659 if !bytes.Equal(r.tmp[:7], []byte("\xffgo13ld")) {
660 return r.error(errCorruptObject) 660 return r.error(errCorruptObject)
661 } 661 }
662 662
663 return nil 663 return nil
664 } 664 }
OLDNEW
« no previous file with comments | « src/pkg/debug/elf/elf.go ('k') | src/pkg/encoding/asn1/asn1.go » ('j') | no next file with comments »

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