// Decode reverses the encode operation on a byte slice input
776935
func decode(buf []byte, out interface{}) error {
	r := bytes.NewReader(buf)
	hd := codec.MsgpackHandle{}
	dec := codec.NewDecoder(r, &hd)
	return dec.Decode(out)
}
298907
func (decoder *RawDecoder) Decode(in *ByteBuf) (bool, interface{}, error) {
	_, data, err := in.ReadMarkedBytes()

	if err != nil {
		return true, data, err
	}

	return true, data, nil
}
1143875
func (m *HilRcInputsRaw) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_USEC)
	binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN9_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN10_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN11_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN12_RAW)
	binary.Read(data, binary.LittleEndian, &m.RSSI)
}
824841
func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) {
	si := 0

	// skip over newlines
	for si < len(src) && (src[si] == '\n' || src[si] == '\r') {
		si++
	}

	for si < len(src) && !end {
		// Decode quantum using the base64 alphabet
		var dbuf [4]byte
		dinc, dlen := 3, 4

		for j := range dbuf {
			if len(src) == si {
				if enc.padChar != NoPadding || j < 2 {
					return n, false, CorruptInputError(si - j)
				}
				dinc, dlen, end = j-1, j, true
				break
			}
			in := src[si]

			si++
			// skip over newlines
			for si < len(src) && (src[si] == '\n' || src[si] == '\r') {
				si++
			}

			if rune(in) == enc.padChar {
				// We've reached the end and there's padding
				switch j {
				case 0, 1:
					// incorrect padding
					return n, false, CorruptInputError(si - 1)
				case 2:
					// "==" is expected, the first "=" is already consumed.
					if si == len(src) {
						// not enough padding
						return n, false, CorruptInputError(len(src))
					}
					if rune(src[si]) != enc.padChar {
						// incorrect padding
						return n, false, CorruptInputError(si - 1)
					}

					si++
					// skip over newlines
					for si < len(src) && (src[si] == '\n' || src[si] == '\r') {
						si++
					}
				}
				if si < len(src) {
					// trailing garbage
					err = CorruptInputError(si)
				}
				dinc, dlen, end = 3, j, true
				break
			}
			dbuf[j] = enc.decodeMap[in]
			if dbuf[j] == 0xFF {
				return n, false, CorruptInputError(si - 1)
			}
		}

		// Convert 4x 6bit source bytes into 3 bytes
		val := uint(dbuf[0])<<18 | uint(dbuf[1])<<12 | uint(dbuf[2])<<6 | uint(dbuf[3])
		switch dlen {
		case 4:
			dst[2] = byte(val >> 0)
			fallthrough
		case 3:
			dst[1] = byte(val >> 8)
			fallthrough
		case 2:
			dst[0] = byte(val >> 16)
		}
		dst = dst[dinc:]
		n += dlen - 1
	}

	return n, end, err
}
252344
func (decoder *redisReplyDecoder) Decode(in *goetty.ByteBuf) (bool, interface{}, error) {
	complete, cmd, err := readCommandReply(in)
	if err != nil {
		return true, nil, err
	}

	if !complete {
		return false, nil, nil
	}

	return true, cmd, nil
}
919920
func (dec *ProtoDecoder) Decode(v interface{}) error {
	msg, ok := v.(proto.Message)
	if !ok {
		return errors.New("Cannot decode into struct that doesn't implement proto.Message")
	}

	var err error

	// derekperkins TODO: pipe reader directly to proto.Buffer
	if _, err = dec.bBuf.ReadFrom(dec.r); err != nil {
		return err
	}
	dec.pBuf.SetBuf(dec.bBuf.Bytes())

	return dec.pBuf.Unmarshal(msg)
}
1001705
func (l *Loop) Decode(r io.Reader) error {
	*l = Loop{}
	d := &decoder{r: asByteReader(r)}
	l.decode(d)
	return d.err
}
148387
func Decode(value string) (string, error) {
	value = value
	decoded := make([]byte, base64.URLEncoding.DecodedLen(len(value)))
	b, err := base64.URLEncoding.Decode(decoded, []byte(value))
	if err != nil {
		return "", err
	}
	return string(decoded[:b]), nil
}
378617
func decode(dest interface{}, data []byte) error {
	reader, err := gzip.NewReader(bytes.NewReader(data))
	if err != nil {
		return err
	}
	err = json.NewDecoder(reader).Decode(dest)
	if err != nil {
		return err
	}
	return reader.Close()
}
921155
func (e *Error) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		&e.Code,
		&e.Data,
	)
}
472149
func Decode(data []byte) (result interface{}, err error) {
	result, _, err = decodeItem(data, 0)
	return
}
361892
func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
1171372
func Decode(im *imageserver.Image) (image.Image, error) {
	nim, format, err := image.Decode(bytes.NewReader(im.Data))
	if err != nil {
		return nil, &imageserver.ImageError{Message: err.Error()}
	}
	if format != im.Format {
		return nil, &imageserver.ImageError{Message: fmt.Sprintf("decoded format \"%s\" does not match image format \"%s\"", format, im.Format)}
	}
	return nim, nil
}
499344
func (c *CipherSeed) decode(r io.Reader) error {
	err := binary.Read(r, binary.BigEndian, &c.InternalVersion)
	if err != nil {
		return err
	}

	if err := binary.Read(r, binary.BigEndian, &c.Birthday); err != nil {
		return err
	}

	if _, err := io.ReadFull(r, c.Entropy[:]); err != nil {
		return err
	}

	return nil
}
600444
func (dec *skipDecoder) Decode(iter *Iterator) (bool, error) {
	if iter.Error() != nil {
		return false, iter.Error()
	}
	for iter.Valid() {
		key, _, err := mvccDecode(iter.Key())
		if err != nil {
			return false, errors.Trace(err)
		}
		if !bytes.Equal(key, dec.currKey) {
			dec.currKey = key
			return true, nil
		}
		iter.Next()
	}
	return false, nil
}
296151
func (i *Image) Decode() (image.Image, string, error) {
	data := i.Data()
	buffer := bytes.NewBuffer(data)
	return image.Decode(buffer)
}
236761
func (dec *Decoder) Decode(v interface{}) error {
	data, err := dec.Reader.Read()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}