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'. 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; 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; }