From aa7f94529944aa729e0f674473166ff18d9c697e Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Tue, 28 Apr 2020 16:37:36 -0400 Subject: [PATCH 1/3] cwUi.h : _createEle() the parent id is set to the first ancestor which has a valid appId. --- cwUi.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cwUi.cpp b/cwUi.cpp index 390a4cf..8ee66a7 100644 --- a/cwUi.cpp +++ b/cwUi.cpp @@ -237,6 +237,15 @@ namespace cw ele_t* _createEle( ui_t* p, ele_t* parent, unsigned appId, const char* eleName ) { ele_t* e = mem::allocZ(); + + // got up the tree looking for a parent with a valid appId + ele_t* par = parent; + while( par != nullptr && par->appId == kInvalidId ) + par = par->parent; + + if( par != nullptr ) + parent = par; + e->parent = parent; e->uuId = p->eleN; e->appId = appId; @@ -272,7 +281,7 @@ namespace cw e->appId = m->appId; } - printf("uuid:%i appId:%i %s\n", e->uuId,e->appId,cwStringNullGuard(e->eleName)); + printf("uuid:%i appId:%i par-uuid:%i %s\n", e->uuId,e->appId,e->parent==nullptr ? -1 : e->parent->uuId, cwStringNullGuard(e->eleName)); return e; } From 01a9b7605af2fdabea76419aa760821175dfaf11 Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Tue, 28 Apr 2020 16:38:43 -0400 Subject: [PATCH 2/3] cwNumericConvert.h : min range limit in numeric_convert() changed from double.min() to 0. See note in source. --- cwNumericConvert.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cwNumericConvert.h b/cwNumericConvert.h index d2153ea..d110040 100644 --- a/cwNumericConvert.h +++ b/cwNumericConvert.h @@ -38,12 +38,12 @@ namespace cw { // TODO: there is probably a way of using type_traits to make a more efficient comparison // and avoid the double conversion - double d_min = std::numeric_limits::min(); + double d_min = 0; // std::numeric_limits::min() return smallest positive number which then fails this test when 'src' is zero. double d_max = std::numeric_limits::max(); - if( d_min <= src and src <= d_max ) + if( d_min <= (double)src && (double)src <= d_max ) dst = src; else - return cwLogError(kInvalidArgRC,"Numeric conversion failed. The source value is outside the range of the destination value." ); + return cwLogError(kInvalidArgRC,"Numeric conversion failed. The source value is outside the range of the destination value. min:%f max:%f src:%f",d_min,d_max,(double)src ); return kOkRC; From a46453f3714c572533ffaaf05c3667493c891666 Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Tue, 28 Apr 2020 16:38:54 -0400 Subject: [PATCH 3/3] README.md : Updates --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 31ada7a..e5b74d1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ This is easy to reproduce by simply decreasing the size of the buffers in the pr - numeric_convert() in cwNumericConvert.h could be made more efficient using type_traits. +- numeric_convert() d_min is NOT zero, it's smallest positive number, this fails when src == 0. + min value is now set to zero. + +- The UI app id map should be validated after the UI is created. +In otherwords the parent/child pairs shoud actually exists. + +- Add an ui::appIdToUuId() that returns the first matching appId, and then +optionally looks for duplicates as an error checking scheme. + - thread needs setters and getters for internal variables - change cwMpScNbQueue so that it does not require 'new'.