Merge branch 'master' of gitea.larke.org:klarke/libcw

This commit is contained in:
kevin.larke 2020-04-28 16:59:42 -04:00
commit cb00951d10
3 changed files with 22 additions and 4 deletions

View File

@ -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() 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 - thread needs setters and getters for internal variables
- change cwMpScNbQueue so that it does not require 'new'. - change cwMpScNbQueue so that it does not require 'new'.

View File

@ -38,12 +38,12 @@ namespace cw
{ {
// TODO: there is probably a way of using type_traits to make a more efficient comparison // TODO: there is probably a way of using type_traits to make a more efficient comparison
// and avoid the double conversion // and avoid the double conversion
double d_min = std::numeric_limits<DST_t>::min(); double d_min = 0; // std::numeric_limits<DST_t>::min() return smallest positive number which then fails this test when 'src' is zero.
double d_max = std::numeric_limits<DST_t>::max(); double d_max = std::numeric_limits<DST_t>::max();
if( d_min <= src and src <= d_max ) if( d_min <= (double)src && (double)src <= d_max )
dst = src; dst = src;
else 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; return kOkRC;

View File

@ -237,6 +237,15 @@ namespace cw
ele_t* _createEle( ui_t* p, ele_t* parent, unsigned appId, const char* eleName ) ele_t* _createEle( ui_t* p, ele_t* parent, unsigned appId, const char* eleName )
{ {
ele_t* e = mem::allocZ<ele_t>(); ele_t* e = mem::allocZ<ele_t>();
// 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->parent = parent;
e->uuId = p->eleN; e->uuId = p->eleN;
e->appId = appId; e->appId = appId;
@ -272,7 +281,7 @@ namespace cw
e->appId = m->appId; 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; return e;
} }