// GetFailedLength returns the number of packages in the failed queue
16334
func (queue *Queue) GetFailedLength() int64 {
	return queue.redisClient.LLen(queueFailedKey(queue.Name)).Val()
}
513717
func (pk *PublicKeyV3) BitLength() (bitLength uint16, err error) {
	switch pk.PubKeyAlgo {
	case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
		bitLength = pk.n.bitLength
	default:
		err = errors.InvalidArgumentError("bad public-key algorithm")
	}
	return
}
371647
func (o *ElapseParams) validateLength(formats strfmt.Registry) error {

	if err := validate.MinimumInt("length", "path", int64(o.Length), 2, false); err != nil {
		return err
	}

	if err := validate.MaximumInt("length", "path", int64(o.Length), 30, false); err != nil {
		return err
	}

	return nil
}
942448
func (c *Conn) ReadFixedLength(length int) (data []byte, err error) {
	// Read the whole message into a buffer
	data = make([]byte, length)
	receivedLength := 0
	for receivedLength < length {
		bytesRead, err := c.Rwc.Read(data[receivedLength:])
		if err != nil {
			return data, err
		}
		receivedLength += bytesRead
	}

	return data, nil
}
1229345
func stringLengthFunc(arg1 query) func(query, iterator) interface{} {
	return func(q query, t iterator) interface{} {
		switch v := arg1.Evaluate(t).(type) {
		case string:
			return float64(len(v))
		case query:
			node := v.Select(t)
			if node == nil {
				break
			}
			return float64(len(node.Value()))
		}
		return float64(0)
	}
}
852584
func checkPathLength(pathName string) error {
	// Apple OS X path length is limited to 1016
	if runtime.GOOS == "darwin" && len(pathName) > 1016 {
		return errFileNameTooLong
	}

	if runtime.GOOS == "windows" {
		// Convert any '\' to '/'.
		pathName = filepath.ToSlash(pathName)
	}

	// Check each path segment length is > 255
	for len(pathName) > 0 && pathName != "." && pathName != "/" {
		dir, file := slashpath.Dir(pathName), slashpath.Base(pathName)

		if len(file) > 255 {
			return errFileNameTooLong
		}

		pathName = dir
	} // Success.
	return nil
}
1156645
func (p *Pixbuf) GetPixelsWithLength() []byte {
	panic_if_version_older(2, 26, 0, "gdk_pixbuf_get_pixels_with_length()")
	length := C.guint(0)
	ptr := C._gdk_pixbuf_get_pixels_with_length(
		p.GPixbuf,
		&length,
	)
	return (*[1 << 30]byte)(unsafe.Pointer(ptr))[:length]
}
1358583
func (d *Disque) QueueLength(queueName string) (queueLength int, err error) {
	return redis.Int(d.call("QLEN", redis.Args{}.Add(queueName)))
}
1310404
func (s Slice) getNthOffset(index ValueLength) (ValueLength, error) {
	vpackAssert(s.IsArray() || s.IsObject())

	h := s.head()

	if h == 0x13 || h == 0x14 {
		// compact Array or Object
		l, err := s.getNthOffsetFromCompact(index)
		if err != nil {
			return 0, WithStack(err)
		}
		return l, nil
	}

	if h == 0x01 || h == 0x0a {
		// special case: empty Array or empty Object
		return 0, WithStack(IndexOutOfBoundsError)
	}

	offsetSize := indexEntrySize(h)
	end := ValueLength(readIntegerNonEmpty(s[1:], offsetSize))

	dataOffset := ValueLength(0)

	// find the number of items
	var n ValueLength
	if h <= 0x05 { // No offset table or length, need to compute:
		dataOffset = s.findDataOffset(h)
		first := Slice(s[dataOffset:])
		s, err := first.ByteSize()
		if err != nil {
			return 0, WithStack(err)
		}
		if s == 0 {
			return 0, WithStack(InternalError)
		}
		n = (end - dataOffset) / s
	} else if offsetSize < 8 {
		n = ValueLength(readIntegerNonEmpty(s[1+offsetSize:], offsetSize))
	} else {
		n = ValueLength(readIntegerNonEmpty(s[end-ValueLength(offsetSize):], offsetSize))
	}

	if index >= n {
		return 0, WithStack(IndexOutOfBoundsError)
	}

	// empty array case was already covered
	vpackAssert(n > 0)

	if h <= 0x05 || n == 1 {
		// no index table, but all array items have the same length
		// now fetch first item and determine its length
		if dataOffset == 0 {
			dataOffset = s.findDataOffset(h)
		}
		sliceAtDataOffset := Slice(s[dataOffset:])
		sliceAtDataOffsetByteSize, err := sliceAtDataOffset.ByteSize()
		if err != nil {
			return 0, WithStack(err)
		}
		return dataOffset + index*sliceAtDataOffsetByteSize, nil
	}

	offsetSize8Or0 := ValueLength(0)
	if offsetSize == 8 {
		offsetSize8Or0 = 8
	}
	ieBase := end - n*ValueLength(offsetSize) + index*ValueLength(offsetSize) - (offsetSize8Or0)
	return ValueLength(readIntegerNonEmpty(s[ieBase:], offsetSize)), nil
}
391603
func (d *FSDirectory) FileLength(name string) (n int64, err error) {
	d.EnsureOpen()
	fi, err := os.Stat(filepath.Join(d.path, name))
	if err != nil {
		return 0, err
	}
	return fi.Size(), nil
}
562164
func (s *SecureCookie) MaxLength(value int) *SecureCookie {
	s.maxLength = value
	return s
}
481391
func (consumer *Consumer) MultiGet(length int) ([]*Package, error) {
	var collection []*Package
	if consumer.HasUnacked() {
		return nil, fmt.Errorf("unacked Packages found")
	}

	// TODO maybe use transactions for rollback in case of errors?
	reqs, err := consumer.Queue.redisClient.Pipelined(func(c *redis.Pipeline) error {
		c.BRPopLPush(
			queueInputKey(consumer.Queue.Name),
			consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
			0,
		)
		for i := 1; i < length; i++ {
			c.RPopLPush(
				queueInputKey(consumer.Queue.Name),
				consumerWorkingQueueKey(consumer.Queue.Name, consumer.Name),
			)
		}
		return nil
	})
	if err != nil && err != redis.Nil {
		return nil, err
	}

	for _, answer := range reqs {
		switch answer := answer.(type) {
		case *redis.StringCmd:
			if answer.Val() == "" {
				continue
			}
			p, err := consumer.parseRedisAnswer(answer)
			if err != nil {
				return nil, err
			}
			p.Collection = &collection
			collection = append(collection, p)
		default:
			return nil, err
		}
	}
	consumer.Queue.incrRate(
		consumerWorkingRateKey(consumer.Queue.Name, consumer.Name),
		int64(length),
	)

	return collection, nil
}
1022582
func (fs *TermvectorsFilterSettings) MinWordLength(value int64) *TermvectorsFilterSettings {
	fs.minWordLength = &value
	return fs
}
1244857
func subpacketsLength(subpackets []outputSubpacket, hashed bool) (length int) {
	for _, subpacket := range subpackets {
		if subpacket.hashed == hashed {
			length += subpacketLengthLength(len(subpacket.contents) + 1)
			length += 1 // type byte
			length += len(subpacket.contents)
		}
	}
	return
}
373661
func (b *blame) maxAuthorLength() int {
	memo := make(map[plumbing.Hash]struct{}, len(b.graph)-1)
	fVs := b.graph[len(b.graph)-1]
	m := 0
	for ln := range fVs {
		if _, ok := memo[fVs[ln].Hash]; ok {
			continue
		}
		memo[fVs[ln].Hash] = struct{}{}
		m = max(m, utf8.RuneCountInString(prettyPrintAuthor(fVs[ln])))
	}
	return m
}
542046
func (v *Validator) MaxLength(field string, length int) *ValidationResult {
	val := v.data.Get(field)
	trimmed := strings.TrimSpace(val)
	if len(trimmed) > length {
		return v.addMaxLengthError(field, length)
	} else {
		return validationOk
	}
}
569598
func (d *CompoundFileDirectory) FileLength(name string) (n int64, err error) {
	panic("not implemented yet")
}