From 38c4972a76bbee3065581f65fee185a06b02f27c Mon Sep 17 00:00:00 2001 From: Saxon Date: Tue, 7 Jan 2020 13:09:27 +1030 Subject: [PATCH] codec/mjpeg/jpeg.go: simplified some indexing --- codec/mjpeg/jpeg.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/codec/mjpeg/jpeg.go b/codec/mjpeg/jpeg.go index 91f691f6..edf93d27 100644 --- a/codec/mjpeg/jpeg.go +++ b/codec/mjpeg/jpeg.go @@ -299,12 +299,11 @@ func writeHeader(p []byte, _type, width, height, nbqTab int, dri uint16, qtable // Indicate start of image. idx := 0 binary.BigEndian.PutUint16(p[idx:], 0xff00|codeSOI) - idx += 2 // Write JFIF header. - binary.BigEndian.PutUint16(p[idx:], 0xff00|codeAPP0) - binary.BigEndian.PutUint16(p[idx+2:], jfifHeadLen) - idx += 4 + binary.BigEndian.PutUint16(p[idx+2:], 0xff00|codeAPP0) + binary.BigEndian.PutUint16(p[idx+4:], jfifHeadLen) + idx += 6 src := []byte(jfifLabel) copy(p[idx:], src)