|
@@ -1870,8 +1870,12 @@ cmDspRC_t _cmDspRsrcWritePath( cmDspSysH_t h, cmChar_t** pathStrRef, cmChar_t**
|
1870
|
1870
|
break;
|
1871
|
1871
|
|
1872
|
1872
|
if( prevStr != NULL )
|
1873
|
|
- path = cmTextAppendSS(path,"/");
|
1874
|
|
- path = cmTextAppendSS(path,prevStr);
|
|
1873
|
+ {
|
|
1874
|
+ if( path != NULL )
|
|
1875
|
+ path = cmTextAppendSS(path,"/");
|
|
1876
|
+
|
|
1877
|
+ path = cmTextAppendSS(path,prevStr);
|
|
1878
|
+ }
|
1875
|
1879
|
|
1876
|
1880
|
prevStr = str;
|
1877
|
1881
|
}
|
|
@@ -2333,21 +2337,42 @@ cmDspRC_t cmDspRsrcStringArray( cmDspSysH_t h, unsigned* np, const cmChar_t*** v
|
2333
|
2337
|
return rc;
|
2334
|
2338
|
}
|
2335
|
2339
|
|
|
2340
|
+cmDspRC_t _cmDspWritePathAndParent( cmDspSysH_t h, cmChar_t** pathRef, cmChar_t** varLabelRef, cmJsonNode_t** parentRef, va_list vl )
|
|
2341
|
+{
|
|
2342
|
+ cmDsp_t* p = _cmDspHandleToPtr(h);
|
|
2343
|
+ cmJsonH_t jsH = cmDspSysPgmRsrcHandle(h);
|
|
2344
|
+ cmDspRC_t rc;
|
|
2345
|
+
|
|
2346
|
+ if((rc = _cmDspRsrcWritePath(h,pathRef,varLabelRef,vl)) != kOkDspRC )
|
|
2347
|
+ goto errLabel;
|
|
2348
|
+
|
|
2349
|
+ if( *pathRef == NULL )
|
|
2350
|
+ *parentRef = cmJsonRoot(jsH);
|
|
2351
|
+ else
|
|
2352
|
+ *parentRef = cmJsonFindPathValue( jsH, *pathRef, cmJsonRoot(jsH), kPairTId );
|
|
2353
|
+
|
|
2354
|
+ if( *parentRef == NULL )
|
|
2355
|
+ {
|
|
2356
|
+ rc = cmErrMsg(&p->err,kJsonFailDspRC,"The parent object '%s' for variable '%s' could not be found.",cmStringNullGuard(*pathRef),cmStringNullGuard(*varLabelRef));
|
|
2357
|
+ goto errLabel;
|
|
2358
|
+ }
|
|
2359
|
+
|
|
2360
|
+ errLabel:
|
|
2361
|
+ return rc;
|
|
2362
|
+}
|
|
2363
|
+
|
2336
|
2364
|
cmDspRC_t cmDspRsrcWriteStringV( cmDspSysH_t h, const cmChar_t* v, va_list vl )
|
2337
|
2365
|
{
|
2338
|
2366
|
cmDsp_t* p = _cmDspHandleToPtr(h);
|
2339
|
|
- cmChar_t* pathStr = NULL;
|
2340
|
|
- cmChar_t* varStr = NULL;
|
2341
|
2367
|
cmJsonH_t jsH = cmDspSysPgmRsrcHandle(h);
|
|
2368
|
+ cmChar_t* varStr = NULL;
|
|
2369
|
+ cmChar_t* pathStr = NULL;
|
2342
|
2370
|
cmJsonNode_t* parentObjNodePtr = NULL;
|
2343
|
2371
|
cmDspRC_t rc;
|
2344
|
2372
|
|
2345
|
|
- if((rc = _cmDspRsrcWritePath(h,&pathStr,&varStr,vl)) != kOkDspRC )
|
|
2373
|
+ if((rc = _cmDspWritePathAndParent(h, &pathStr, &varStr, &parentObjNodePtr, vl )) != kOkDspRC )
|
2346
|
2374
|
goto errLabel;
|
2347
|
2375
|
|
2348
|
|
- if((parentObjNodePtr = cmJsonFindPathValue( jsH, pathStr, cmJsonRoot(jsH), kPairTId )) == NULL )
|
2349
|
|
- rc = cmErrMsg(&p->err,kJsonFailDspRC,"The parent object '%s' for variable '%s' could not be found.",cmStringNullGuard(pathStr),cmStringNullGuard(varStr));
|
2350
|
|
-
|
2351
|
2376
|
if( cmJsonInsertOrReplacePairString( jsH, parentObjNodePtr, varStr, kStringTId, v ) != kOkJsRC )
|
2352
|
2377
|
rc = cmErrMsg(&p->err,kJsonFailDspRC,"Write 'string' resource value failed for path '%s' and variable '%s'",cmStringNullGuard(pathStr),cmStringNullGuard(varStr));
|
2353
|
2378
|
|