ccollins476ad commented on a change in pull request #2180: sys/config: Support 
for unsigned integer types
URL: https://github.com/apache/mynewt-core/pull/2180#discussion_r378420000
 
 

 ##########
 File path: sys/config/src/config.c
 ##########
 @@ -194,6 +196,34 @@ conf_value_from_str(char *val_str, enum conf_type type, 
void *vp, int maxlen)
         }
         *(int64_t *)vp = val64;
         break;
+    case CONF_UINT8:
+    case CONF_UINT16:
+    case CONF_UINT32:
+        uval = strtoul(val_str, &eptr, 0);
+        if (*eptr != '\0') {
+            goto err;
+        }
+        if (type == CONF_UINT8) {
+            if (uval > UINT8_MAX) {
+                goto err;
+            }
+            *(uint8_t *)vp = uval;
+        } else if (type == CONF_UINT16) {
+            if (uval > UINT16_MAX) {
+                goto err;
+            }
+            *(uint16_t *)vp = uval;
+        } else if (type == CONF_UINT32) {
 
 Review comment:
   Good point.  I will change it.

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


With regards,
Apache Git Services

Reply via email to