|
|
@ -114,13 +114,13 @@ func createChunk(data []byte, name string) ChunkData {
|
|
|
|
rawLength := make([]byte, 4)
|
|
|
|
rawLength := make([]byte, 4)
|
|
|
|
binary.BigEndian.PutUint32(rawLength, uint32(len(data)))
|
|
|
|
binary.BigEndian.PutUint32(rawLength, uint32(len(data)))
|
|
|
|
rawName := []byte(name)
|
|
|
|
rawName := []byte(name)
|
|
|
|
dataAndName := make([]byte, 0) // len(rawName) + len(data)
|
|
|
|
dataAndName := make([]byte, 0)
|
|
|
|
dataAndName = append(dataAndName, rawName...)
|
|
|
|
dataAndName = append(dataAndName, rawName...)
|
|
|
|
dataAndName = append(dataAndName, data...)
|
|
|
|
dataAndName = append(dataAndName, data...)
|
|
|
|
crc := crc32.ChecksumIEEE(dataAndName)
|
|
|
|
crc := crc32.ChecksumIEEE(dataAndName)
|
|
|
|
rawCrc := make([]byte, 4)
|
|
|
|
rawCrc := make([]byte, 4)
|
|
|
|
binary.BigEndian.PutUint32(rawCrc, crc)
|
|
|
|
binary.BigEndian.PutUint32(rawCrc, crc)
|
|
|
|
fullData := make([]byte, 0) // len(rawLength) + len(dataAndName) + 4
|
|
|
|
fullData := make([]byte, 0)
|
|
|
|
fullData = append(fullData, rawLength...)
|
|
|
|
fullData = append(fullData, rawLength...)
|
|
|
|
fullData = append(fullData, dataAndName...)
|
|
|
|
fullData = append(fullData, dataAndName...)
|
|
|
|
fullData = append(fullData, rawCrc...)
|
|
|
|
fullData = append(fullData, rawCrc...)
|
|
|
|