mirror of
https://github.com/wader/fq.git
synced 2024-11-26 21:55:57 +03:00
Merge pull request #324 from wader/cleanup-linters
dev: Cleanup linters and fix some unused args
This commit is contained in:
commit
8325751ca0
@ -1,44 +1,43 @@
|
||||
linters:
|
||||
enable:
|
||||
- revive
|
||||
- errname
|
||||
- goimports
|
||||
- nilerr
|
||||
- forcetypeassert
|
||||
- asciicheck
|
||||
- bodyclose
|
||||
- durationcheck
|
||||
- errorlint
|
||||
- noctx
|
||||
- misspell
|
||||
- exportloopref
|
||||
- unconvert
|
||||
- unparam
|
||||
- wastedassign
|
||||
- makezero
|
||||
- exhaustive
|
||||
- gosec
|
||||
- nolintlint
|
||||
- nakedret
|
||||
- predeclared
|
||||
- tagliatelle
|
||||
|
||||
run:
|
||||
skip-dirs:
|
||||
- dev
|
||||
- doc
|
||||
|
||||
enable:
|
||||
- asciicheck
|
||||
- bodyclose
|
||||
- durationcheck
|
||||
- errname
|
||||
- errorlint
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- forcetypeassert
|
||||
- goimports
|
||||
- gosec
|
||||
- makezero
|
||||
- misspell
|
||||
- nakedret
|
||||
- nilerr
|
||||
- noctx
|
||||
- nolintlint
|
||||
- nosprintfhostport
|
||||
- predeclared
|
||||
- revive
|
||||
- tagliatelle
|
||||
- unconvert
|
||||
- unparam
|
||||
- wastedassign
|
||||
linters-settings:
|
||||
misspell:
|
||||
ignore-words:
|
||||
# elf RELA
|
||||
- rela
|
||||
- equalisation
|
||||
- synchronisation
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
gosec:
|
||||
excludes:
|
||||
# allow md5
|
||||
- G401
|
||||
- G501
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: true
|
||||
gosec:
|
||||
excludes:
|
||||
- G401
|
||||
- G501
|
||||
misspell:
|
||||
ignore-words:
|
||||
# elf RELA
|
||||
- rela
|
||||
- equalisation
|
||||
- synchronisation
|
||||
run:
|
||||
skip-dirs:
|
||||
# allow md5
|
||||
- dev
|
||||
- doc
|
||||
|
@ -1,4 +1,4 @@
|
||||
func decode(d *decode.D, in any) any {
|
||||
func decode(d *decode.D, _ any) any {
|
||||
d.FieldArray("headers", func(d *decode.D) {
|
||||
for !d.End() {
|
||||
d.TryFieldFormat("header", headerGroup)
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func apev2Decode(d *decode.D, in any) any {
|
||||
func apev2Decode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
headerFooterFn := func(d *decode.D, name string) uint64 {
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func decodeAr(d *decode.D, in any) any {
|
||||
func decodeAr(d *decode.D, _ any) any {
|
||||
d.FieldUTF8("signature", 8, d.AssertStr("!<arch>\n"))
|
||||
d.FieldArray("files", func(d *decode.D) {
|
||||
for !d.End() {
|
||||
|
@ -414,7 +414,7 @@ func decodeASN1BERValue(d *decode.D, bib *bitio.Buffer, sb *strings.Builder, par
|
||||
})
|
||||
}
|
||||
|
||||
func decodeASN1BER(d *decode.D, in any) any {
|
||||
func decodeASN1BER(d *decode.D, _ any) any {
|
||||
decodeASN1BERValue(d, nil, nil, formConstructed, universalTypeSequence)
|
||||
return nil
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func ccrDecode(d *decode.D, in any) any {
|
||||
func ccrDecode(d *decode.D, _ any) any {
|
||||
d.FieldU1("marker")
|
||||
d.FieldU7("version")
|
||||
d.FieldU3("seq_profile")
|
||||
|
@ -25,7 +25,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func frameDecode(d *decode.D, in any) any {
|
||||
func frameDecode(d *decode.D, _ any) any {
|
||||
for d.NotEnd() {
|
||||
d.FieldFormat("obu", obuFormat, nil)
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func decodeLeb128(d *decode.D) uint64 {
|
||||
return v
|
||||
}
|
||||
|
||||
func obuDecode(d *decode.D, in any) any {
|
||||
func obuDecode(d *decode.D, _ any) any {
|
||||
var obuType uint64
|
||||
var obuSize int64
|
||||
hasExtension := false
|
||||
|
@ -124,7 +124,7 @@ func decodeBlockCodec(d *decode.D, dataSize int64, codec string) *bytes.Buffer {
|
||||
return bb
|
||||
}
|
||||
|
||||
func decodeAvroOCF(d *decode.D, in any) any {
|
||||
func decodeAvroOCF(d *decode.D, _ any) any {
|
||||
header := decodeHeader(d)
|
||||
|
||||
decodeFn, err := decoders.DecodeFnForSchema(header.Schema)
|
||||
|
@ -90,7 +90,7 @@ func decodeBencodeValue(d *decode.D) {
|
||||
}
|
||||
}
|
||||
|
||||
func decodeBencode(d *decode.D, in any) any {
|
||||
func decodeBencode(d *decode.D, _ any) any {
|
||||
decodeBencodeValue(d)
|
||||
return nil
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func decodeBSONDocument(d *decode.D) {
|
||||
})
|
||||
}
|
||||
|
||||
func decodeBSON(d *decode.D, in any) any {
|
||||
func decodeBSON(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
decodeBSONDocument(d)
|
||||
|
@ -48,7 +48,7 @@ func (bfr bitFlipReader) Read(p []byte) (n int, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
func bzip2Decode(d *decode.D, in any) any {
|
||||
func bzip2Decode(d *decode.D, _ any) any {
|
||||
// moreStreams := true
|
||||
|
||||
// d.FieldArray("streams", func(d *decode.D) {
|
||||
|
@ -262,7 +262,7 @@ func decodeCBORValue(d *decode.D) any {
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
func decodeCBOR(d *decode.D, in any) any {
|
||||
func decodeCBOR(d *decode.D, _ any) any {
|
||||
decodeCBORValue(d)
|
||||
return nil
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ func elfDecodeSectionHeaders(d *decode.D, ec elfContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func elfDecode(d *decode.D, in any) any {
|
||||
func elfDecode(d *decode.D, _ any) any {
|
||||
var ec elfContext
|
||||
|
||||
d.FieldStruct("header", func(d *decode.D) { elfDecodeHeader(d, &ec) })
|
||||
|
@ -16,7 +16,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func fairPlaySPCDecode(d *decode.D, in any) any {
|
||||
func fairPlaySPCDecode(d *decode.D, _ any) any {
|
||||
d.FieldU32("version")
|
||||
d.FieldRawLen("reserved", 32)
|
||||
d.FieldRawLen("iv", 16*8)
|
||||
|
@ -35,7 +35,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func flacDecode(d *decode.D, in any) any {
|
||||
func flacDecode(d *decode.D, _ any) any {
|
||||
d.FieldUTF8("magic", 4, d.AssertStr("fLaC"))
|
||||
|
||||
var streamInfo format.FlacStreamInfo
|
||||
|
@ -49,7 +49,7 @@ var metadataBlockNames = scalar.UToSymStr{
|
||||
MetadataBlockPicture: "picture",
|
||||
}
|
||||
|
||||
func metadatablockDecode(d *decode.D, in any) any {
|
||||
func metadatablockDecode(d *decode.D, _ any) any {
|
||||
var hasStreamInfo bool
|
||||
var streamInfo format.FlacStreamInfo
|
||||
|
||||
|
@ -23,7 +23,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func metadatablocksDecode(d *decode.D, in any) any {
|
||||
func metadatablocksDecode(d *decode.D, _ any) any {
|
||||
flacMetadatablocksOut := format.FlacMetadatablocksOut{}
|
||||
|
||||
isLastBlock := false
|
||||
|
@ -44,7 +44,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func pictureDecode(d *decode.D, in any) any {
|
||||
func pictureDecode(d *decode.D, _ any) any {
|
||||
lenStr := func(name string) string {
|
||||
l := d.FieldU32(name + "_length")
|
||||
return d.FieldUTF8(name, int(l))
|
||||
|
@ -15,7 +15,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func streaminfoDecode(d *decode.D, in any) any {
|
||||
func streaminfoDecode(d *decode.D, _ any) any {
|
||||
d.FieldU16("minimum_block_size")
|
||||
d.FieldU16("maximum_block_size")
|
||||
d.FieldU24("minimum_frame_size")
|
||||
|
@ -65,7 +65,7 @@ var typeNames = scalar.UToSymStr{
|
||||
typeLongString: "LongString",
|
||||
}
|
||||
|
||||
func flvDecode(d *decode.D, in any) any {
|
||||
func flvDecode(d *decode.D, _ any) any {
|
||||
var fieldScriptDataObject func()
|
||||
var fieldScriptDataVariable func(d *decode.D, name string)
|
||||
|
||||
|
@ -51,7 +51,7 @@ func fieldColorMap(d *decode.D, name string, bitDepth int) {
|
||||
})
|
||||
}
|
||||
|
||||
func gifDecode(d *decode.D, in any) any {
|
||||
func gifDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
d.FieldUTF8("header", 6, d.AssertStr("GIF87a", "GIF89a"))
|
||||
|
@ -57,7 +57,7 @@ var deflateExtraFlagsNames = scalar.UToSymStr{
|
||||
4: "fast",
|
||||
}
|
||||
|
||||
func gzDecode(d *decode.D, in any) any {
|
||||
func gzDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
d.FieldRawLen("identification", 2*8, d.AssertBitBuf([]byte("\x1f\x8b")))
|
||||
|
@ -81,7 +81,7 @@ func decodeBCDU8(d *decode.D) uint64 {
|
||||
return (n>>4)*10 + n&0xf
|
||||
}
|
||||
|
||||
func iccProfileDecode(d *decode.D, in any) any {
|
||||
func iccProfileDecode(d *decode.D, _ any) any {
|
||||
/*
|
||||
0..3 Profile size uInt32Number
|
||||
4..7 CMM Type signature see below
|
||||
|
@ -18,7 +18,7 @@ func init() {
|
||||
}
|
||||
|
||||
// Decode ID3v1 tag
|
||||
func id3v1Decode(d *decode.D, in any) any {
|
||||
func id3v1Decode(d *decode.D, _ any) any {
|
||||
d.AssertAtLeastBitsLeft(128 * 8)
|
||||
d.FieldUTF8("magic", 3, d.AssertStr("TAG"))
|
||||
if d.PeekBits(8) == uint64('+') {
|
||||
|
@ -15,7 +15,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func id3v11Decode(d *decode.D, in any) any {
|
||||
func id3v11Decode(d *decode.D, _ any) any {
|
||||
d.AssertAtLeastBitsLeft(128 * 8)
|
||||
d.FieldUTF8("magic", 4, d.AssertStr("TAG+"))
|
||||
d.FieldUTF8("title", 60)
|
||||
|
@ -545,7 +545,7 @@ func decodeFrame(d *decode.D, version int) uint64 {
|
||||
// TODO: DecodeFn
|
||||
// TODO: unknown after frame decode
|
||||
unsyncedBR := d.NewBitBufFromReader(unsyncReader{Reader: bitio.NewIOReader(d.BitBufRange(d.Pos(), int64(dataSize)*8))})
|
||||
d.FieldFormatBitBuf("unsync", unsyncedBR, decode.FormatFn(func(d *decode.D, in any) any {
|
||||
d.FieldFormatBitBuf("unsync", unsyncedBR, decode.FormatFn(func(d *decode.D, _ any) any {
|
||||
if fn, ok := frames[idNormalized]; ok {
|
||||
fn(d)
|
||||
} else {
|
||||
@ -586,7 +586,7 @@ func decodeFrames(d *decode.D, version int, size uint64) {
|
||||
}
|
||||
}
|
||||
|
||||
func id3v2Decode(d *decode.D, in any) any {
|
||||
func id3v2Decode(d *decode.D, _ any) any {
|
||||
d.AssertAtLeastBitsLeft(4 * 8)
|
||||
d.FieldUTF8("magic", 3, d.AssertStr("ID3"))
|
||||
version := int(d.FieldU8("version"))
|
||||
|
@ -164,7 +164,7 @@ var markers = scalar.UToScalar{
|
||||
TEM: {Sym: "tem", Description: "For temporary private use in arithmetic coding"},
|
||||
}
|
||||
|
||||
func jpegDecode(d *decode.D, in any) any {
|
||||
func jpegDecode(d *decode.D, _ any) any {
|
||||
d.AssertLeastBytesLeft(2)
|
||||
if !bytes.Equal(d.PeekBytes(2), []byte{0xff, SOI}) {
|
||||
d.Errorf("no SOI marker")
|
||||
|
@ -25,7 +25,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func decodeJSON(d *decode.D, in any) any {
|
||||
func decodeJSON(d *decode.D, _ any) any {
|
||||
br := d.RawLen(d.Len())
|
||||
jd := stdjson.NewDecoder(bitio.NewIOReader(br))
|
||||
var s scalar.S
|
||||
|
@ -355,7 +355,7 @@ var sectionTypes = scalar.UToSymStr{
|
||||
0x15: "thread_local_init_function_pointers",
|
||||
}
|
||||
|
||||
func machoDecode(d *decode.D, in any) any {
|
||||
func machoDecode(d *decode.D, _ any) any {
|
||||
ofileDecode(d)
|
||||
return nil
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ func decodeMaster(d *decode.D, bitsLimit int64, tag ebml.Tag, dc *decodeContext)
|
||||
|
||||
}
|
||||
|
||||
func matroskaDecode(d *decode.D, in any) any {
|
||||
func matroskaDecode(d *decode.D, _ any) any {
|
||||
ebmlHeaderID := uint64(0x1a45dfa3)
|
||||
if d.PeekBits(32) != ebmlHeaderID {
|
||||
d.Errorf("no EBML header found")
|
||||
|
@ -16,7 +16,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func xingDecode(d *decode.D, in any) any {
|
||||
func xingDecode(d *decode.D, _ any) any {
|
||||
// TODO: info has lame extension?
|
||||
hasLameExtension := false
|
||||
switch d.FieldUTF8("header", 4) {
|
||||
|
@ -25,7 +25,7 @@ var recordTypeNames = scalar.UToSymStr{
|
||||
recordTypeLicenseStore: "License store",
|
||||
}
|
||||
|
||||
func playreadyPsshDecode(d *decode.D, in any) any {
|
||||
func playreadyPsshDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
d.FieldU32("size")
|
||||
|
@ -22,7 +22,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func adtsDecoder(d *decode.D, in any) any {
|
||||
func adtsDecoder(d *decode.D, _ any) any {
|
||||
validFrames := 0
|
||||
for !d.End() {
|
||||
if dv, _, _ := d.TryFieldFormat("frame", adtsFrame, nil); dv == nil {
|
||||
|
@ -29,7 +29,7 @@ var protectionAbsentNames = scalar.BoolToDescription{
|
||||
false: "Has CRC",
|
||||
}
|
||||
|
||||
func adtsFrameDecoder(d *decode.D, in any) any {
|
||||
func adtsFrameDecoder(d *decode.D, _ any) any {
|
||||
|
||||
/*
|
||||
adts_frame() {
|
||||
|
@ -116,7 +116,7 @@ func avcDcrParameterSet(d *decode.D, numParamSets uint64) {
|
||||
}
|
||||
}
|
||||
|
||||
func avcDcrDecode(d *decode.D, in any) any {
|
||||
func avcDcrDecode(d *decode.D, _ any) any {
|
||||
d.FieldU8("configuration_version")
|
||||
d.FieldU8("profile_indication", avcProfileNames)
|
||||
d.FieldU8("profile_compatibility")
|
||||
|
@ -98,7 +98,7 @@ var sliceNames = scalar.UToSymStr{
|
||||
9: "si",
|
||||
}
|
||||
|
||||
func avcNALUDecode(d *decode.D, in any) any {
|
||||
func avcNALUDecode(d *decode.D, _ any) any {
|
||||
d.FieldBool("forbidden_zero_bit")
|
||||
d.FieldU2("nal_ref_idc")
|
||||
nalType := d.FieldU5("nal_unit_type", avcNALNames)
|
||||
|
@ -20,7 +20,7 @@ func moreRBSPData(d *decode.D) bool {
|
||||
return l >= 8 && d.PeekBits(8) != 0b1000_0000
|
||||
}
|
||||
|
||||
func avcPPSDecode(d *decode.D, in any) any {
|
||||
func avcPPSDecode(d *decode.D, _ any) any {
|
||||
d.FieldUFn("pic_parameter_set_id", uEV)
|
||||
d.FieldUFn("seq_parameter_set_id", uEV)
|
||||
d.FieldBool("entropy_coding_mode_flag")
|
||||
|
@ -101,7 +101,7 @@ func ffSum(d *decode.D) uint64 {
|
||||
return s
|
||||
}
|
||||
|
||||
func avcSEIDecode(d *decode.D, in any) any {
|
||||
func avcSEIDecode(d *decode.D, _ any) any {
|
||||
payloadType := d.FieldUFn("payload_type", func(d *decode.D) uint64 { return ffSum(d) }, seiNames)
|
||||
payloadSize := d.FieldUFn("payload_size", func(d *decode.D) uint64 { return ffSum(d) })
|
||||
|
||||
|
@ -134,7 +134,7 @@ func avcHdrParameters(d *decode.D) {
|
||||
d.FieldU5("time_offset_length")
|
||||
}
|
||||
|
||||
func avcSPSDecode(d *decode.D, in any) any {
|
||||
func avcSPSDecode(d *decode.D, _ any) any {
|
||||
profileIdc := d.FieldU8("profile_idc", avcProfileNames)
|
||||
d.FieldBool("constraint_set0_flag")
|
||||
d.FieldBool("constraint_set1_flag")
|
||||
|
@ -20,7 +20,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func hevcDcrDecode(d *decode.D, in any) any {
|
||||
func hevcDcrDecode(d *decode.D, _ any) any {
|
||||
d.FieldU8("configuration_version")
|
||||
d.FieldU2("general_profile_space")
|
||||
d.FieldU1("general_tier_flag")
|
||||
|
@ -82,7 +82,7 @@ var hevcNALNames = scalar.UToSymStr{
|
||||
47: "RSV_NVCL47",
|
||||
}
|
||||
|
||||
func hevcNALUDecode(d *decode.D, in any) any {
|
||||
func hevcNALUDecode(d *decode.D, _ any) any {
|
||||
d.FieldBool("forbidden_zero_bit")
|
||||
nalType := d.FieldU6("nal_unit_type", hevcNALNames)
|
||||
d.FieldU6("nuh_layer_id")
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
}
|
||||
|
||||
// H.265 page 36
|
||||
func hevcPPSDecode(d *decode.D, in any) any {
|
||||
func hevcPPSDecode(d *decode.D, _ any) any {
|
||||
d.FieldUFn("pps_pic_parameter_set_id", uEV)
|
||||
d.FieldUFn("pps_seq_parameter_set_id", uEV)
|
||||
d.FieldBool("dependent_slice_segments_enabled_flag")
|
||||
|
@ -241,7 +241,7 @@ func hevcVuiParameters(d *decode.D, spsMaxSubLayersMinus1 uint64) {
|
||||
}
|
||||
|
||||
// H.265 page 34
|
||||
func hevcSPSDecode(d *decode.D, in any) any {
|
||||
func hevcSPSDecode(d *decode.D, _ any) any {
|
||||
d.FieldU4("sps_video_parameter_set_id")
|
||||
spsMaxSubLayersMinus1 := d.FieldU3("sps_max_sub_layers_minus1")
|
||||
d.FieldBool("sps_temporal_id_nesting_flag")
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
}
|
||||
|
||||
// H.265 page 33
|
||||
func hevcVPSDecode(d *decode.D, in any) any {
|
||||
func hevcVPSDecode(d *decode.D, _ any) any {
|
||||
d.FieldU4("vps_video_parameter_set_id")
|
||||
d.FieldBool("vps_base_layer_internal_flag")
|
||||
d.FieldBool("vps_base_layer_available_flag")
|
||||
|
@ -140,7 +140,7 @@ var protectionNames = scalar.BoolToDescription{
|
||||
false: "Has CRC",
|
||||
}
|
||||
|
||||
func frameDecode(d *decode.D, in any) any {
|
||||
func frameDecode(d *decode.D, _ any) any {
|
||||
const headerBytes = 4
|
||||
var sideInfoBytes int64
|
||||
var isStereo bool
|
||||
|
@ -44,7 +44,7 @@ var channelConfigurationNames = scalar.UToDescription{
|
||||
7: "front-center, front-left, front-right, side-left, side-right, back-left, back-right, LFE-channel",
|
||||
}
|
||||
|
||||
func ascDecoder(d *decode.D, in any) any {
|
||||
func ascDecoder(d *decode.D, _ any) any {
|
||||
objectType := d.FieldUFn("object_type", decodeEscapeValueCarryFn(5, 6, 0), format.MPEGAudioObjectTypeNames)
|
||||
d.FieldUFn("sampling_frequency", decodeEscapeValueAbsFn(4, 24, 0), frequencyIndexHzMap)
|
||||
d.FieldU4("channel_configuration", channelConfigurationNames)
|
||||
|
@ -172,7 +172,7 @@ type esDecodeContext struct {
|
||||
decoderConfigs []format.MpegDecoderConfig
|
||||
}
|
||||
|
||||
func odDecodeTag(d *decode.D, edc *esDecodeContext, expectedTagID int, fn func(d *decode.D)) {
|
||||
func odDecodeTag(d *decode.D, edc *esDecodeContext, _ int, fn func(d *decode.D)) {
|
||||
odDecoders := map[uint64]func(d *decode.D){
|
||||
ES_DescrTag: func(d *decode.D) {
|
||||
d.FieldU16("es_id")
|
||||
@ -276,7 +276,7 @@ func odDecodeTag(d *decode.D, edc *esDecodeContext, expectedTagID int, fn func(d
|
||||
}
|
||||
}
|
||||
|
||||
func esDecode(d *decode.D, in any) any {
|
||||
func esDecode(d *decode.D, _ any) any {
|
||||
var edc esDecodeContext
|
||||
odDecodeTag(d, &edc, -1, nil)
|
||||
return format.MpegEsOut{DecoderConfigs: edc.decoderConfigs}
|
||||
|
@ -33,7 +33,7 @@ type subStream struct {
|
||||
l int
|
||||
}
|
||||
|
||||
func pesDecode(d *decode.D, in any) any {
|
||||
func pesDecode(d *decode.D, _ any) any {
|
||||
substreams := map[int]*subStream{}
|
||||
|
||||
prefix := d.PeekBits(24)
|
||||
|
@ -69,7 +69,7 @@ var mpegVersion = scalar.UToDescription{
|
||||
0b10: "MPEG1",
|
||||
}
|
||||
|
||||
func pesPacketDecode(d *decode.D, in any) any {
|
||||
func pesPacketDecode(d *decode.D, _ any) any {
|
||||
var v any
|
||||
|
||||
d.FieldU24("prefix", d.AssertU(0b0000_0000_0000_0000_0000_0001), scalar.ActualBin)
|
||||
|
@ -99,7 +99,7 @@ func decodeLines(d *decode.D, lines int, width int) []string {
|
||||
return ls
|
||||
}
|
||||
|
||||
func spuDecode(d *decode.D, in any) any {
|
||||
func spuDecode(d *decode.D, _ any) any {
|
||||
d.FieldU16("size")
|
||||
dcsqtOffset := d.FieldU16("dcsqt_offset")
|
||||
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
|
||||
// TODO: ts_packet
|
||||
|
||||
func tsDecode(d *decode.D, in any) any {
|
||||
func tsDecode(d *decode.D, _ any) any {
|
||||
d.FieldU8("sync", d.AssertU(0x47), scalar.ActualHex)
|
||||
d.FieldBool("transport_error_indicator")
|
||||
d.FieldBool("payload_unit_start")
|
||||
|
@ -17,7 +17,7 @@ func init() {
|
||||
|
||||
// transform to binary using fn
|
||||
func makeBinaryTransformFn(fn func(r io.Reader) (io.Reader, error)) func(i *interp.Interp, c any) any {
|
||||
return func(i *interp.Interp, c any) any {
|
||||
return func(_ *interp.Interp, c any) any {
|
||||
inBR, err := interp.ToBitReader(c)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -153,7 +153,7 @@ func decodeMsgPackValue(d *decode.D) {
|
||||
}
|
||||
}
|
||||
|
||||
func decodeMsgPack(d *decode.D, in any) any {
|
||||
func decodeMsgPack(d *decode.D, _ any) any {
|
||||
decodeMsgPackValue(d)
|
||||
return nil
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ type stream struct {
|
||||
flacStreamInfo format.FlacStreamInfo
|
||||
}
|
||||
|
||||
func decodeOgg(d *decode.D, in any) any {
|
||||
func decodeOgg(d *decode.D, _ any) any {
|
||||
validPages := 0
|
||||
streams := map[uint32]*stream{}
|
||||
streamsD := d.FieldArrayValue("streams")
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func pageDecode(d *decode.D, in any) any {
|
||||
func pageDecode(d *decode.D, _ any) any {
|
||||
p := format.OggPageOut{}
|
||||
startPos := d.Pos()
|
||||
|
||||
|
@ -23,7 +23,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func opusDecode(d *decode.D, in any) any {
|
||||
func opusDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
var prefix []byte
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func decodePcap(d *decode.D, in any) any {
|
||||
func decodePcap(d *decode.D, _ any) any {
|
||||
endian := d.FieldU32("magic", d.AssertU(bigEndian, littleEndian), endianMap, scalar.ActualHex)
|
||||
switch endian {
|
||||
case bigEndian:
|
||||
|
@ -361,7 +361,7 @@ type decodeContext struct {
|
||||
flowDecoder *flowsdecoder.Decoder
|
||||
}
|
||||
|
||||
func decodePcapng(d *decode.D, in any) any {
|
||||
func decodePcapng(d *decode.D, _ any) any {
|
||||
sectionHeaders := 0
|
||||
for !d.End() {
|
||||
fd := flowsdecoder.New()
|
||||
|
@ -77,7 +77,7 @@ var colorTypeMap = scalar.UToSymStr{
|
||||
colorTypeRGBA: "rgba",
|
||||
}
|
||||
|
||||
func pngDecode(d *decode.D, in any) any {
|
||||
func pngDecode(d *decode.D, _ any) any {
|
||||
iEndFound := false
|
||||
var colorType uint64
|
||||
|
||||
@ -127,7 +127,7 @@ func pngDecode(d *decode.D, in any) any {
|
||||
|
||||
switch compressionMethod {
|
||||
case compressionDeflate:
|
||||
d.FieldFormatReaderLen("uncompressed", dataLen, zlib.NewReader, decode.FormatFn(func(d *decode.D, in any) any {
|
||||
d.FieldFormatReaderLen("uncompressed", dataLen, zlib.NewReader, decode.FormatFn(func(d *decode.D, _ any) any {
|
||||
d.FieldUTF8("text", int(d.BitsLeft()/8))
|
||||
return nil
|
||||
}))
|
||||
|
@ -22,7 +22,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func widevineDecode(d *decode.D, in any) any {
|
||||
func widevineDecode(d *decode.D, _ any) any {
|
||||
widewinePb := format.ProtoBufMessage{
|
||||
1: {Type: format.ProtoBufTypeEnum, Name: "algorithm", Enums: scalar.UToSymStr{
|
||||
0: "unencrypted",
|
||||
|
@ -10,6 +10,6 @@ func init() {
|
||||
interp.RegisterFormat(decode.Format{
|
||||
Name: format.RAW,
|
||||
Description: "Raw bits",
|
||||
DecodeFn: func(d *decode.D, in any) any { return nil },
|
||||
DecodeFn: func(d *decode.D, _ any) any { return nil },
|
||||
})
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ func amf0DecodeValue(d *decode.D) {
|
||||
}
|
||||
}
|
||||
|
||||
func amf0Decode(d *decode.D, in any) any {
|
||||
func amf0Decode(d *decode.D, _ any) any {
|
||||
amf0DecodeValue(d)
|
||||
return nil
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func tarDecode(d *decode.D, in any) any {
|
||||
func tarDecode(d *decode.D, _ any) any {
|
||||
const blockBytes = 512
|
||||
const blockBits = blockBytes * 8
|
||||
|
||||
|
@ -201,7 +201,7 @@ func decodeIfd(d *decode.D, s *strips, tagNames scalar.UToSymStr) int64 {
|
||||
return nextIfdOffset
|
||||
}
|
||||
|
||||
func tiffDecode(d *decode.D, in any) any {
|
||||
func tiffDecode(d *decode.D, _ any) any {
|
||||
endian := d.FieldU32("endian", endianNames, scalar.ActualHex)
|
||||
|
||||
switch endian {
|
||||
|
@ -23,7 +23,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func commentDecode(d *decode.D, in any) any {
|
||||
func commentDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
vendorLen := d.FieldU32("vendor_length")
|
||||
|
@ -38,7 +38,7 @@ var packetTypeNames = map[uint]string{
|
||||
packetTypeSetup: "Setup",
|
||||
}
|
||||
|
||||
func vorbisDecode(d *decode.D, in any) any {
|
||||
func vorbisDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
packetType := d.FieldUScalarFn("packet_type", func(d *decode.D) scalar.S {
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func vp8Decode(d *decode.D, in any) any {
|
||||
func vp8Decode(d *decode.D, _ any) any {
|
||||
var isKeyFrame bool
|
||||
|
||||
versions := map[uint64]struct {
|
||||
|
@ -18,7 +18,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func vp9CFMDecode(d *decode.D, in any) any {
|
||||
func vp9CFMDecode(d *decode.D, _ any) any {
|
||||
for d.NotEnd() {
|
||||
d.FieldStruct("feature", func(d *decode.D) {
|
||||
id := d.FieldU8("id", vp9FeatureIDNames)
|
||||
|
@ -107,7 +107,7 @@ func vp9DecodeFrameSize(d *decode.D) {
|
||||
d.FieldUFn("frame_height", func(d *decode.D) uint64 { return d.U16() + 1 })
|
||||
}
|
||||
|
||||
func vp9Decode(d *decode.D, in any) any {
|
||||
func vp9Decode(d *decode.D, _ any) any {
|
||||
|
||||
// TODO: header_size at end? even for show_existing_frame?
|
||||
|
||||
|
@ -16,7 +16,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func vpxCCRDecode(d *decode.D, in any) any {
|
||||
func vpxCCRDecode(d *decode.D, _ any) any {
|
||||
d.FieldU8("profile")
|
||||
d.FieldU8("level", vpxLevelNames)
|
||||
d.FieldU4("bit_depth")
|
||||
|
@ -201,7 +201,7 @@ func decodeChunks(d *decode.D, stringData bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func wavDecode(d *decode.D, in any) any {
|
||||
func wavDecode(d *decode.D, _ any) any {
|
||||
// there are wav files in the wild with id3v2 header id3v1 footer
|
||||
_, _, _ = d.TryFieldFormat("header", headerFormat, nil)
|
||||
|
||||
|
@ -41,7 +41,7 @@ func decodeChunk(d *decode.D, expectedChunkID string, fn func(d *decode.D)) bool
|
||||
return true
|
||||
}
|
||||
|
||||
func webpDecode(d *decode.D, in any) any {
|
||||
func webpDecode(d *decode.D, _ any) any {
|
||||
d.Endian = decode.LittleEndian
|
||||
|
||||
d.FieldUTF8("riff_id", 4, d.AssertStr("RIFF"))
|
||||
|
@ -122,7 +122,7 @@ func decode(ctx context.Context, br bitio.ReaderAtSeeker, group Group, opts Opti
|
||||
}
|
||||
|
||||
var minMaxRange ranges.Range
|
||||
if err := d.Value.WalkRootPreOrder(func(v *Value, rootV *Value, depth int, rootDepth int) error {
|
||||
if err := d.Value.WalkRootPreOrder(func(v *Value, _ *Value, _ int, _ int) error {
|
||||
minMaxRange = ranges.MinMax(minMaxRange, v.Range)
|
||||
v.Range.Start += decodeRange.Start
|
||||
v.RootReader = br
|
||||
@ -281,7 +281,7 @@ func (d *D) SharedReadBuf(n int) []byte {
|
||||
|
||||
func (d *D) FillGaps(r ranges.Range, namePrefix string) {
|
||||
makeWalkFn := func(fn func(iv *Value)) func(iv *Value, rootV *Value, depth int, rootDepth int) error {
|
||||
return func(iv *Value, rootV *Value, depth int, rootDepth int) error {
|
||||
return func(iv *Value, _ *Value, _ int, _ int) error {
|
||||
switch iv.V.(type) {
|
||||
case *Compound:
|
||||
default:
|
||||
@ -294,7 +294,7 @@ func (d *D) FillGaps(r ranges.Range, namePrefix string) {
|
||||
// TODO: redo this, tries to get rid of slice grow
|
||||
// TODO: pre-sorted somehow?
|
||||
n := 0
|
||||
_ = d.Value.WalkRootPreOrder(makeWalkFn(func(iv *Value) { n++ }))
|
||||
_ = d.Value.WalkRootPreOrder(makeWalkFn(func(_ *Value) { n++ }))
|
||||
valueRanges := make([]ranges.Range, n)
|
||||
i := 0
|
||||
_ = d.Value.WalkRootPreOrder(makeWalkFn(func(iv *Value) {
|
||||
|
@ -14,7 +14,7 @@ type Format struct {
|
||||
ProbeOrder int // probe order is from low to hi value then by name
|
||||
Description string
|
||||
Groups []string
|
||||
DecodeFn func(d *D, in any) any
|
||||
DecodeFn func(d *D, _ any) any
|
||||
DecodeInArg any
|
||||
DecodeOutType any
|
||||
RootArray bool
|
||||
@ -46,7 +46,7 @@ type FormatHelp struct {
|
||||
References []HelpReference
|
||||
}
|
||||
|
||||
func FormatFn(d func(d *D, in any) any) Group {
|
||||
func FormatFn(d func(d *D, _ any) any) Group {
|
||||
return Group{{
|
||||
DecodeFn: d,
|
||||
}}
|
||||
|
@ -68,7 +68,7 @@ func init() {
|
||||
RegisterFunc0("_exttype", (*Interp)._extType)
|
||||
|
||||
RegisterFunc0("_global_state", func(i *Interp, c any) any { return *i.state })
|
||||
RegisterFunc1("_global_state", func(i *Interp, c any, v any) any { *i.state = v; return v })
|
||||
RegisterFunc1("_global_state", func(i *Interp, _ any, v any) any { *i.state = v; return v })
|
||||
|
||||
RegisterFunc0("history", (*Interp).history)
|
||||
RegisterIter1("_display", (*Interp)._display)
|
||||
|
Loading…
Reference in New Issue
Block a user