// Check that a chunk of PVL is valid code.
// Will always accept valid code, but may not always notice invalidities.
341546
func validateChunk(m metaContext, pvl *pvlT, service keybase1.ProofType) libkb.ProofError {
	if pvl.PvlVersion != SupportedVersion {
		return libkb.NewProofError(keybase1.ProofStatus_INVALID_PVL,
			"PVL is for the wrong version %v != %v", pvl.PvlVersion, SupportedVersion)
	}

	debug(m, "valid version:%v revision:%v", pvl.PvlVersion, pvl.Revision)

	scripts, perr := chunkGetScripts(pvl, service)
	if perr != nil {
		return perr
	}
	if len(scripts) == 0 {
		return libkb.NewProofError(keybase1.ProofStatus_INVALID_PVL,
			"Empty scripts list for service: %v", service)
	}

	// Scan all the scripts (for this service) for errors. Report the first error.
	var errs []libkb.ProofError
	for whichscript, script := range scripts {
		perr = validateScript(m, &script, service, whichscript)
		errs = append(errs, perr)
	}
	return errs[0]
}
328969
func ValidatePersistentVolumeClaim(pvc *core.PersistentVolumeClaim) field.ErrorList {
	allErrs := ValidateObjectMeta(&pvc.ObjectMeta, true, ValidatePersistentVolumeName, field.NewPath("metadata"))
	allErrs = append(allErrs, ValidatePersistentVolumeClaimSpec(&pvc.Spec, field.NewPath("spec"))...)
	return allErrs
}
1080376
func (m *testRPC) CheckValidity(req *Request, secret string) bool {
	if mock := m.currentMocks(nil); mock != nil && mock.DestroyRPCClientMock != nil {
		return mock.CheckValidityMock(req, secret)
	}
	return false
}
479750
func ValidLangCode(c string) bool {
	for d := range LangCodes {
		if c == d {
			return true
		}
	}
	return false
}
1364010
func IsValidLanguageCode(s string) bool {
	_, _, err := LangCodeInfo(s)
	if err != nil {
		return false
	}
	return true
}
366665
func Valid(cpf string) bool {
	isValid, err := AssertValid(cpf)
	if err != nil {
		return false
	}
	return isValid
}
1330812
func AssertValid(cpf string) (bool, error) {
	cpf = sanitize(cpf)
	if len(cpf) != cpfValidLength {
		return false, errors.New(invalidLength)
	}
	for i := 0; i <= 9; i++ {
		if cpf == strings.Repeat(strconv.Itoa(i), 11) {
			return false, errors.New(repeatedDigits)
		}
	}
	return checkDigits(cpf), nil
}
779379
func validateSlice(rv reflect.Value) error {
	errs := Errors{}
	l := rv.Len()
	for i := 0; i < l; i++ {
		if ev := rv.Index(i).Interface(); ev != nil {
			if err := ev.(Validatable).Validate(); err != nil {
				errs[strconv.Itoa(i)] = err
			}
		}
	}
	if len(errs) > 0 {
		return errs
	}
	return nil
}
550880
func (p *Param) BoolTmpVarCode() string {
	const code = `var %s uint32
	if %s {
		%s = 1
	} else {
		%s = 0
	}`
	tmp := p.tmpVar()
	return fmt.Sprintf(code, tmp, p.Name, tmp, tmp)
}
1021435
func (a ARP) IsValid() bool {
	if len(a) < ARPSize {
		return false
	}
	const htypeEthernet = 1
	const macSize = 6
	return a.hardwareAddressSpace() == htypeEthernet &&
		a.protocolAddressSpace() == uint16(IPv4ProtocolNumber) &&
		a.hardwareAddressSize() == macSize &&
		a.protocolAddressSize() == IPv4AddressSize
}
587423
func (h Dense) IsValid() error {
	if len(h)%3 != 0 {
		return errors.New("hll byte size sould be a multiple of 3")
	}
	m := h.m()
	if m&(m-1) != 0 {
		return errors.New("hll byte size sould be 3 times a power of two")
	}
	var p byte
	for z := m; z != 0; z >>= 1 {
		p++
	}
	p--
	if p < 4 || p > 25 {
		return errors.New("p must be between 4 and 25, inclusive")
	}
	return nil
}
119744
func checkValid(data []byte, scan *scanner) error {
	scan.length_data = len(data)
	scan.reset()
	scan.endTop = true
	stream := streamByte{data: &data, pos: 0}
	op := scan.parseValue(&stream)

	if op == scanError {
		return scan.err
	}

	return nil
}
406487
func isValidInterface(s string) bool {
	if len(s) == 0 || len(s) > 255 || s[0] == '.' {
		return false
	}
	elem := strings.Split(s, ".")
	if len(elem) < 2 {
		return false
	}
	for _, v := range elem {
		if len(v) == 0 {
			return false
		}
		if v[0] >= '0' && v[0] <= '9' {
			return false
		}
		for _, c := range v {
			if !isMemberChar(c) {
				return false
			}
		}
	}
	return true
}
740697
func (tacl *tableACL) Valid() bool {
	tacl.RLock()
	defer tacl.RUnlock()
	return tacl.entries != nil
}
755253
func isValidURL(s string) bool {
	u, err := url.Parse(s)
	return err == nil && u.IsAbs()
}
602871
func (f *PkgFilter) IsFull() bool {
	// Batch validate bytes that are fully used.
	for i := uint16(0); i < f.count/8; i++ {
		if f.filter[i] != 0xFF {
			return false
		}
	}

	// If the count is not a multiple of 8, check that the filter contains
	// all remaining bits.
	rem := f.count % 8
	for idx := f.count - rem; idx < f.count; idx++ {
		if !f.Contains(idx) {
			return false
		}
	}

	return true
}
39989
func (m gwMetaV1) IsValid() bool {
	return ((m.Version == gwMetaVersion || m.Version == gwMetaVersion100) &&
		m.Format == gwMetaFormat)
}