mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 09:12:19 +00:00
Telnet: Preallocate pixel variable
This commit is contained in:
parent
1e712b2795
commit
868ee12726
@ -143,6 +143,7 @@ func StartASCIIArtStream(streamID string, reader io.ReadCloser) {
|
||||
currentMessage[streamID] = new(string)
|
||||
buff := make([]byte, Cfg.Width*Cfg.Height)
|
||||
header := "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
|
||||
var pixel byte
|
||||
for {
|
||||
n, _ := reader.Read(buff)
|
||||
if n == 0 {
|
||||
@ -151,7 +152,7 @@ func StartASCIIArtStream(streamID string, reader io.ReadCloser) {
|
||||
imageStr := ""
|
||||
for j := 0; j < Cfg.Height; j++ {
|
||||
for i := 0; i < Cfg.Width; i++ {
|
||||
pixel := buff[Cfg.Width*j+i]
|
||||
pixel = buff[Cfg.Width*j+i]
|
||||
imageStr += asciiChar(pixel) + asciiChar(pixel)
|
||||
}
|
||||
imageStr += "\n"
|
||||
|
Loading…
Reference in New Issue
Block a user