format code

pull/298/head
V2Ray 2015-09-08 15:39:49 +02:00
parent 69bcce0b0d
commit 9371b3d080
2 changed files with 90 additions and 90 deletions

View File

@ -26,7 +26,7 @@ func NewDecryptionReader(reader io.Reader, key []byte) (*DecryptionReader, error
} }
decryptionReader.cipher = cipher decryptionReader.cipher = cipher
decryptionReader.reader = reader decryptionReader.reader = reader
decryptionReader.buffer = bytes.NewBuffer(make([]byte, 0, 2 * blockSize)) decryptionReader.buffer = bytes.NewBuffer(make([]byte, 0, 2*blockSize))
return decryptionReader, nil return decryptionReader, nil
} }

View File

@ -49,10 +49,10 @@ func TestNormalReading(t *testing.T) {
readSize := 0 readSize := 0
for readSize < testSize { for readSize < testSize {
nBytes := mrand.Intn(16) + 1 nBytes := mrand.Intn(16) + 1
if nBytes > testSize - readSize { if nBytes > testSize-readSize {
nBytes = testSize - readSize nBytes = testSize - readSize
} }
bytesRead, err := reader.Read(readtext[readSize:readSize + nBytes]) bytesRead, err := reader.Read(readtext[readSize : readSize+nBytes])
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -61,7 +61,7 @@ func TestNormalReading(t *testing.T) {
} }
readSize += nBytes readSize += nBytes
} }
if ! bytes.Equal(readtext, plaintext) { if !bytes.Equal(readtext, plaintext) {
t.Errorf("Expected plaintext %v, but got %v", plaintext, readtext) t.Errorf("Expected plaintext %v, but got %v", plaintext, readtext)
} }
} }