// ExtractOffset returns the first found OffsetOption from the
// given variadic arguments or nil otherwise.
338641
func ExtractOffset(opts ...interface{}) *opt.OffsetOption {
	for _, o := range opts {
		if v, ok := o.(*opt.OffsetOption); ok {
			return v
		}
	}
	return nil
}
812916
func (br *bitReader) ReadOffset(sym uint, rcs []rangeCode) uint {
	rc := rcs[sym]
	return uint(rc.base) + br.ReadBits(uint(rc.bits))
}
829893
func getContextAroundOffset(contents []byte, offset, lines int64) (context []byte, onLineOffset, lineOffset int64) {
	// get the end of the line previous to the one the error is on
	var start = getOffsetXLineBack(contents[:offset], 1)
	onLineOffset = offset - start
	// calculate the correct start of the context
	start = getOffsetXLineBack(contents[:start], lines)
	// get the end of the line the error is on
	var end = getOffsetXLineForward(contents[offset:], 1) + offset
	// correct lineOffset for the context
	lineOffset = end - start
	end = getOffsetXLineForward(contents[min(len(contents), int(end+1)):], lines) + end
	context = contents[start:min(len(contents), int(end+1))]
	return
}
1124733
func (s *AudioSelector) SetOffset(v int64) *AudioSelector {
	s.Offset = &v
	return s
}
308331
func addIPOffset(base *big.Int, offset int) net.IP {
	return net.IP(big.NewInt(0).Add(base, big.NewInt(int64(offset))).Bytes())
}
1147009
func (f *File) findBodyOffset() (int64, error) {
	var buf [fileHeaderLen]byte
	if _, err := f.zipr.ReadAt(buf[:], f.headerOffset); err != nil {
		return 0, err
	}
	b := readBuf(buf[:])
	if sig := b.uint32(); sig != fileHeaderSignature {
		return 0, ErrFormat
	}
	b = b[22:] // skip over most of the header
	filenameLen := int(b.uint16())
	extraLen := int(b.uint16())
	return int64(fileHeaderLen + filenameLen + extraLen), nil
}
797246
func (pw *Writer) WriteOffset(ofs uint, pe *Encoder, re *RangeEncoder) {
	sym := re.Encode(ofs)
	pw.WriteSymbol(sym, pe)
	rc := re.rcs[sym]
	pw.WriteBits(ofs-uint(rc.Base), uint(rc.Len))
}
968048
func (cg *Consumergroup) FetchOffset(topic string, partition int32) (int64, error) {
	node := fmt.Sprintf("%s/consumers/%s/offsets/%s/%d", cg.kz.conf.Chroot, cg.Name, topic, partition)
	val, _, err := cg.kz.conn.Get(node)
	if err == zk.ErrNoNode {
		return -1, nil
	} else if err != nil {
		return -1, err
	}
	return strconv.ParseInt(string(val), 10, 64)
}
176616
func (o *ListOAuth2ClientsParams) WithOffset(offset *int64) *ListOAuth2ClientsParams {
	o.SetOffset(offset)
	return o
}
767674
func (c *KafkaClient) GetOffset(group string, topic string, partition int32) (int64, error) {
	log.Infof("Getting offset for group %s, topic %s, partition %d", group, topic, partition)
	coordinator, err := c.metadata.OffsetCoordinator(group)
	if err != nil {
		return InvalidOffset, err
	}

	request := NewOffsetFetchRequest(group)
	request.AddOffset(topic, partition)
	bytes, err := c.syncSendAndReceive(coordinator, request)
	if err != nil {
		return InvalidOffset, err
	}
	response := new(OffsetFetchResponse)
	decodingErr := c.decode(bytes, response)
	if decodingErr != nil {
		log.Errorf("Could not decode an OffsetFetchResponse. Reason: %s", decodingErr.Reason())
		return InvalidOffset, decodingErr.Error()
	}

	topicOffsets, exist := response.Offsets[topic]
	if !exist {
		return InvalidOffset, fmt.Errorf("OffsetFetchResponse does not contain information about requested topic")
	}

	if offset, exists := topicOffsets[partition]; !exists {
		return InvalidOffset, fmt.Errorf("OffsetFetchResponse does not contain information about requested partition")
	} else if offset.Error != ErrNoError {
		return InvalidOffset, offset.Error
	} else {
		return offset.Offset, nil
	}
}
1168374
func (s *symbols) extractFrom(e *elf.File) error {
	dataOffsets := make(map[string]symbol)
	stringOffsets := make(map[string]symbol)

	symbols, err := e.Symbols()
	if err != nil {
		return err
	}
	symtab := e.SectionByType(elf.SHT_SYMTAB)
	strtab := e.Sections[symtab.Link]

	// Scan symbol table for offsets of static data and symbol names.
	symbolReader := symtab.Open()
	for i, sym := range symbols {
		// BTF extensions like line info not recognized by normal ELF parsers
		if elf.ST_TYPE(sym.Info) == elf.STT_FILE {
			continue
		}
		section := e.Sections[sym.Section]
		switch {
		case section.Flags&elf.SHF_COMPRESSED > 0:
			return fmt.Errorf("compressed %s section not supported", section.Name)
		case !isGlobalData(sym):
			// LBB is a common llvm symbol prefix (basic block);
			// Don't flood the logs with messages about it.
			if !strings.HasPrefix(sym.Name, "LBB") {
				log.Debugf("Skipping %s", sym.Name)
			}
			continue
		case section.Name == dataSection:
			// Offset from start of binary to variable inside .data
			offset := section.Offset + sym.Value
			dataOffsets[sym.Name] = newVariable(sym.Name, offset)
			log.WithField(fieldSymbol, sym.Name).Debugf("Found variable with offset %d", offset)
		case section.Name == mapSection:
			// From the Golang Documentation:
			//   "For compatibility with Go 1.0, Symbols omits the
			//   the null symbol at index 0."
			// We must reverse this when reading directly.
			symbolOffset := int64(i+1) * int64(symtab.Entsize)
			symOffsetInStrtab, err := readStringOffset(e, symbolReader, symbolOffset)
			if err != nil {
				return err
			}
			// Offset from start of binary to name inside .strtab
			symOffset := strtab.Offset + symOffsetInStrtab
			stringOffsets[sym.Name] = newString(sym.Name, symOffset)
			log.WithField(fieldSymbol, sym.Name).Debugf("Found symbol with offset %d", symOffset)
		default:
			log.WithField(fieldSymbol, sym.Name).Debugf("Found symbol with unknown section reference %d", sym.Section)
		}
	}

	// Scan string table for offsets of section names.
	stringReader := bufio.NewReader(strtab.Open())
	var elfString string
	for off := uint64(0); off < strtab.Size; off += uint64(len(elfString)) {
		// off is the offset within the string table.
		elfString, err = stringReader.ReadString(nullTerminator)
		if err != nil && err != io.EOF {
			return err
		}

		// We only need to worry about sections with relocations.
		if !strings.HasPrefix(elfString, relocSectionPrefix) {
			if err == io.EOF {
				break
			}
			continue
		}

		elfEnd := len(elfString)
		if elfString[elfEnd-1] == nullTerminator {
			elfEnd--
		}
		relocOffset := uint64(len(relocSectionPrefix))
		secName := elfString[relocOffset:elfEnd]
		if sec := e.Section(secName); sec != nil {
			// Offset from start of binary to name inside .strtab
			globalOffset := strtab.Offset + off + relocOffset
			stringOffsets[secName] = newString(secName, globalOffset)
			log.WithField(fieldSymbol, secName).Debugf("Found section with offset %d", globalOffset)
		}

		if err == io.EOF {
			break
		}
	}

	s.data = dataOffsets
	s.strings = stringOffsets
	return nil
}
417234
func (s *ScanOp) Offset(token string) *ScanOp {
	s.token = token
	return s
}
426989
func (s *EventsService) SelectWithOffset(r RRSetKey, query string, offset int) ([]EventInfoDTO, ResultInfo, *http.Response, error) {
	var tld EventInfoListDTO

	uri := r.EventsQueryURI(query, offset)
	res, err := s.client.get(uri, &tld)

	pis := []EventInfoDTO{}
	for _, pi := range tld.Events {
		pis = append(pis, pi)
	}
	return pis, tld.Resultinfo, res, err
}
823739
func (t *Tokenizer) CorrectOffset(currentOff int) int {
	assert2(t.Input != nil, "this tokenizer is closed")
	if v, ok := t.Input.(CharFilterService); ok {
		return v.CorrectOffset(currentOff)
	}
	return currentOff
}
1025918
func ExtractLength(opts ...interface{}) *opt.LengthOption {
	for _, o := range opts {
		if v, ok := o.(*opt.LengthOption); ok {
			return v
		}
	}
	return nil
}
490675
func (s *MotionImageInserter) SetOffset(v *MotionImageInsertionOffset) *MotionImageInserter {
	s.Offset = v
	return s
}
704171
func ResultOffset(offset uint32) func(Call) error {
	return func(hc Call) error {
		if c, ok := hc.(hasQueryOptions); ok {
			if offset > math.MaxInt32 {
				return errors.New("'ResultOffset' exceeds supported offset value")
			}
			c.setResultOffset(offset)
			return nil
		}
		return errors.New("'ResultOffset' option can only be used with Get or Scan request")
	}
}