codec/mjpeg/jpeg.go: don't need to convert jfifLabel string to []byte for copy

This commit is contained in:
Saxon 2020-01-07 13:11:25 +10:30
parent 38c4972a76
commit 4325b86a99
1 changed files with 2 additions and 3 deletions

View File

@ -305,9 +305,8 @@ func writeHeader(p []byte, _type, width, height, nbqTab int, dri uint16, qtable
binary.BigEndian.PutUint16(p[idx+4:], jfifHeadLen) binary.BigEndian.PutUint16(p[idx+4:], jfifHeadLen)
idx += 6 idx += 6
src := []byte(jfifLabel) copy(p[idx:], jfifLabel)
copy(p[idx:], src) idx += len(jfifLabel)
idx += len(src)
binary.BigEndian.PutUint16(p[idx:], jfifVer) binary.BigEndian.PutUint16(p[idx:], jfifVer)
p[idx+2] = jfifDensityUnit p[idx+2] = jfifDensityUnit