// DecodeBottleTiny decodes the BottleTiny instance encoded in resp body.
192931
func (c *Client) DecodeBottleTiny(resp *http.Response) (*BottleTiny, error) {
	var decoded BottleTiny
	err := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get("Content-Type"))
	return &decoded, err
}
1310473
func DecodeBooleanBlock(block []byte, a *[]BooleanValue) ([]BooleanValue, error) {
	// Block type is the next block, make sure we actually have a float block
	blockType := block[0]
	if blockType != BlockBoolean {
		return nil, fmt.Errorf("invalid block type: exp %d, got %d", BlockBoolean, blockType)
	}
	block = block[1:]

	tb, vb, err := unpackBlock(block)
	if err != nil {
		return nil, err
	}

	sz := CountTimestamps(tb)

	if cap(*a) < sz {
		*a = make([]BooleanValue, sz)
	} else {
		*a = (*a)[:sz]
	}

	tdec := timeDecoderPool.Get(0).(*TimeDecoder)
	vdec := booleanDecoderPool.Get(0).(*BooleanDecoder)

	var i int
	err = func(a []BooleanValue) error {
		// Setup our timestamp and value decoders
		tdec.Init(tb)
		vdec.SetBytes(vb)

		// Decode both a timestamp and value
		j := 0
		for j < len(a) && tdec.Next() && vdec.Next() {
			a[j] = NewRawBooleanValue(tdec.Read(), vdec.Read())
			j++
		}
		i = j

		// Did timestamp decoding have an error?
		err = tdec.Error()
		if err != nil {
			return err
		}
		// Did boolean decoding have an error?
		return vdec.Error()
	}(*a)

	timeDecoderPool.Put(tdec)
	booleanDecoderPool.Put(vdec)

	return (*a)[:i], err
}
73555
func NewBottle(service *goa.Service, db *store.DB) *BottleController {
	return &BottleController{
		Controller: service.NewController("Bottle"),
		db:         db,
	}
}
550363
func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
	if val.IsValid() && val.Elem().IsValid() {
		return d.decode(name, data, val.Elem())
	}

	dataVal := reflect.ValueOf(data)

	// If the input data is a pointer, and the assigned type is the dereference
	// of that exact pointer, then indirect it so that we can assign it.
	// Example: *string to string
	if dataVal.Kind() == reflect.Ptr && dataVal.Type().Elem() == val.Type() {
		dataVal = reflect.Indirect(dataVal)
	}

	if !dataVal.IsValid() {
		dataVal = reflect.Zero(val.Type())
	}

	dataValType := dataVal.Type()
	if !dataValType.AssignableTo(val.Type()) {
		return fmt.Errorf(
			"'%s' expected type '%s', got '%s'",
			name, val.Type(), dataValType)
	}

	val.Set(dataVal)
	return nil
}
694246
func Decode58(inp string) (outp []byte, err error) {
	place := big.NewInt(1)
	base := big.NewInt(58)
	buf := []byte(inp)
	padlen := 0

	// Advance to first non-pad byte
	for ; padlen < len(buf); padlen++ {
		if buf[padlen] != alphabet[0] {
			break
		}
	}
	buf = buf[padlen:]
	reverseBuf(buf)

	tmp := new(big.Int)
	res := big.NewInt(0)

	for i, c := range buf {
		charIndex := alphabetMap[c]
		if charIndex == base58InvalidIndex {
			err = fmt.Errorf("Bad character '%c' found at pos %d", c, i)
			return
		}

		tmp.Mul(place, big.NewInt(int64(charIndex)))
		res.Add(res, tmp)

		if i != len(buf)-1 {
			place.Mul(place, base)
		}
	}
	buf = res.Bytes()
	pad := bytes.Repeat([]byte{0}, padlen)
	outp = append(pad, buf...)

	return
}
417205
func decodeBody(r *msgp.Reader, v interface{}) error {
	b, ok := v.(msgp.Decodable)
	if !ok {
		return ErrNotDecodable
	}

	return msgp.Decode(r, b)
}
367413
func decodeBinaryString(s string) ([]byte, error) {
	if len(s)&7 != 0 {
		// prepend the padding
		s = strings.Repeat("0", 8-len(s)&7) + s
	}

	data := make([]byte, len(s)>>3)

	for i, dstIndex := 0, 0; i < len(s); i = i + 8 {
		value, err := strconv.ParseInt(s[i:i+8], 2, 0)
		if err != nil {
			return nil, fmt.Errorf("error while conversion: %s", err)
		}

		data[dstIndex] = byte(value)
		dstIndex++
	}

	return data, nil
}
640915
func Decode(r io.ReaderAt, size int64) (GenericTag, error) {
	magic := make([]byte, 4)
	if _, err := r.ReadAt(magic, 0); err != nil {
		return nil, err
	}

	if !bytes.Equal(magic[:3], []byte("ID3")) {
		return nil, errors.New("taglib: format not recognised (not ID3)")
	}

	switch magic[3] {
	case 2:
		return nil, errors.New("taglib: format not supported (ID3 v2.2)")
	case 3:
		return id3.Decode23(r)
	case 4:
		return id3.Decode24(r)
	default:
		return nil, fmt.Errorf("taglib: format not supported (ID3 %d)", magic[3])
	}
}
991605
func DecodeBig(input string) (*big.Int, error) {
	raw, err := checkNumber(input)
	if err != nil {
		return nil, err
	}
	if len(raw) > 64 {
		return nil, ErrBig256Range
	}
	words := make([]big.Word, len(raw)/bigWordNibbles+1)
	end := len(raw)
	for i := range words {
		start := end - bigWordNibbles
		if start < 0 {
			start = 0
		}
		for ri := start; ri < end; ri++ {
			nib := decodeNibble(raw[ri])
			if nib == badNibble {
				return nil, ErrSyntax
			}
			words[i] *= 16
			words[i] += big.Word(nib)
		}
		end = start
	}
	dec := new(big.Int).SetBits(words)
	return dec, nil
}
1302020
func (m *NamedValueInt) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS)
	binary.Read(data, binary.LittleEndian, &m.VALUE)
	binary.Read(data, binary.LittleEndian, &m.NAME)
}
893402
func (d *GetResult) Decode(valuePtr interface{}, decode Decode) error {
	if decode == nil {
		decode = DefaultDecode
	}
	return decode(d.contents, d.flags, valuePtr)
}
18664
func DecodeObject(s storer.EncodedObjectStorer, o plumbing.EncodedObject) (Object, error) {
	switch o.Type() {
	case plumbing.CommitObject:
		return DecodeCommit(s, o)
	case plumbing.TreeObject:
		return DecodeTree(s, o)
	case plumbing.BlobObject:
		return DecodeBlob(o)
	case plumbing.TagObject:
		return DecodeTag(s, o)
	default:
		return nil, plumbing.ErrInvalidType
	}
}
316290
func (t *Thrift) Decode(octets []byte) ([]codec.Span, error) {
	spans, err := UnmarshalThrift(octets)
	if err != nil {
		return nil, err
	}

	res := make([]codec.Span, len(spans))
	for i, s := range spans {
		res[i] = &span{s}
	}
	return res, nil
}
193637
func parseBottom(s *goquery.Selection) (clusterId, numCite, numVer, infoId string) {
	divFooter := s.Find(article_bottom_selector)
	parseFooter := func(i int, s *goquery.Selection) {

		href, _ := s.Attr("href")
		text := s.Text()

		if strings.HasPrefix(href, "/scholar?cites") {
			clusterId = parseClusterIdText(href)
			numCite = parseNumCiteText(text)
		}
		if strings.HasPrefix(href, "/scholar?cluster") {
			numVer = parseNumVerText(text)
		}
		if strings.HasPrefix(href, "/scholar?q=related") {
			infoId = parseInfoIdText(href)
		}

	}
	divFooter.Find("a").Each(parseFooter)

	return clusterId, numCite, numVer, infoId
}
1326121
func (c *ReplyShortChanIDsEnd) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		c.ChainHash[:],
		&c.Complete,
	)
}
695031
func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
	dataVal := reflect.ValueOf(data)
	if !dataVal.IsValid() {
		dataVal = reflect.Zero(val.Type())
	}

	dataValType := dataVal.Type()
	if !dataValType.AssignableTo(val.Type()) {
		return fmt.Errorf(
			"'%s' expected type '%s', got '%s'",
			name, val.Type(), dataValType)
	}

	val.Set(dataVal)
	return nil
}
1152183
func DecodeTLV(r *bytes.Buffer) (Map, error) {
	t := make(Map)
	for r.Len() >= 4 {
		b := r.Next(4)
		ft := Tag(binary.BigEndian.Uint16(b[0:2]))
		fl := binary.BigEndian.Uint16(b[2:4])
		if r.Len() < int(fl) {
			return nil, fmt.Errorf("not enough data for tag %s: want %d, have %d",
				ft.Hex(), fl, r.Len())
		}
		b = r.Next(int(fl))
		t[ft] = &Field{
			Tag:  ft,
			Data: b,
		}
	}
	return t, nil
}