From: Tyrel D. <ty...@us...> - 2013-04-15 22:24:20
|
Update of /cvsroot/sblim/cmpi-devel In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv27254 Modified Files: CmpiImpl.cpp NEWS Log Message: Fixed #2630: TypeMismatch exception using c-style strings and CmpiArray Index: NEWS =================================================================== RCS file: /cvsroot/sblim/cmpi-devel/NEWS,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- NEWS 31 Jul 2012 04:04:43 -0000 1.26 +++ NEWS 15 Apr 2013 22:24:17 -0000 1.27 @@ -1,3 +1,6 @@ +Bugs fixed: +- #2630 cmpi-devel: TypeMismatch exception using c-style strings and CmpiArray + Changes in 2.0.3 ================ Index: CmpiImpl.cpp =================================================================== RCS file: /cvsroot/sblim/cmpi-devel/CmpiImpl.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- CmpiImpl.cpp 10 Jun 2012 01:30:07 -0000 1.17 +++ CmpiImpl.cpp 15 Apr 2013 22:24:17 -0000 1.18 @@ -738,10 +738,22 @@ CmpiArrayIdx& CmpiArrayIdx::operator=(const CmpiData& v) { CMPIStatus rc={CMPI_RC_OK,NULL}; - if (ar.getEnc()->ft->getSimpleType(ar.getEnc(),&rc)!=v._data.type) - throw CmpiStatus(CMPI_RC_ERR_TYPE_MISMATCH); - rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v._data.value, + CMPIType arType = CMPI_null; + + arType = ar.getEnc()->ft->getSimpleType(ar.getEnc(), &rc); + if (arType != v._data.type) { + /* SFCB converts CMPI_chars arrays to CMPI_string internally. + Need to check the case where CmpiData encapsulates a C-style string */ + if (arType == CMPI_string && v._data.type == CMPI_chars) { + rc = ar.getEnc()->ft->setElementAt(ar.getEnc(), idx, (CMPIValue *)v._data.value.chars, CMPI_chars); + } else { + throw CmpiStatus(CMPI_RC_ERR_TYPE_MISMATCH); + } + } else { + rc=ar.getEnc()->ft->setElementAt(ar.getEnc(),idx,(CMPIValue*)&v._data.value, v._data.type); + } + if (rc.rc!=CMPI_RC_OK) throw CmpiStatus(rc); return *this; } |