chore: pin GH commits and switch to golangci-lint (#4444)
* chore: pin GH commits * switch to golangci-lint-action * fix lint issues
This commit is contained in:
@@ -103,7 +103,7 @@ func (w *BitStreamWriter) writePartialByte(source uint8, sourceBitCount int, tar
|
||||
}
|
||||
|
||||
func (w *BitStreamWriter) WriteNonSymmetric(val, numValues uint32) error {
|
||||
if !(val < numValues && numValues <= 1<<31) {
|
||||
if val >= numValues || numValues > 1<<31 {
|
||||
return fmt.Errorf("invalid argument, val %d, numValues %d", val, numValues)
|
||||
}
|
||||
if numValues == 1 {
|
||||
|
||||
@@ -229,12 +229,13 @@ func (r *DependencyDescriptorReader) readTemplateLayers() error {
|
||||
}
|
||||
nextLayerIdc = nextLayerIdcType(idc)
|
||||
|
||||
if nextLayerIdc == nextTemporalLayer {
|
||||
switch nextLayerIdc {
|
||||
case nextTemporalLayer:
|
||||
temporalId++
|
||||
if temporalId >= MaxTemporalIds {
|
||||
return ErrDDReaderTooManyTemporalLayers
|
||||
}
|
||||
} else if nextLayerIdc == nextSpatialLayer {
|
||||
case nextSpatialLayer:
|
||||
spatialId++
|
||||
temporalId = 0
|
||||
if spatialId >= MaxSpatialIds {
|
||||
@@ -242,7 +243,7 @@ func (r *DependencyDescriptorReader) readTemplateLayers() error {
|
||||
}
|
||||
}
|
||||
|
||||
if !(nextLayerIdc != noMoreLayer && r.buffer.Ok()) {
|
||||
if nextLayerIdc == noMoreLayer || !r.buffer.Ok() {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,8 +246,8 @@ func (w *DependencyDescriptorWriter) writeExtendedFields() error {
|
||||
}
|
||||
|
||||
func (w *DependencyDescriptorWriter) writeTemplateDependencyStructure() error {
|
||||
if !(w.structure.StructureId >= 0 && w.structure.StructureId < MaxTemplates &&
|
||||
w.structure.NumDecodeTargets > 0 && w.structure.NumDecodeTargets <= MaxDecodeTargets) {
|
||||
if w.structure.StructureId < 0 || w.structure.StructureId >= MaxTemplates ||
|
||||
w.structure.NumDecodeTargets <= 0 || w.structure.NumDecodeTargets > MaxDecodeTargets {
|
||||
return fmt.Errorf("invalid arguments, structureId: %d, numDecodeTargets: %d", w.structure.StructureId, w.structure.NumDecodeTargets)
|
||||
}
|
||||
|
||||
@@ -283,8 +283,8 @@ func (w *DependencyDescriptorWriter) writeTemplateDependencyStructure() error {
|
||||
}
|
||||
|
||||
func (w *DependencyDescriptorWriter) writeTemplateLayers() error {
|
||||
if !(len(w.structure.Templates) > 0 && len(w.structure.Templates) <= MaxTemplates &&
|
||||
w.structure.Templates[0].SpatialId == 0 && w.structure.Templates[0].TemporalId == 0) {
|
||||
if len(w.structure.Templates) <= 0 || len(w.structure.Templates) > MaxTemplates ||
|
||||
w.structure.Templates[0].SpatialId != 0 || w.structure.Templates[0].TemporalId != 0 {
|
||||
return fmt.Errorf("invalid templates, len %d, templates[0]: spatialId %d, temporalId %d", len(w.structure.Templates), w.structure.Templates[0].SpatialId, w.structure.Templates[0].TemporalId)
|
||||
}
|
||||
for i := 1; i < len(w.structure.Templates); i++ {
|
||||
|
||||
Reference in New Issue
Block a user