This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-artifact.git

commit 8fe37e2c13ca5e9f308a1ce52fa41df72626b676
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Wed Aug 12 14:32:47 2020 -0700

    image: Add some missing fields to json conversion
---
 image/map.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/image/map.go b/image/map.go
index 947cb88..7e95aa0 100644
--- a/image/map.go
+++ b/image/map.go
@@ -31,6 +31,7 @@ func (h *ImageHdr) Map(offset int) map[string]interface{} {
                "_offset": offset,
                "flags":   h.Flags,
                "hdr_sz":  h.HdrSz,
+               "prot_sz": h.ProtSz,
                "img_sz":  h.ImgSz,
                "magic":   h.Magic,
                "vers":    h.Vers.String(),
@@ -72,6 +73,12 @@ func (img *Image) Map() (map[string]interface{}, error) {
        m := map[string]interface{}{}
        m["header"] = img.Header.Map(offs.Header)
        m["body"] = rawBodyMap(offs.Body)
+
+       if img.Header.ProtSz > 0 {
+               protTrailer := img.ProtTrailer()
+               m["prot_trailer"] = protTrailer.Map(offs.ProtTrailer)
+       }
+
        trailer := img.Trailer()
        m["trailer"] = trailer.Map(offs.Trailer)
 

Reply via email to