]> Cypherpunks repositories - gostls13.git/commitdiff
os: clarify windows read console code
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 17 May 2013 07:26:44 +0000 (17:26 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 17 May 2013 07:26:44 +0000 (17:26 +1000)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9458043

src/pkg/os/file_windows.go

index 41233fff64bcfa88a4cb7c7430a941f6e332f9d8..4cd45420759b4160e19c6534e9af46c7f2dbce9c 100644 (file)
@@ -253,12 +253,12 @@ func (f *File) readConsole(b []byte) (n int, err error) {
        if len(f.readbuf) == 0 {
                // syscall.ReadConsole seems to fail, if given large buffer.
                // So limit the buffer to 16000 characters.
-               readN := 16000
-               if len(b) < readN {
-                       readN = len(b)
+               numBytes := len(b)
+               if numBytes > 16000 {
+                       numBytes = 16000
                }
                // get more input data from os
-               wchars := make([]uint16, readN)
+               wchars := make([]uint16, numBytes)
                var p *uint16
                if len(b) > 0 {
                        p = &wchars[0]