mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 15:02:19 +00:00
Grow buffer each time
This commit is contained in:
parent
67ef07cac5
commit
36a890a914
@ -143,7 +143,6 @@ func StartASCIIArtStream(streamID string, reader io.ReadCloser) {
|
|||||||
currentMessage[streamID] = new(string)
|
currentMessage[streamID] = new(string)
|
||||||
pixelBuff := make([]byte, Cfg.Width*Cfg.Height)
|
pixelBuff := make([]byte, Cfg.Width*Cfg.Height)
|
||||||
textBuff := strings.Builder{}
|
textBuff := strings.Builder{}
|
||||||
textBuff.Grow((2*Cfg.Width + 1) * Cfg.Height)
|
|
||||||
for {
|
for {
|
||||||
n, err := reader.Read(pixelBuff)
|
n, err := reader.Read(pixelBuff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -157,6 +156,7 @@ func StartASCIIArtStream(streamID string, reader io.ReadCloser) {
|
|||||||
|
|
||||||
// Header
|
// Header
|
||||||
textBuff.Reset()
|
textBuff.Reset()
|
||||||
|
textBuff.Grow((2*Cfg.Width + 1) * Cfg.Height)
|
||||||
for i := 0; i < 42; i++ {
|
for i := 0; i < 42; i++ {
|
||||||
textBuff.WriteByte('\n')
|
textBuff.WriteByte('\n')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user