Commit a2e28682 authored by Robert Griesemer's avatar Robert Griesemer

gofmt: gofmt -s -w src misc

R=r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4406044
parent 179f0b8a
......@@ -292,7 +292,7 @@ func rangeSelection(str string) Selection {
from, _ := strconv.Atoi(m[1])
to, _ := strconv.Atoi(m[2])
if from < to {
return makeSelection([][]int{[]int{from, to}})
return makeSelection([][]int{{from, to}})
}
}
return nil
......
......@@ -149,10 +149,10 @@ func nonZeroRandomBytes(s []byte, rand io.Reader) (err os.Error) {
// precompute a prefix of the digest value that makes a valid ASN1 DER string
// with the correct contents.
var hashPrefixes = map[crypto.Hash][]byte{
crypto.MD5: []byte{0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10},
crypto.SHA1: []byte{0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14},
crypto.SHA256: []byte{0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20},
crypto.SHA384: []byte{0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30},
crypto.MD5: {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10},
crypto.SHA1: {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14},
crypto.SHA256: {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20},
crypto.SHA384: {0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30},
crypto.SHA512: {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40},
crypto.MD5SHA1: {}, // A special TLS case which doesn't use an ASN1 prefix.
crypto.RIPEMD160: {0x30, 0x20, 0x30, 0x08, 0x06, 0x06, 0x28, 0xcf, 0x06, 0x03, 0x00, 0x31, 0x04, 0x14},
......
......@@ -255,7 +255,7 @@ var varDefaultCipherSuites []uint16
func initDefaultCipherSuites() {
varDefaultCipherSuites = make([]uint16, len(cipherSuites))
i := 0
for id, _ := range cipherSuites {
for id := range cipherSuites {
varDefaultCipherSuites[i] = id
i++
}
......
......@@ -121,7 +121,7 @@ func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value {
m.ocspStapling = rand.Intn(10) > 5
m.supportedPoints = randomBytes(rand.Intn(5)+1, rand)
m.supportedCurves = make([]uint16, rand.Intn(5)+1)
for i, _ := range m.supportedCurves {
for i := range m.supportedCurves {
m.supportedCurves[i] = uint16(rand.Intn(30000))
}
......
......@@ -154,7 +154,7 @@ func benchmark(b *testing.B, h hash.Hash) {
b.ResetTimer()
b.SetBytes(testDataSize)
data := make([]byte, testDataSize)
for i, _ := range data {
for i := range data {
data[i] = byte(i + 'a')
}
......
......@@ -14,7 +14,7 @@ func (t *Transport) IdleConnKeysForTesting() (keys []string) {
if t.idleConn == nil {
return
}
for key, _ := range t.idleConn {
for key := range t.idleConn {
keys = append(keys, key)
}
return
......
......@@ -74,7 +74,7 @@ func (file *File) Readdirnames(count int) (names []string, err Error) {
names = make([]string, len(fi))
err = nil
for i, _ := range fi {
for i := range fi {
names[i] = fi[i].Name
}
......
......@@ -269,7 +269,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int,
p, _ := GetCurrentProcess()
fd := make([]int32, len(attr.Files))
for i, _ := range attr.Files {
for i := range attr.Files {
if attr.Files[i] > 0 {
err := DuplicateHandle(p, int32(attr.Files[i]), p, &fd[i], 0, true, DUPLICATE_SAME_ACCESS)
if err != 0 {
......
......@@ -52,7 +52,7 @@ func atoi(b []byte) (n uint) {
}
func cstring(s []byte) string {
for i, _ := range s {
for i := range s {
if s[i] == 0 {
return string(s[0:i])
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment