You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/04/20 17:50:45 UTC

[GitHub] ccollins476ad commented on a change in pull request #995: sys/log: Updates to handle CBOR entries via nmgr

ccollins476ad commented on a change in pull request #995: sys/log: Updates to handle CBOR entries via nmgr
URL: https://github.com/apache/mynewt-core/pull/995#discussion_r183124301
 
 

 ##########
 File path: sys/log/full/src/log_nmgr.c
 ##########
 @@ -99,6 +105,35 @@ log_nmgr_encode_entry(struct log *log, struct log_offset *log_offset,
         goto err;
     }
 
+#if MYNEWT_VAL(LOG_VERSION) > 2
+    switch (ueh.ue_etype) {
+    case LOG_ETYPE_STRING:
+        /* Trim string data to 128 characters to keep it consistent with v2 */
+        dlen = min(len-sizeof(ueh), 128);
+
+        rc = log_read(log, dptr, data, sizeof(ueh), dlen);
+        if (rc < 0) {
+            rc = OS_ENOENT;
+            goto err;
+        }
+        data[rc] = 0;
+        break;
+    case LOG_ETYPE_CBOR:
+        /* We can't trim CBOR stream - need to put it complete */
+        dlen = len - sizeof(ueh);
+        break;
+    case LOG_ETYPE_BINARY:
+        /* XXX just some placeholder for now, perhaps should be base64 encoded? */
+        strcpy(data, "<binary>");
+        dlen = strlen(data);
+        break;
+    default:
+        assert(0);
+        strcpy(data, "<??\?>");
 
 Review comment:
   Accidental backslash? :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services