You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2016/10/10 19:06:27 UTC
[2/2] incubator-mynewt-newt git commit: MYNEWT-428 GATT Go Library
MYNEWT-428 GATT Go Library
- ACL Data packet parsing bug for L2CAP packets
- Revendoring
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/b153d958
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/b153d958
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/b153d958
Branch: refs/heads/develop
Commit: b153d958117f08ca69a5e526bee90c1fedf5eeeb
Parents: a441cdf
Author: admin <vr...@gmail.com>
Authored: Fri Oct 7 19:36:34 2016 -0700
Committer: admin <vr...@gmail.com>
Committed: Mon Oct 10 12:02:01 2016 -0700
----------------------------------------------------------------------
newtmgr/Godeps/Godeps.json | 42 ++--
.../mitchellh/mapstructure/mapstructure.go | 6 +-
.../github.com/runtimeinc/gatt/linux/hci.go | 33 +--
.../vendor/github.com/spf13/cobra/command.go | 36 ++-
newtmgr/vendor/github.com/spf13/pflag/flag.go | 2 +-
.../github.com/spf13/pflag/string_slice.go | 2 +-
.../vendor/github.com/ugorji/go/codec/0doc.go | 4 +-
.../vendor/github.com/ugorji/go/codec/README.md | 2 +-
.../vendor/github.com/ugorji/go/codec/binc.go | 9 +-
.../vendor/github.com/ugorji/go/codec/cbor.go | 7 +
.../vendor/github.com/ugorji/go/codec/decode.go | 44 +++-
.../github.com/ugorji/go/codec/decode_go.go | 16 ++
.../github.com/ugorji/go/codec/decode_go14.go | 14 ++
.../vendor/github.com/ugorji/go/codec/encode.go | 50 +++-
.../ugorji/go/codec/fast-path.generated.go | 19 +-
.../ugorji/go/codec/fast-path.go.tmpl | 19 +-
.../github.com/ugorji/go/codec/fast-path.not.go | 2 +
.../ugorji/go/codec/gen-helper.generated.go | 14 +-
.../ugorji/go/codec/gen-helper.go.tmpl | 12 +-
.../vendor/github.com/ugorji/go/codec/gen.go | 47 +++-
.../vendor/github.com/ugorji/go/codec/gen_15.go | 12 +
.../vendor/github.com/ugorji/go/codec/gen_16.go | 12 +
.../vendor/github.com/ugorji/go/codec/gen_17.go | 10 +
.../vendor/github.com/ugorji/go/codec/helper.go | 202 +++++++++------
.../ugorji/go/codec/helper_internal.go | 4 +-
.../ugorji/go/codec/helper_not_unsafe.go | 2 +-
.../github.com/ugorji/go/codec/helper_unsafe.go | 2 +-
.../vendor/github.com/ugorji/go/codec/json.go | 12 +-
.../github.com/ugorji/go/codec/msgpack.go | 7 +
.../vendor/github.com/ugorji/go/codec/rpc.go | 2 +-
.../vendor/github.com/ugorji/go/codec/simple.go | 9 +-
.../x/sys/unix/syscall_linux_arm64.go | 2 -
.../x/sys/unix/syscall_linux_mips64x.go | 7 -
newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml | 1 -
newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS | 1 +
.../vendor/gopkg.in/fsnotify.v1/CHANGELOG.md | 4 +
.../vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md | 2 +-
newtmgr/vendor/gopkg.in/fsnotify.v1/README.md | 2 +-
.../vendor/mynewt.apache.org/newt/DISCLAIMER | 8 +
newtmgr/vendor/mynewt.apache.org/newt/LICENSE | 244 +++++++++++++++++++
newtmgr/vendor/mynewt.apache.org/newt/NOTICE | 8 +
.../vendor/mynewt.apache.org/newt/util/util.go | 99 +++++++-
42 files changed, 815 insertions(+), 217 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/Godeps/Godeps.json
----------------------------------------------------------------------
diff --git a/newtmgr/Godeps/Godeps.json b/newtmgr/Godeps/Godeps.json
index 50e2eb9..561ed5a 100644
--- a/newtmgr/Godeps/Godeps.json
+++ b/newtmgr/Godeps/Godeps.json
@@ -31,39 +31,39 @@
},
{
"ImportPath": "github.com/mitchellh/mapstructure",
- "Rev": "ca63d7c062ee3c9f34db231e352b60012b4fd0c1"
+ "Rev": "a6ef2f080c66d0a2e94e97cf74f80f772855da63"
},
{
"ImportPath": "github.com/runtimeinc/gatt",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux/cmd",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux/evt",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux/gioctl",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux/socket",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/linux/util",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/runtimeinc/gatt/xpc",
- "Rev": "c853b3423b251fe4ba4b8ac8e2b48ef37fef52d1"
+ "Rev": "71e7ae065312559668a7d696b81d6768b69db57a"
},
{
"ImportPath": "github.com/spf13/cast",
@@ -71,7 +71,7 @@
},
{
"ImportPath": "github.com/spf13/cobra",
- "Rev": "9c28e4bbd74e5c3ed7aacbc552b2cab7cfdfe744"
+ "Rev": "ec2fe7859914a5106dcab4e7901633d959bfc2f4"
},
{
"ImportPath": "github.com/spf13/jwalterweatherman",
@@ -79,7 +79,7 @@
},
{
"ImportPath": "github.com/spf13/pflag",
- "Rev": "c7e63cf4530bcd3ba943729cee0efeff2ebea63f"
+ "Rev": "b83537d79690b75cac5e021b036ae16792bf0f20"
},
{
"ImportPath": "github.com/tarm/serial",
@@ -87,31 +87,31 @@
},
{
"ImportPath": "github.com/ugorji/go/codec",
- "Rev": "187fa0f8af224437e08ecb3f208c4d1a94859a61"
+ "Rev": "faddd6128c66c4708f45fdc007f575f75e592a3c"
},
{
"ImportPath": "golang.org/x/sys/unix",
- "Rev": "8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9"
+ "Rev": "8d1157a435470616f975ff9bb013bea8d0962067"
},
{
"ImportPath": "gopkg.in/fsnotify.v1",
- "Comment": "v1.4.0",
- "Rev": "26b17cd591df34e7b1cf0087f48fc19ca67eb476"
+ "Comment": "v1.4.1",
+ "Rev": "944cff21b3baf3ced9a880365682152ba577d348"
},
{
"ImportPath": "mynewt.apache.org/newt/util",
- "Comment": "pre_sterly_refactor-21-g5389f4c",
- "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
+ "Comment": "pre_sterly_refactor-39-gc1470a5",
+ "Rev": "c1470a51a7f7b6b3deef4597de828f980780ae3d"
},
{
"ImportPath": "mynewt.apache.org/newt/viper",
- "Comment": "pre_sterly_refactor-21-g5389f4c",
- "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
+ "Comment": "pre_sterly_refactor-39-gc1470a5",
+ "Rev": "c1470a51a7f7b6b3deef4597de828f980780ae3d"
},
{
"ImportPath": "mynewt.apache.org/newt/yaml",
- "Comment": "pre_sterly_refactor-21-g5389f4c",
- "Rev": "5389f4c4ef7d7587658b3374d1d0f68f7ecd14c3"
+ "Comment": "pre_sterly_refactor-39-gc1470a5",
+ "Rev": "c1470a51a7f7b6b3deef4597de828f980780ae3d"
}
]
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
index a554e79..d1cb607 100644
--- a/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
+++ b/newtmgr/vendor/github.com/mitchellh/mapstructure/mapstructure.go
@@ -698,7 +698,7 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value)
if !rawMapVal.IsValid() {
// Do a slower search by iterating over each key and
// doing case-insensitive search.
- for dataValKey, _ := range dataValKeys {
+ for dataValKey := range dataValKeys {
mK, ok := dataValKey.Interface().(string)
if !ok {
// Not a string key
@@ -746,7 +746,7 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value)
if d.config.ErrorUnused && len(dataValKeysUnused) > 0 {
keys := make([]string, 0, len(dataValKeysUnused))
- for rawKey, _ := range dataValKeysUnused {
+ for rawKey := range dataValKeysUnused {
keys = append(keys, rawKey.(string))
}
sort.Strings(keys)
@@ -761,7 +761,7 @@ func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value)
// Add the unused keys to the list of unused keys if we're tracking metadata
if d.config.Metadata != nil {
- for rawKey, _ := range dataValKeysUnused {
+ for rawKey := range dataValKeysUnused {
key := rawKey.(string)
if name != "" {
key = fmt.Sprintf("%s.%s", name, key)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
index a04e860..c41d0bf 100644
--- a/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
+++ b/newtmgr/vendor/github.com/runtimeinc/gatt/linux/hci.go
@@ -367,27 +367,30 @@ func (h *HCI) handleLEMeta(b []byte) error {
}
func (h *HCI) handleL2CAP(b []byte) error {
- a := &aclData{}
+ a := &aclData{}
if err := a.unmarshal(b); err != nil {
return err
}
h.connsmu.Lock()
defer h.connsmu.Unlock()
c, found := h.conns[a.attr]
- if !found {
- // should not happen, just be cautious for now.
- log.Printf("l2conn: got data for disconnected handle: 0x%04x", a.attr)
- return nil
- }
- if len(a.b) < 4 {
- log.Printf("l2conn: l2cap packet is too short/corrupt, length is %d", len(a.b))
- return nil
- }
- cid := uint16(a.b[2]) | (uint16(a.b[3]) << 8)
- if cid == 5 {
- c.handleSignal(a)
- return nil
- }
+
+ if a.flags != 0x002 {
+ if !found {
+ // should not happen, just be cautious for now.
+ log.Printf("l2conn: got data for disconnected handle: 0x%04x", a.attr)
+ return nil
+ if len(a.b) < 4 {
+ log.Printf("l2conn: l2cap packet is too short/corrupt, length is %d", len(a.b))
+ return nil
+ }
+ cid := uint16(a.b[2]) | (uint16(a.b[3]) << 8)
+ if cid == 5 {
+ c.handleSignal(a)
+ return nil
+ }
+ }
+ }
c.aclc <- a
return nil
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/spf13/cobra/command.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/cobra/command.go b/newtmgr/vendor/github.com/spf13/cobra/command.go
index 9ae9836..8f6580a 100644
--- a/newtmgr/vendor/github.com/spf13/cobra/command.go
+++ b/newtmgr/vendor/github.com/spf13/cobra/command.go
@@ -109,10 +109,11 @@ type Command struct {
flagErrorBuf *bytes.Buffer
- args []string // actual args parsed from flags
- output *io.Writer // out writer if set in SetOutput(w)
- usageFunc func(*Command) error // Usage can be defined by application
- usageTemplate string // Can be defined by Application
+ args []string // actual args parsed from flags
+ output *io.Writer // out writer if set in SetOutput(w)
+ usageFunc func(*Command) error // Usage can be defined by application
+ usageTemplate string // Can be defined by Application
+ flagErrorFunc func(*Command, error) error
helpTemplate string // Can be defined by Application
helpFunc func(*Command, []string) // Help can be defined by application
helpCommand *Command // The help command
@@ -150,7 +151,13 @@ func (c *Command) SetUsageTemplate(s string) {
c.usageTemplate = s
}
-// Can be defined by Application.
+// SetFlagErrorFunc sets a function to generate an error when flag parsing
+// fails
+func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) {
+ c.flagErrorFunc = f
+}
+
+// Can be defined by Application
func (c *Command) SetHelpFunc(f func(*Command, []string)) {
c.helpFunc = f
}
@@ -257,6 +264,22 @@ func (c *Command) UsageString() string {
return bb.String()
}
+// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this
+// command or a parent, or it returns a function which returns the original
+// error.
+func (c *Command) FlagErrorFunc() (f func(*Command, error) error) {
+ if c.flagErrorFunc != nil {
+ return c.flagErrorFunc
+ }
+
+ if c.HasParent() {
+ return c.parent.FlagErrorFunc()
+ }
+ return func(c *Command, err error) error {
+ return err
+ }
+}
+
var minUsagePadding = 25
func (c *Command) UsagePadding() int {
@@ -553,7 +576,7 @@ func (c *Command) execute(a []string) (err error) {
err = c.ParseFlags(a)
if err != nil {
- return err
+ return c.FlagErrorFunc()(c, err)
}
// If help is called, regardless of other flags, return we want help
// Also say we need help if the command isn't runnable.
@@ -712,6 +735,7 @@ func (c *Command) ExecuteC() (cmd *Command, err error) {
}
func (c *Command) initHelpFlag() {
+ c.mergePersistentFlags()
if c.Flags().Lookup("help") == nil {
c.Flags().BoolP("help", "h", false, "help for "+c.Name())
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/spf13/pflag/flag.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/flag.go b/newtmgr/vendor/github.com/spf13/pflag/flag.go
index b0b0d46..4258f45 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/flag.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/flag.go
@@ -416,7 +416,7 @@ func Set(name, value string) error {
// otherwise, the default values of all defined flags in the set.
func (f *FlagSet) PrintDefaults() {
usages := f.FlagUsages()
- fmt.Fprintf(f.out(), "%s", usages)
+ fmt.Fprint(f.out(), usages)
}
// defaultIsZeroValue returns true if the default value for this flag represents
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/spf13/pflag/string_slice.go b/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
index 51e3c5d..7829cfa 100644
--- a/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
+++ b/newtmgr/vendor/github.com/spf13/pflag/string_slice.go
@@ -66,7 +66,7 @@ func (s *stringSliceValue) String() string {
}
func stringSliceConv(sval string) (interface{}, error) {
- sval = strings.Trim(sval, "[]")
+ sval = sval[1 : len(sval)-1]
// An empty string would cause a slice with one (empty) string
if len(sval) == 0 {
return []string{}, nil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/0doc.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/0doc.go b/newtmgr/vendor/github.com/ugorji/go/codec/0doc.go
index bd7361c..209f9eb 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/0doc.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/0doc.go
@@ -68,7 +68,7 @@ Rich Feature Set includes:
- Encode/Decode from/to chan types (for iterative streaming support)
- Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosynchracies of codecs e.g.
+ - Handle unique idiosyncrasies of codecs e.g.
- For messagepack, configure how ambiguities in handling raw bytes are resolved
- For messagepack, provide rpc server/client codec to support
msgpack-rpc protocol defined at:
@@ -181,7 +181,7 @@ package codec
// - Decoding using a chan is good, but incurs concurrency costs.
// This is because there's no fast way to use a channel without it
// having to switch goroutines constantly.
-// Callback pattern is still the best. Maybe cnsider supporting something like:
+// Callback pattern is still the best. Maybe consider supporting something like:
// type X struct {
// Name string
// Ys []Y
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/README.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/README.md b/newtmgr/vendor/github.com/ugorji/go/codec/README.md
index a790a52..91cb3a2 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/README.md
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/README.md
@@ -68,7 +68,7 @@ Rich Feature Set includes:
- Encode/Decode from/to chan types (for iterative streaming support)
- Drop-in replacement for encoding/json. `json:` key in struct tag supported.
- Provides a RPC Server and Client Codec for net/rpc communication protocol.
- - Handle unique idiosynchracies of codecs e.g.
+ - Handle unique idiosyncrasies of codecs e.g.
- For messagepack, configure how ambiguities in handling raw bytes are resolved
- For messagepack, provide rpc server/client codec to support
msgpack-rpc protocol defined at:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/binc.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/binc.go b/newtmgr/vendor/github.com/ugorji/go/codec/binc.go
index 766d26c..33120dc 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/binc.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/binc.go
@@ -348,6 +348,13 @@ func (d *bincDecDriver) readNextBd() {
d.bdRead = true
}
+func (d *bincDecDriver) uncacheRead() {
+ if d.bdRead {
+ d.r.unreadn1()
+ d.bdRead = false
+ }
+}
+
func (d *bincDecDriver) ContainerType() (vt valueType) {
if d.vd == bincVdSpecial && d.vs == bincSpNil {
return valueTypeNil
@@ -705,7 +712,7 @@ func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool)
}
func (d *bincDecDriver) DecodeString() (s string) {
- // DecodeBytes does not accomodate symbols, whose impl stores string version in map.
+ // DecodeBytes does not accommodate symbols, whose impl stores string version in map.
// Use decStringAndBytes directly.
// return string(d.DecodeBytes(d.b[:], true, true))
_, s = d.decStringAndBytes(d.b[:], true, true)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/cbor.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/cbor.go b/newtmgr/vendor/github.com/ugorji/go/codec/cbor.go
index a224cd3..4fa349a 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/cbor.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/cbor.go
@@ -188,6 +188,13 @@ func (d *cborDecDriver) readNextBd() {
d.bdRead = true
}
+func (d *cborDecDriver) uncacheRead() {
+ if d.bdRead {
+ d.r.unreadn1()
+ d.bdRead = false
+ }
+}
+
func (d *cborDecDriver) ContainerType() (vt valueType) {
if d.bd == cborBdNil {
return valueTypeNil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/decode.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/decode.go b/newtmgr/vendor/github.com/ugorji/go/codec/decode.go
index b87ea63..52c1dfe 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/decode.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/decode.go
@@ -91,10 +91,12 @@ type decDriver interface {
uncacheRead()
}
-type decNoSeparator struct{}
+type decNoSeparator struct {
+}
+
+func (_ decNoSeparator) ReadEnd() {}
-func (_ decNoSeparator) ReadEnd() {}
-func (_ decNoSeparator) uncacheRead() {}
+// func (_ decNoSeparator) uncacheRead() {}
type DecodeOptions struct {
// MapType specifies type to use during schema-less decoding of a map in the stream.
@@ -161,6 +163,15 @@ type DecodeOptions struct {
// Note: Handles will be smart when using the intern functionality.
// So everything will not be interned.
InternString bool
+
+ // PreferArrayOverSlice controls whether to decode to an array or a slice.
+ //
+ // This only impacts decoding into a nil interface{}.
+ // Consequently, it has no effect on codecgen.
+ //
+ // *Note*: This only applies if using go1.5 and above,
+ // as it requires reflect.ArrayOf support which was absent before go1.5.
+ PreferArrayOverSlice bool
}
// ------------------------------------
@@ -433,6 +444,10 @@ func (f *decFnInfo) rawExt(rv reflect.Value) {
f.d.d.DecodeExt(rv.Addr().Interface(), 0, nil)
}
+func (f *decFnInfo) raw(rv reflect.Value) {
+ rv.SetBytes(f.d.raw())
+}
+
func (f *decFnInfo) ext(rv reflect.Value) {
f.d.d.DecodeExt(rv.Addr().Interface(), f.xfTag, f.xfFn)
}
@@ -605,8 +620,11 @@ func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) {
n.ss = append(n.ss, nil)
var v2 interface{} = &n.ss[l]
d.decode(v2)
- rvn = reflect.ValueOf(v2).Elem()
n.ss = n.ss[:l]
+ rvn = reflect.ValueOf(v2).Elem()
+ if reflectArrayOfSupported && d.stid == 0 && d.h.PreferArrayOverSlice {
+ rvn = reflectArrayOf(rvn)
+ }
} else {
rvn = reflect.New(d.h.SliceType).Elem()
d.decodeValue(rvn, nil)
@@ -1169,7 +1187,7 @@ type decRtidFn struct {
// primitives are being decoded.
//
// maps and arrays are not handled by this mechanism.
-// However, RawExt is, and we accomodate for extensions that decode
+// However, RawExt is, and we accommodate for extensions that decode
// RawExt from DecodeNaked, but need to decode the value subsequently.
// kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat.
//
@@ -1507,6 +1525,8 @@ func (d *Decoder) decode(iv interface{}) {
*v = 0
case *[]uint8:
*v = nil
+ case *Raw:
+ *v = nil
case reflect.Value:
if v.Kind() != reflect.Ptr || v.IsNil() {
d.errNotValidPtrValue(v)
@@ -1576,6 +1596,9 @@ func (d *Decoder) decode(iv interface{}) {
case *[]uint8:
*v = d.d.DecodeBytes(*v, false, false)
+ case *Raw:
+ *v = d.raw()
+
case *interface{}:
d.decodeValueNotNil(reflect.ValueOf(iv).Elem(), nil)
@@ -1697,6 +1720,8 @@ func (d *Decoder) getDecFn(rt reflect.Type, checkFastpath, checkCodecSelfer bool
fn.f = (*decFnInfo).selferUnmarshal
} else if rtid == rawExtTypId {
fn.f = (*decFnInfo).rawExt
+ } else if rtid == rawTypId {
+ fn.f = (*decFnInfo).raw
} else if d.d.IsBuiltinType(rtid) {
fn.f = (*decFnInfo).builtin
} else if xfFn := d.h.getExt(rtid); xfFn != nil {
@@ -1873,6 +1898,15 @@ func (d *Decoder) nextValueBytes() []byte {
return d.r.stopTrack()
}
+func (d *Decoder) raw() []byte {
+ // ensure that this is not a view into the bytes
+ // i.e. make new copy always.
+ bs := d.nextValueBytes()
+ bs2 := make([]byte, len(bs))
+ copy(bs2, bs)
+ return bs2
+}
+
// --------------------------------------------------
// decSliceHelper assists when decoding into a slice, from a map or an array in the stream.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/decode_go.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/decode_go.go b/newtmgr/vendor/github.com/ugorji/go/codec/decode_go.go
new file mode 100644
index 0000000..ba289ce
--- /dev/null
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/decode_go.go
@@ -0,0 +1,16 @@
+// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// +build go1.5
+
+package codec
+
+import "reflect"
+
+const reflectArrayOfSupported = true
+
+func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
+ rvn2 = reflect.New(reflect.ArrayOf(rvn.Len(), intfTyp)).Elem()
+ reflect.Copy(rvn2, rvn)
+ return
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/decode_go14.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/decode_go14.go b/newtmgr/vendor/github.com/ugorji/go/codec/decode_go14.go
new file mode 100644
index 0000000..50063bc
--- /dev/null
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/decode_go14.go
@@ -0,0 +1,14 @@
+// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// +build !go1.5
+
+package codec
+
+import "reflect"
+
+const reflectArrayOfSupported = false
+
+func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) {
+ panic("reflect.ArrayOf unsupported")
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/encode.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/encode.go b/newtmgr/vendor/github.com/ugorji/go/codec/encode.go
index a60daa2..28ad347 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/encode.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/encode.go
@@ -119,6 +119,19 @@ type EncodeOptions struct {
// This is opt-in, as there may be a performance hit to checking circular references.
CheckCircularRef bool
+ // RecursiveEmptyCheck controls whether we descend into interfaces, structs and pointers
+ // when checking if a value is empty.
+ //
+ // Note that this may make OmitEmpty more expensive, as it incurs a lot more reflect calls.
+ RecursiveEmptyCheck bool
+
+ // Raw controls whether we encode Raw values.
+ // This is a "dangerous" option and must be explicitly set.
+ // If set, we blindly encode Raw values as-is, without checking
+ // if they are a correct representation of a value in that format.
+ // If unset, we error out.
+ Raw bool
+
// AsSymbols defines what should be encoded as symbols.
//
// Encoding as symbols can reduce the encoded size significantly.
@@ -242,8 +255,8 @@ func (z *bytesEncWriter) writen1(b1 byte) {
func (z *bytesEncWriter) writen2(b1 byte, b2 byte) {
c := z.grow(2)
- z.b[c] = b1
z.b[c+1] = b2
+ z.b[c] = b1
}
func (z *bytesEncWriter) atEndOfEncode() {
@@ -282,6 +295,10 @@ func (f *encFnInfo) builtin(rv reflect.Value) {
f.e.e.EncodeBuiltin(f.ti.rtid, rv.Interface())
}
+func (f *encFnInfo) raw(rv reflect.Value) {
+ f.e.raw(rv.Interface().(Raw))
+}
+
func (f *encFnInfo) rawExt(rv reflect.Value) {
// rev := rv.Interface().(RawExt)
// f.e.e.EncodeRawExt(&rev, f.e)
@@ -308,7 +325,7 @@ func (f *encFnInfo) getValueForMarshalInterface(rv reflect.Value, indir int8) (v
v = rv.Interface()
} else if indir == -1 {
// If a non-pointer was passed to Encode(), then that value is not addressable.
- // Take addr if addresable, else copy value to an addressable value.
+ // Take addr if addressable, else copy value to an addressable value.
if rv.CanAddr() {
v = rv.Addr().Interface()
} else {
@@ -524,20 +541,20 @@ func (f *encFnInfo) kStruct(rv reflect.Value) {
}
newlen = 0
var kv stringRv
+ recur := e.h.RecursiveEmptyCheck
for _, si := range tisfi {
kv.r = si.field(rv, false)
if toMap {
- if si.omitEmpty && isEmptyValue(kv.r) {
+ if si.omitEmpty && isEmptyValue(kv.r, recur, recur) {
continue
}
kv.v = si.encName
} else {
// use the zero value.
// if a reference or struct, set to nil (so you do not output too much)
- if si.omitEmpty && isEmptyValue(kv.r) {
+ if si.omitEmpty && isEmptyValue(kv.r, recur, recur) {
switch kv.r.Kind() {
- case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array,
- reflect.Map, reflect.Slice:
+ case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice:
kv.r = reflect.Value{} //encode as nil
}
}
@@ -548,7 +565,7 @@ func (f *encFnInfo) kStruct(rv reflect.Value) {
// debugf(">>>> kStruct: newlen: %v", newlen)
// sep := !e.be
- ee := e.e //don't dereference everytime
+ ee := e.e //don't dereference every time
if toMap {
ee.EncodeMapStart(newlen)
@@ -935,7 +952,7 @@ func newEncoder(h Handle) *Encoder {
// Reset the Encoder with a new output stream.
//
-// This accomodates using the state of the Encoder,
+// This accommodates using the state of the Encoder,
// where it has "cached" information about sub-engines.
func (e *Encoder) Reset(w io.Writer) {
ww, ok := w.(ioEncWriterWriter)
@@ -1067,7 +1084,8 @@ func (e *Encoder) encode(iv interface{}) {
e.e.EncodeNil()
case Selfer:
v.CodecEncodeSelf(e)
-
+ case Raw:
+ e.raw(v)
case reflect.Value:
e.encodeValue(v, nil)
@@ -1252,6 +1270,8 @@ func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCo
if checkCodecSelfer && ti.cs {
fn.f = (*encFnInfo).selferMarshal
+ } else if rtid == rawTypId {
+ fn.f = (*encFnInfo).raw
} else if rtid == rawExtTypId {
fn.f = (*encFnInfo).rawExt
} else if e.e.IsBuiltinType(rtid) {
@@ -1356,6 +1376,18 @@ func (e *Encoder) asis(v []byte) {
}
}
+func (e *Encoder) raw(vv Raw) {
+ v := []byte(vv)
+ if !e.h.Raw {
+ e.errorf("Raw values cannot be encoded: %v", v)
+ }
+ if e.as == nil {
+ e.w.writeb(v)
+ } else {
+ e.as.EncodeAsis(v)
+ }
+}
+
func (e *Encoder) errorf(format string, params ...interface{}) {
err := fmt.Errorf(format, params...)
panic(err)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.generated.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.generated.go
index cf6e00d..f2e5d2d 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.generated.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.generated.go
@@ -23,7 +23,7 @@ package codec
// Currently support
// - slice of all builtin types,
// - map of all builtin types to string or interface value
-// - symetrical maps of all builtin types (e.g. str-str, uint8-uint8)
+// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
// This should provide adequate "typical" implementations.
//
// Note that fast track decode functions must handle values for which an address cannot be obtained.
@@ -38,6 +38,8 @@ import (
"sort"
)
+const fastpathEnabled = true
+
const fastpathCheckNilFalse = false // for reflect
const fastpathCheckNilTrue = true // for type switch
@@ -81,9 +83,6 @@ var fastpathAV fastpathA
// due to possible initialization loop error, make fastpath in an init()
func init() {
- if !fastpathEnabled {
- return
- }
i := 0
fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
xrt := reflect.TypeOf(v)
@@ -373,9 +372,6 @@ func init() {
// -- -- fast path type switch
func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
case []interface{}:
@@ -1741,9 +1737,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
}
func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
case []interface{}:
@@ -1829,9 +1822,6 @@ func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
}
func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
case map[interface{}]interface{}:
@@ -15954,9 +15944,6 @@ func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) {
// -- -- fast path type switch
func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
case []interface{}:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
index 04c173f..c3ffdf9 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl
@@ -23,7 +23,7 @@ package codec
// Currently support
// - slice of all builtin types,
// - map of all builtin types to string or interface value
-// - symetrical maps of all builtin types (e.g. str-str, uint8-uint8)
+// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8)
// This should provide adequate "typical" implementations.
//
// Note that fast track decode functions must handle values for which an address cannot be obtained.
@@ -38,6 +38,8 @@ import (
"sort"
)
+const fastpathEnabled = true
+
const fastpathCheckNilFalse = false // for reflect
const fastpathCheckNilTrue = true // for type switch
@@ -81,9 +83,6 @@ var fastpathAV fastpathA
// due to possible initialization loop error, make fastpath in an init()
func init() {
- if !fastpathEnabled {
- return
- }
i := 0
fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) {
xrt := reflect.TypeOf(v)
@@ -106,9 +105,6 @@ func init() {
// -- -- fast path type switch
func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
case []{{ .Elem }}:{{else}}
@@ -126,9 +122,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool {
}
func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
case []{{ .Elem }}:
@@ -144,9 +137,6 @@ func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool {
}
func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
{{range .Values}}{{if not .Primitive}}{{if .MapKey }}
case map[{{ .MapKey }}]{{ .Elem }}:
@@ -286,9 +276,6 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele
// -- -- fast path type switch
func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool {
- if !fastpathEnabled {
- return false
- }
switch v := iv.(type) {
{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}
case []{{ .Elem }}:{{else}}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.not.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.not.go b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.not.go
index d6f5f0c..63e5911 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.not.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/fast-path.not.go
@@ -4,6 +4,8 @@ package codec
import "reflect"
+const fastpathEnabled = false
+
// The generated fast-path code is very large, and adds a few seconds to the build time.
// This causes test execution, execution of small tools which use codec, etc
// to take a long time.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
index 22bce77..96a6b61 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.generated.go
@@ -1,4 +1,4 @@
-// //+build ignore
+// // +build ignore
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
@@ -17,7 +17,7 @@ import (
// This file is used to generate helper code for codecgen.
// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continously and without notice.
+// library users. They WILL change continuously and without notice.
//
// To help enforce this, we create an unexported type with exported members.
// The only way to get the type is via the one exported type that we control (somewhat).
@@ -84,6 +84,11 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncRaw(iv Raw) {
+ f.e.raw(iv)
+}
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
if _, ok := f.e.hh.(*BincHandle); ok {
return timeTypId
@@ -192,6 +197,11 @@ func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecRaw() []byte {
+ return f.d.raw()
+}
+
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
if _, ok := f.d.hh.(*BincHandle); ok {
return timeTypId
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
index 3195857..9b276d4 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl
@@ -1,4 +1,4 @@
-// //+build ignore
+// // +build ignore
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
@@ -17,7 +17,7 @@ import (
// This file is used to generate helper code for codecgen.
// The values here i.e. genHelper(En|De)coder are not to be used directly by
-// library users. They WILL change continously and without notice.
+// library users. They WILL change continuously and without notice.
//
// To help enforce this, we create an unexported type with exported members.
// The only way to get the type is via the one exported type that we control (somewhat).
@@ -79,6 +79,10 @@ func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) {
f.e.marshal(bs, fnerr, false, c_RAW)
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperEncoder) EncRaw(iv Raw) {
+ f.e.raw(iv)
+}
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperEncoder) TimeRtidIfBinc() uintptr {
if _, ok := f.e.hh.(*BincHandle); ok {
return timeTypId
@@ -172,6 +176,10 @@ func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) {
}
}
// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
+func (f genHelperDecoder) DecRaw() []byte {
+ return f.d.raw()
+}
+// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE*
func (f genHelperDecoder) TimeRtidIfBinc() uintptr {
if _, ok := f.d.hh.(*BincHandle); ok {
return timeTypId
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen.go b/newtmgr/vendor/github.com/ugorji/go/codec/gen.go
index 8544f04..1a27675 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/gen.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen.go
@@ -12,7 +12,6 @@ import (
"io"
"io/ioutil"
"math/rand"
- "os"
"reflect"
"regexp"
"sort"
@@ -28,6 +27,7 @@ import (
// ---------------------------------------------------
// codecgen supports the full cycle of reflection-based codec:
// - RawExt
+// - Raw
// - Builtins
// - Extensions
// - (Binary|Text|JSON)(Unm|M)arshal
@@ -78,7 +78,7 @@ import (
// codecgen will panic if the file was generated with an old version of the library in use.
//
// Note:
-// It was a concious decision to have gen.go always explicitly call EncodeNil or TryDecodeAsNil.
+// It was a conscious decision to have gen.go always explicitly call EncodeNil or TryDecodeAsNil.
// This way, there isn't a function call overhead just to see that we should not enter a block of code.
// GenVersion is the current version of codecgen.
@@ -126,6 +126,7 @@ var (
genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice")
genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__")
genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`)
+ genCheckVendor bool
)
// genRunner holds some state used during a Gen run.
@@ -211,7 +212,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn
x.genRefPkgs(t)
}
if buildTags != "" {
- x.line("//+build " + buildTags)
+ x.line("// +build " + buildTags)
x.line("")
}
x.line(`
@@ -701,13 +702,17 @@ func (x *genRunner) enc(varname string, t reflect.Type) {
}
// check if
- // - type is RawExt
+ // - type is RawExt, Raw
// - the type implements (Text|JSON|Binary)(Unm|M)arshal
x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi)
x.linef("_ = %sm%s", genTempVarPfx, mi)
x.line("if false {") //start if block
defer func() { x.line("}") }() //end if block
+ if t == rawTyp {
+ x.linef("} else { z.EncRaw(%v)", varname)
+ return
+ }
if t == rawExtTyp {
x.linef("} else { r.EncodeRawExt(%v, e)", varname)
return
@@ -987,6 +992,14 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) {
}
func (x *genRunner) encListFallback(varname string, t reflect.Type) {
+ if t.AssignableTo(uint8SliceTyp) {
+ x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, []byte(%s))", x.xs, varname)
+ return
+ }
+ if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 {
+ x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, ([%v]byte(%s))[:])", x.xs, t.Len(), varname)
+ return
+ }
i := x.varsfx()
g := genTempVarPfx
x.line("r.EncodeArrayStart(len(" + varname + "))")
@@ -1123,7 +1136,7 @@ func (x *genRunner) dec(varname string, t reflect.Type) {
}
// check if
- // - type is RawExt
+ // - type is Raw, RawExt
// - the type implements (Text|JSON|Binary)(Unm|M)arshal
mi := x.varsfx()
x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi)
@@ -1131,6 +1144,10 @@ func (x *genRunner) dec(varname string, t reflect.Type) {
x.line("if false {") //start if block
defer func() { x.line("}") }() //end if block
+ if t == rawTyp {
+ x.linef("} else { *%v = z.DecRaw()", varname)
+ return
+ }
if t == rawExtTyp {
x.linef("} else { r.DecodeExt(%v, 0, nil)", varname)
return
@@ -1306,6 +1323,14 @@ func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type) (tryAs
}
func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type) {
+ if t.AssignableTo(uint8SliceTyp) {
+ x.line("*" + varname + " = r.DecodeBytes(*((*[]byte)(" + varname + ")), false, false)")
+ return
+ }
+ if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 {
+ x.linef("r.DecodeBytes( ((*[%s]byte)(%s))[:], false, true)", t.Len(), varname)
+ return
+ }
type tstruc struct {
TempVar string
Rand string
@@ -1421,7 +1446,7 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt
if si.i != -1 {
t2 = t.Field(int(si.i))
} else {
- //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value.
+ //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value.
// t2 = t.FieldByIndex(si.is)
t2typ := t
varname3 := varname
@@ -1509,7 +1534,7 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid
if si.i != -1 {
t2 = t.Field(int(si.i))
} else {
- //we must accomodate anonymous fields, where the embedded field is a nil pointer in the value.
+ //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value.
// t2 = t.FieldByIndex(si.is)
t2typ := t
varname3 := varname
@@ -1626,8 +1651,6 @@ func (x *genV) MethodNamePfx(prefix string, prim bool) string {
}
-var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
-
// genImportPath returns import path of a non-predeclared named typed, or an empty string otherwise.
//
// This handles the misbehaviour that occurs when 1.5-style vendoring is enabled,
@@ -1678,7 +1701,7 @@ func genNonPtr(t reflect.Type) reflect.Type {
func genTitleCaseName(s string) string {
switch s {
- case "interface{}":
+ case "interface{}", "interface {}":
return "Intf"
default:
return strings.ToUpper(s[0:1]) + s[1:]
@@ -1781,7 +1804,7 @@ func (x genInternal) FastpathLen() (l int) {
func genInternalZeroValue(s string) string {
switch s {
- case "interface{}":
+ case "interface{}", "interface {}":
return "nil"
case "bool":
return "false"
@@ -1933,7 +1956,7 @@ func genInternalInit() {
}
var gt genInternal
- // For each slice or map type, there must be a (symetrical) Encode and Decode fast-path function
+ // For each slice or map type, there must be a (symmetrical) Encode and Decode fast-path function
for _, s := range types {
gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]})
if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen_15.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen_15.go b/newtmgr/vendor/github.com/ugorji/go/codec/gen_15.go
new file mode 100644
index 0000000..ab76c31
--- /dev/null
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen_15.go
@@ -0,0 +1,12 @@
+// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// +build go1.5,!go1.6
+
+package codec
+
+import "os"
+
+func init() {
+ genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen_16.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen_16.go b/newtmgr/vendor/github.com/ugorji/go/codec/gen_16.go
new file mode 100644
index 0000000..87c04e2
--- /dev/null
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen_16.go
@@ -0,0 +1,12 @@
+// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// +build go1.6
+
+package codec
+
+import "os"
+
+func init() {
+ genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/gen_17.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/gen_17.go b/newtmgr/vendor/github.com/ugorji/go/codec/gen_17.go
new file mode 100644
index 0000000..3881a43
--- /dev/null
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/gen_17.go
@@ -0,0 +1,10 @@
+// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
+// Use of this source code is governed by a MIT license found in the LICENSE file.
+
+// +build go1.7
+
+package codec
+
+func init() {
+ genCheckVendor = true
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/helper.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/helper.go b/newtmgr/vendor/github.com/ugorji/go/codec/helper.go
index f3d2600..bf954ab 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/helper.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/helper.go
@@ -137,17 +137,6 @@ const (
// Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
recoverPanicToErr = true
- // Fast path functions try to create a fast path encode or decode implementation
- // for common maps and slices, by by-passing reflection altogether.
- fastpathEnabled = true
-
- // if checkStructForEmptyValue, check structs fields to see if an empty value.
- // This could be an expensive call, so possibly disable it.
- checkStructForEmptyValue = false
-
- // if derefForIsEmptyValue, deref pointers and interfaces when checking isEmptyValue
- derefForIsEmptyValue = false
-
// if resetSliceElemToZeroValue, then on decoding a slice, reset the element to a zero value first.
// Only concern is that, if the slice already contained some garbage, we will decode into that garbage.
// The chances of this are slim, so leave this "optimization".
@@ -217,16 +206,21 @@ const (
containerArrayEnd
)
-type rgetPoolT struct {
- encNames [8]string
- fNames [8]string
- etypes [8]uintptr
- sfis [8]*structFieldInfo
+// sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo
+type sfiIdx struct {
+ name string
+ index int
}
-var rgetPool = sync.Pool{
- New: func() interface{} { return new(rgetPoolT) },
-}
+// do not recurse if a containing type refers to an embedded type
+// which refers back to its containing type (via a pointer).
+// The second time this back-reference happens, break out,
+// so as not to cause an infinite loop.
+const rgetMaxRecursion = 2
+
+// Anecdotally, we believe most types have <= 12 fields.
+// Java's PMD rules set TooManyFields threshold to 15.
+const rgetPoolTArrayLen = 12
type rgetT struct {
fNames []string
@@ -235,6 +229,18 @@ type rgetT struct {
sfis []*structFieldInfo
}
+type rgetPoolT struct {
+ fNames [rgetPoolTArrayLen]string
+ encNames [rgetPoolTArrayLen]string
+ etypes [rgetPoolTArrayLen]uintptr
+ sfis [rgetPoolTArrayLen]*structFieldInfo
+ sfiidx [rgetPoolTArrayLen]sfiIdx
+}
+
+var rgetPool = sync.Pool{
+ New: func() interface{} { return new(rgetPoolT) },
+}
+
type containerStateRecv interface {
sendContainerState(containerState)
}
@@ -260,6 +266,7 @@ var (
stringTyp = reflect.TypeOf("")
timeTyp = reflect.TypeOf(time.Time{})
rawExtTyp = reflect.TypeOf(RawExt{})
+ rawTyp = reflect.TypeOf(Raw{})
uint8SliceTyp = reflect.TypeOf([]uint8(nil))
mapBySliceTyp = reflect.TypeOf((*MapBySlice)(nil)).Elem()
@@ -277,6 +284,7 @@ var (
uint8SliceTypId = reflect.ValueOf(uint8SliceTyp).Pointer()
rawExtTypId = reflect.ValueOf(rawExtTyp).Pointer()
+ rawTypId = reflect.ValueOf(rawTyp).Pointer()
intfTypId = reflect.ValueOf(intfTyp).Pointer()
timeTypId = reflect.ValueOf(timeTyp).Pointer()
stringTypId = reflect.ValueOf(stringTyp).Pointer()
@@ -357,6 +365,11 @@ type Handle interface {
isBinary() bool
}
+// Raw represents raw formatted bytes.
+// We "blindly" store it during encode and store the raw bytes during decode.
+// Note: it is dangerous during encode, so we may gate the behaviour behind an Encode flag which must be explicitly set.
+type Raw []byte
+
// RawExt represents raw unprocessed extension data.
// Some codecs will decode extension data as a *RawExt if there is no registered extension for the tag.
//
@@ -367,7 +380,7 @@ type RawExt struct {
// Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types
Data []byte
// Value represents the extension, if Data is nil.
- // Value is used by codecs (e.g. cbor) which use the format to do custom serialization of the types.
+ // Value is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types.
Value interface{}
}
@@ -545,7 +558,7 @@ func (o *extHandle) AddExt(
func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) {
// o is a pointer, because we may need to initialize it
if rt.PkgPath() == "" || rt.Kind() == reflect.Interface {
- err = fmt.Errorf("codec.Handle.AddExt: Takes named type, especially not a pointer or interface: %T",
+ err = fmt.Errorf("codec.Handle.AddExt: Takes named type, not a pointer or interface: %T",
reflect.Zero(rt).Interface())
return
}
@@ -588,7 +601,8 @@ func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn {
}
type structFieldInfo struct {
- encName string // encode name
+ encName string // encode name
+ fieldName string // field name
// only one of 'i' or 'is' can be set. If 'i' is -1, then 'is' has been set.
@@ -849,21 +863,18 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
}
if rt.Kind() == reflect.Struct {
- var siInfo *structFieldInfo
+ var omitEmpty bool
if f, ok := rt.FieldByName(structInfoFieldName); ok {
- siInfo = parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag))
+ siInfo := parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag))
ti.toArray = siInfo.toArray
+ omitEmpty = siInfo.omitEmpty
}
pi := rgetPool.Get()
pv := pi.(*rgetPoolT)
pv.etypes[0] = ti.baseId
vv := rgetT{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]}
- x.rget(rt, rtid, nil, &vv, siInfo)
- ti.sfip = make([]*structFieldInfo, len(vv.sfis))
- ti.sfi = make([]*structFieldInfo, len(vv.sfis))
- copy(ti.sfip, vv.sfis)
- sort.Sort(sfiSortedByEncName(vv.sfis))
- copy(ti.sfi, vv.sfis)
+ x.rget(rt, rtid, omitEmpty, nil, &vv)
+ ti.sfip, ti.sfi = rgetResolveSFI(vv.sfis, pv.sfiidx[:0])
rgetPool.Put(pi)
}
// sfi = sfip
@@ -877,26 +888,17 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
return
}
-func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr,
- indexstack []int, pv *rgetT, siInfo *structFieldInfo,
+func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool,
+ indexstack []int, pv *rgetT,
) {
- // This will read up the fields and store how to access the value.
- // It uses the go language's rules for embedding, as below:
- // - if a field has been seen while traversing, skip it
- // - if an encName has been seen while traversing, skip it
- // - if an embedded type has been seen, skip it
+ // Read up fields and store how to access the value.
//
- // Also, per Go's rules, embedded fields must be analyzed AFTER all top-level fields.
+ // It uses go's rules for message selectors,
+ // which say that the field with the shallowest depth is selected.
//
// Note: we consciously use slices, not a map, to simulate a set.
- // Typically, types have < 16 fields, and iteration using equals is faster than maps there
-
- type anonField struct {
- ft reflect.Type
- idx int
- }
-
- var anonFields []anonField
+ // Typically, types have < 16 fields,
+ // and iteration using equals is faster than maps there
LOOP:
for j, jlen := 0, rt.NumField(); j < jlen; j++ {
@@ -908,7 +910,8 @@ LOOP:
continue LOOP
}
- // if r1, _ := utf8.DecodeRuneInString(f.Name); r1 == utf8.RuneError || !unicode.IsUpper(r1) {
+ // if r1, _ := utf8.DecodeRuneInString(f.Name);
+ // r1 == utf8.RuneError || !unicode.IsUpper(r1) {
if f.PkgPath != "" && !f.Anonymous { // unexported, not embedded
continue
}
@@ -917,7 +920,8 @@ LOOP:
continue
}
var si *structFieldInfo
- // if anonymous and no struct tag (or it's blank), and a struct (or pointer to struct), inline it.
+ // if anonymous and no struct tag (or it's blank),
+ // and a struct (or pointer to struct), inline it.
if f.Anonymous && fkind != reflect.Interface {
doInline := stag == ""
if !doInline {
@@ -931,8 +935,31 @@ LOOP:
ft = ft.Elem()
}
if ft.Kind() == reflect.Struct {
- // handle anonymous fields after handling all the non-anon fields
- anonFields = append(anonFields, anonField{ft, j})
+ // if etypes contains this, don't call rget again (as fields are already seen here)
+ ftid := reflect.ValueOf(ft).Pointer()
+ // We cannot recurse forever, but we need to track other field depths.
+ // So - we break if we see a type twice (not the first time).
+ // This should be sufficient to handle an embedded type that refers to its
+ // owning type, which then refers to its embedded type.
+ processIt := true
+ numk := 0
+ for _, k := range pv.etypes {
+ if k == ftid {
+ numk++
+ if numk == rgetMaxRecursion {
+ processIt = false
+ break
+ }
+ }
+ }
+ if processIt {
+ pv.etypes = append(pv.etypes, ftid)
+ indexstack2 := make([]int, len(indexstack)+1)
+ copy(indexstack2, indexstack)
+ indexstack2[len(indexstack)] = j
+ // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
+ x.rget(ft, ftid, omitEmpty, indexstack2, pv)
+ }
continue
}
}
@@ -947,11 +974,6 @@ LOOP:
panic(noFieldNameToStructFieldInfoErr)
}
- for _, k := range pv.fNames {
- if k == f.Name {
- continue LOOP
- }
- }
pv.fNames = append(pv.fNames, f.Name)
if si == nil {
@@ -959,12 +981,8 @@ LOOP:
} else if si.encName == "" {
si.encName = f.Name
}
+ si.fieldName = f.Name
- for _, k := range pv.encNames {
- if k == si.encName {
- continue LOOP
- }
- }
pv.encNames = append(pv.encNames, si.encName)
// si.ikind = int(f.Type.Kind())
@@ -978,32 +996,60 @@ LOOP:
// si.is = append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
}
- if siInfo != nil {
- if siInfo.omitEmpty {
- si.omitEmpty = true
- }
+ if omitEmpty {
+ si.omitEmpty = true
}
pv.sfis = append(pv.sfis, si)
}
+}
- // now handle anonymous fields
-LOOP2:
- for _, af := range anonFields {
- // if etypes contains this, then do not call rget again (as the fields are already seen here)
- ftid := reflect.ValueOf(af.ft).Pointer()
- for _, k := range pv.etypes {
- if k == ftid {
- continue LOOP2
+// resolves the struct field info got from a call to rget.
+// Returns a trimmed, unsorted and sorted []*structFieldInfo.
+func rgetResolveSFI(x []*structFieldInfo, pv []sfiIdx) (y, z []*structFieldInfo) {
+ var n int
+ for i, v := range x {
+ xn := v.encName //TODO: fieldName or encName? use encName for now.
+ var found bool
+ for j, k := range pv {
+ if k.name == xn {
+ // one of them must be reset to nil, and the index updated appropriately to the other one
+ if len(v.is) == len(x[k.index].is) {
+ } else if len(v.is) < len(x[k.index].is) {
+ pv[j].index = i
+ if x[k.index] != nil {
+ x[k.index] = nil
+ n++
+ }
+ } else {
+ if x[i] != nil {
+ x[i] = nil
+ n++
+ }
+ }
+ found = true
+ break
}
}
- pv.etypes = append(pv.etypes, ftid)
+ if !found {
+ pv = append(pv, sfiIdx{xn, i})
+ }
+ }
- indexstack2 := make([]int, len(indexstack)+1)
- copy(indexstack2, indexstack)
- indexstack2[len(indexstack)] = af.idx
- // indexstack2 := append(append(make([]int, 0, len(indexstack)+4), indexstack...), j)
- x.rget(af.ft, ftid, indexstack2, pv, siInfo)
+ // remove all the nils
+ y = make([]*structFieldInfo, len(x)-n)
+ n = 0
+ for _, v := range x {
+ if v == nil {
+ continue
+ }
+ y[n] = v
+ n++
}
+
+ z = make([]*structFieldInfo, len(y))
+ copy(z, y)
+ sort.Sort(sfiSortedByEncName(z))
+ return
}
func panicToErr(err *error) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/helper_internal.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/helper_internal.go b/newtmgr/vendor/github.com/ugorji/go/codec/helper_internal.go
index dea981f..5d0727f 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/helper_internal.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/helper_internal.go
@@ -70,8 +70,8 @@ func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
return false
}
-func isEmptyValue(v reflect.Value) bool {
- return hIsEmptyValue(v, derefForIsEmptyValue, checkStructForEmptyValue)
+func isEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
+ return hIsEmptyValue(v, deref, checkStruct)
}
func pruneSignExt(v []byte, pos bool) (n int) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/newtmgr/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
index 7c2ffc0..8b06a00 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go
@@ -1,4 +1,4 @@
-//+build !unsafe
+// +build !unsafe
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/helper_unsafe.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/newtmgr/vendor/github.com/ugorji/go/codec/helper_unsafe.go
index 2928e4f..0f596c7 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/helper_unsafe.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/helper_unsafe.go
@@ -1,4 +1,4 @@
-//+build unsafe
+// +build unsafe
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
// Use of this source code is governed by a MIT license found in the LICENSE file.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/json.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/json.go b/newtmgr/vendor/github.com/ugorji/go/codec/json.go
index a04dfcb..13af12b 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/json.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/json.go
@@ -197,12 +197,20 @@ func (e *jsonEncDriver) EncodeBool(b bool) {
}
func (e *jsonEncDriver) EncodeFloat32(f float32) {
- e.w.writeb(strconv.AppendFloat(e.b[:0], float64(f), 'E', -1, 32))
+ e.encodeFloat(float64(f), 32)
}
func (e *jsonEncDriver) EncodeFloat64(f float64) {
// e.w.writestr(strconv.FormatFloat(f, 'E', -1, 64))
- e.w.writeb(strconv.AppendFloat(e.b[:0], f, 'E', -1, 64))
+ e.encodeFloat(f, 64)
+}
+
+func (e *jsonEncDriver) encodeFloat(f float64, numbits int) {
+ x := strconv.AppendFloat(e.b[:0], f, 'G', -1, numbits)
+ e.w.writeb(x)
+ if bytes.IndexByte(x, 'E') == -1 && bytes.IndexByte(x, '.') == -1 {
+ e.w.writen2('.', '0')
+ }
}
func (e *jsonEncDriver) EncodeInt(v int64) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/msgpack.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/msgpack.go b/newtmgr/vendor/github.com/ugorji/go/codec/msgpack.go
index f9f8723..e79830b 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/msgpack.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/msgpack.go
@@ -561,6 +561,13 @@ func (d *msgpackDecDriver) readNextBd() {
d.bdRead = true
}
+func (d *msgpackDecDriver) uncacheRead() {
+ if d.bdRead {
+ d.r.unreadn1()
+ d.bdRead = false
+ }
+}
+
func (d *msgpackDecDriver) ContainerType() (vt valueType) {
bd := d.bd
if bd == mpNil {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/rpc.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/rpc.go b/newtmgr/vendor/github.com/ugorji/go/codec/rpc.go
index dad53d0..8062bed 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/rpc.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/rpc.go
@@ -25,7 +25,7 @@ type Rpc interface {
}
// RpcCodecBuffered allows access to the underlying bufio.Reader/Writer
-// used by the rpc connection. It accomodates use-cases where the connection
+// used by the rpc connection. It accommodates use-cases where the connection
// should be used by rpc and non-rpc functions, e.g. streaming a file after
// sending an rpc response.
type RpcCodecBuffered interface {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/github.com/ugorji/go/codec/simple.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/github.com/ugorji/go/codec/simple.go b/newtmgr/vendor/github.com/ugorji/go/codec/simple.go
index 7c0ba7a..231d503 100644
--- a/newtmgr/vendor/github.com/ugorji/go/codec/simple.go
+++ b/newtmgr/vendor/github.com/ugorji/go/codec/simple.go
@@ -166,6 +166,13 @@ func (d *simpleDecDriver) readNextBd() {
d.bdRead = true
}
+func (d *simpleDecDriver) uncacheRead() {
+ if d.bdRead {
+ d.r.unreadn1()
+ d.bdRead = false
+ }
+}
+
func (d *simpleDecDriver) ContainerType() (vt valueType) {
if d.bd == simpleVdNil {
return valueTypeNil
@@ -474,7 +481,7 @@ func (d *simpleDecDriver) DecodeNaked() {
// SimpleHandle is a Handle for a very simple encoding format.
//
// simple is a simplistic codec similar to binc, but not as compact.
-// - Encoding of a value is always preceeded by the descriptor byte (bd)
+// - Encoding of a value is always preceded by the descriptor byte (bd)
// - True, false, nil are encoded fully in 1 byte (the descriptor)
// - Integers (intXXX, uintXXX) are encoded in 1, 2, 4 or 8 bytes (plus a descriptor byte).
// There are positive (uintXXX and intXXX >= 0) and negative (intXXX < 0) integers.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
index 4b6ff2a..4a13639 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
@@ -6,8 +6,6 @@
package unix
-const _SYS_dup = SYS_DUP3
-
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
index 440f54e..8119fde 100644
--- a/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
+++ b/newtmgr/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
@@ -7,13 +7,6 @@
package unix
-// Linux introduced getdents64 syscall for N64 ABI only in 3.10
-// (May 21 2013, rev dec33abaafc89bcbd78f85fad0513170415a26d5),
-// to support older kernels, we have to use getdents for mips64.
-// Also note that struct dirent is different for these two.
-// Lookup linux_dirent{,64} in kernel source code for details.
-const _SYS_getdents = SYS_GETDENTS
-
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml b/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
index e6def9a..3a5c933 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/.travis.yml
@@ -2,7 +2,6 @@ sudo: false
language: go
go:
- - 1.5.4
- 1.6.3
- tip
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS b/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
index 2e64e5c..0a5bf8f 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/AUTHORS
@@ -26,6 +26,7 @@ Kelvin Fo <vm...@gmail.com>
Ken-ichirou MATSUZAWA <ch...@h4.dion.ne.jp>
Matt Layher <md...@gmail.com>
Nathan Youngman <gi...@nathany.com>
+Patrick <pa...@dropbox.com>
Paul Hammond <pa...@paulhammond.org>
Pawel Knap <pa...@gmail.com>
Pieter Droogendijk <pi...@binky.org.uk>
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md b/newtmgr/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
index 96e3b7d..7fe8794 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## v1.4.1 / 2016-10-04
+
+* Fix flaky inotify stress test on Linux [#177](https://github.com/fsnotify/fsnotify/pull/177) (thanks @pattyshack)
+
## v1.4.0 / 2016-10-01
* add a String() method to Event.Op [#165](https://github.com/fsnotify/fsnotify/pull/165) (thanks @oozie)
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md b/newtmgr/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
index 617e45a..6a81ba4 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md
@@ -40,7 +40,7 @@ Contribute upstream:
3. Push to the branch (`git push fork my-new-feature`)
4. Create a new Pull Request on GitHub
-This workflow is [thoroughly explained by Katrina Owen](https://blog.splice.com/contributing-open-source-git-repositories-go/).
+This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/).
### Testing
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/gopkg.in/fsnotify.v1/README.md
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/gopkg.in/fsnotify.v1/README.md b/newtmgr/vendor/gopkg.in/fsnotify.v1/README.md
index 5ebce86..3c891e3 100644
--- a/newtmgr/vendor/gopkg.in/fsnotify.v1/README.md
+++ b/newtmgr/vendor/gopkg.in/fsnotify.v1/README.md
@@ -1,6 +1,6 @@
# File system notifications for Go
-[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) [![Coverage](http://gocover.io/_badge/github.com/fsnotify/fsnotify)](http://gocover.io/github.com/fsnotify/fsnotify)
+[![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify)
fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/mynewt.apache.org/newt/DISCLAIMER
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/DISCLAIMER b/newtmgr/vendor/mynewt.apache.org/newt/DISCLAIMER
new file mode 100644
index 0000000..1600825
--- /dev/null
+++ b/newtmgr/vendor/mynewt.apache.org/newt/DISCLAIMER
@@ -0,0 +1,8 @@
+Apache Mynewt is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Incubator PMC. Incubation is
+required of all newly accepted projects until a further review indicates
+that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF
+projects. While incubation status is not necessarily a reflection of the
+completeness or stability of the code, it does indicate that the project
+has yet to be fully endorsed by the ASF.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/mynewt.apache.org/newt/LICENSE
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/LICENSE b/newtmgr/vendor/mynewt.apache.org/newt/LICENSE
new file mode 100644
index 0000000..88a6f68
--- /dev/null
+++ b/newtmgr/vendor/mynewt.apache.org/newt/LICENSE
@@ -0,0 +1,244 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+This product bundles pretty, which is available under the MIT license. For
+details, see newt/vendor/github.com/kr/pretty/License
+
+This product bundles kr/text, which is available under the MIT license. For
+details, see newt/vendor/github.com/kr/text/License
+
+This product bundles mapstructure, which is available under the MIT license.
+For details, see newt/vendor/github.com/mitchellh/mapstructure/LICENSE
+
+This product bundles logrus, which is available under the MIT license. For
+details, see newt/vendor/github.com/Sirupsen/logrus/LICENSE
+
+This product bundles Cast, which is available under the MIT license. For
+details, see newt/vendor/github.com/spf13/cast/LICENSE
+
+This product bundles jWalterWeatherman, which is available under the MIT
+license. For details, see
+newt/vendor/github.com/spf13/jwalterweatherman/LICENSE
+
+This product bundles pflag, which is available under the "3-clause BSD"
+license. For details, see newt/vendor/github.com/spf13/pflag/LICENSE
+
+This product bundles the unix Go package, which is available under the
+"3-clause BSD" license. For details, see newt/vendor/golang.org/x/sys/LICENSE
+
+This product bundles fsnotify.v1, which is available under the "3-clause BSD"
+license. For details, see newt/vendor/gopkg.in/fsnotify.v1/LICENSE
+
+This product bundles yaml.v2's Go port of libyaml, which is available under the
+MIT license. For details, see:
+ * yaml/apic.go
+ * yaml/emitterc.go
+ * yaml/parserc.go
+ * yaml/readerc.go
+ * yaml/scannerc.go
+ * yaml/writerc.go
+ * yaml/yamlh.go
+ * yaml/yamlprivateh.go
+
+This product bundles viper, which is available under the MIT license. For
+details, see:
+ * viper/LICENSE
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b153d958/newtmgr/vendor/mynewt.apache.org/newt/NOTICE
----------------------------------------------------------------------
diff --git a/newtmgr/vendor/mynewt.apache.org/newt/NOTICE b/newtmgr/vendor/mynewt.apache.org/newt/NOTICE
new file mode 100644
index 0000000..94bea73
--- /dev/null
+++ b/newtmgr/vendor/mynewt.apache.org/newt/NOTICE
@@ -0,0 +1,8 @@
+Apache Mynewt (incubating)
+Copyright 2015-2016 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at
+Runtime Inc, copyright 2015.