// Decode accepts a packed byte array and populates the fields of the TerrainReport
9984
func (m *TerrainReport) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.LAT)
	binary.Read(data, binary.LittleEndian, &m.LON)
	binary.Read(data, binary.LittleEndian, &m.TERRAIN_HEIGHT)
	binary.Read(data, binary.LittleEndian, &m.CURRENT_HEIGHT)
	binary.Read(data, binary.LittleEndian, &m.SPACING)
	binary.Read(data, binary.LittleEndian, &m.PENDING)
	binary.Read(data, binary.LittleEndian, &m.LOADED)
}
626309
func (c *CodecMsgpack) Decode(buf []byte, obj interface{}) error {
	err := codec.NewDecoderBytes(buf, c.h).Decode(obj)
	if err != nil {
		return errors.Wrap(err, "failed to decode")
	}
	return nil
}
882596
func Decode(dst, src []byte) ([]byte, error) {

	if len(src) < 4 {
		return nil, ErrCorrupt
	}

	uncompressedLen := binary.LittleEndian.Uint32(src)

	if uncompressedLen == 0 {
		return nil, nil
	}

	if uncompressedLen > MaxInputSize {
		return nil, ErrTooLarge
	}

	if dst == nil || len(dst) < int(uncompressedLen) {
		dst = make([]byte, uncompressedLen)
	}

	d := decoder{src: src, dst: dst[:uncompressedLen], spos: 4}

	decr := []uint32{0, 3, 2, 3}

	for {
		code, err := d.readByte()
		if err != nil {
			return d.dst, d.finish(err)
		}

		length := uint32(code >> mlBits)
		if length == runMask {
			ln, err := d.getLen()
			if err != nil {
				return nil, ErrCorrupt
			}
			length += ln
		}

		if int(d.spos+length) > len(d.src) || int(d.dpos+length) > len(d.dst) {
			return nil, ErrCorrupt
		}

		for ii := uint32(0); ii < length; ii++ {
			d.dst[d.dpos+ii] = d.src[d.spos+ii]
		}

		d.spos += length
		d.dpos += length

		if int(d.spos) == len(d.src) {
			return d.dst, nil
		}

		if int(d.spos+2) >= len(d.src) {
			return nil, ErrCorrupt
		}

		back := uint32(d.src[d.spos]) | uint32(d.src[d.spos+1])<<8

		if back > d.dpos {
			return nil, ErrCorrupt
		}

		d.spos += 2
		d.ref = d.dpos - back

		length = uint32(code & mlMask)
		if length == mlMask {
			ln, err := d.getLen()
			if err != nil {
				return nil, ErrCorrupt
			}
			length += ln
		}

		literal := d.dpos - d.ref

		if literal < 4 {
			if int(d.dpos+4) > len(d.dst) {
				return nil, ErrCorrupt
			}

			d.cp(4, decr[literal])
		} else {
			length += 4
		}

		if d.dpos+length > uncompressedLen {
			return nil, ErrCorrupt
		}

		d.cp(length, 0)
	}
}
423002
func Decode(src []byte) (body []byte, err error) {
	body = make([]byte, Encoding.DecodedLen(len(src)))
	_, err = Encoding.Decode(body, src)
	return
}
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
}
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()
}
794602
func Decode(dst, src []byte) ([]byte, error) {
	dLen, _, err := decodedLen(src)
	if err != nil {
		return nil, err
	}
	if len(dst) < dLen {
		dst = make([]byte, dLen)
	}
	if dLen == 0 {
		return dst[:0], nil
	}

	tLen := C.size_t(dLen)
	status := C.snappy_uncompress((*C.char)(unsafe.Pointer(&src[0])), C.size_t(len(src)),
		(*C.char)(unsafe.Pointer(&dst[0])), &tLen)
	if status != C.SNAPPY_OK {
		return nil, ErrCorrupt
	}
	return dst[:tLen], 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
}
609204
func (m *DebugVect) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_USEC)
	binary.Read(data, binary.LittleEndian, &m.X)
	binary.Read(data, binary.LittleEndian, &m.Y)
	binary.Read(data, binary.LittleEndian, &m.Z)
	binary.Read(data, binary.LittleEndian, &m.NAME)
}
1069164
func (adapter *Decoder) Decode(obj interface{}) error {
	if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil {
		if !adapter.iter.loadMore() {
			return io.EOF
		}
	}
	adapter.iter.ReadVal(obj)
	err := adapter.iter.Error
	if err == io.EOF {
		return nil
	}
	return adapter.iter.Error
}
703774
func (s *ReportStatus) Decode(r io.Reader) error {
	scan := pktline.NewScanner(r)
	if err := s.scanFirstLine(scan); err != nil {
		return err
	}

	if err := s.decodeReportStatus(scan.Bytes()); err != nil {
		return err
	}

	flushed := false
	for scan.Scan() {
		b := scan.Bytes()
		if isFlush(b) {
			flushed = true
			break
		}

		if err := s.decodeCommandStatus(b); err != nil {
			return err
		}
	}

	if !flushed {
		return fmt.Errorf("missing flush")
	}

	return scan.Err()
}
315683
func (j *jsonEncoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
361892
func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
43740
func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
	if d.decoder == nil {
		buffer, isJSON := guessJSONStream(d.r, d.bufferSize)
		if isJSON {
			glog.V(4).Infof("decoding stream as JSON")
			d.decoder = json.NewDecoder(buffer)
		} else {
			glog.V(4).Infof("decoding stream as YAML")
			d.decoder = NewYAMLToJSONDecoder(buffer)
		}
	}
	return d.decoder.Decode(into)
}
1267098
func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersionKind, into Object) (Object, *schema.GroupVersionKind, error) {
	obj, gvk, err := d.Decoder.Decode(data, defaults, into)
	if obj != nil {
		kind := obj.GetObjectKind()
		// clearing the gvk is just a convention of a codec
		kind.SetGroupVersionKind(schema.GroupVersionKind{})
	}
	return obj, gvk, err
}
279398
func (pp *Pingresp) Decode(src []byte) (int, error) {
	return nakedDecode(src, PINGRESP)
}
1237510
func (m AttributeMap) Decode(dst interface{}, opts ...mapdecode.Option) error {
	return DecodeInto(dst, m, opts...)
}