Changeset 73996 in vbox
- Timestamp:
- Aug 31, 2018 10:40:15 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124737
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/json.cpp
r73981 r73996 1351 1351 1352 1352 1353 #define RTJSON_ASSERT_ TYPE_RETURN(pJson, enmExpectedType, ret) do { \1353 #define RTJSON_ASSERT_VALID_HANDLE_AND_TYPE_RETURN(pJson, enmExpectedType, ret) do { \ 1354 1354 AssertPtrReturn((pJson), (ret)); \ 1355 1355 AssertReturn((pJson) != NIL_RTJSONVAL, (ret)); \ … … 1358 1358 1359 1359 #define RTJSON_TYPECHECK_RETURN(pJson, enmExpectedType) do {\ 1360 if (RT_LIKELY((pJson) != NIL_RTJSONVAL)) { /*likely*/ } \1361 else return VERR_INVALID_HANDLE; \1362 1360 if ((pJson)->enmType == (enmExpectedType)) { /*likely*/ } \ 1363 else return VERR_JSON_VALUE_INVALID_TYPE;\1361 else { /*AssertFailed();*/ return VERR_JSON_VALUE_INVALID_TYPE; } \ 1364 1362 } while (0) 1365 1363 1366 1364 1367 1365 #define RTJSON_TYPECHECK_CONTAINER_RETURN(pJson) do { \ 1368 if (RT_LIKELY((pJson) != NIL_RTJSONVAL)) { /* likely */ } \1369 else return VERR_INVALID_HANDLE; \1370 1366 if ( (pJson)->enmType == RTJSONVALTYPE_ARRAY \ 1371 1367 || (pJson)->enmType == RTJSONVALTYPE_OBJECT) \ 1372 1368 { /* likely */ } \ 1373 else return VERR_JSON_VALUE_INVALID_TYPE;\1369 else { /*AssertFailed();*/ return VERR_JSON_VALUE_INVALID_TYPE;} \ 1374 1370 } while (0) 1375 1371 … … 1378 1374 { 1379 1375 PRTJSONVALINT pThis = hJsonVal; 1380 RTJSON_ASSERT_ TYPE_RETURN(pThis, RTJSONVALTYPE_STRING, NULL);1376 RTJSON_ASSERT_VALID_HANDLE_AND_TYPE_RETURN(pThis, RTJSONVALTYPE_STRING, NULL); 1381 1377 1382 1378 return pThis->Type.String.pszStr; … … 1487 1483 { 1488 1484 PRTJSONVALINT pThis = hJsonVal; 1489 RTJSON_ASSERT_ TYPE_RETURN(pThis, RTJSONVALTYPE_ARRAY, 0);1485 RTJSON_ASSERT_VALID_HANDLE_AND_TYPE_RETURN(pThis, RTJSONVALTYPE_ARRAY, 0); 1490 1486 1491 1487 return pThis->Type.Array.cItems;
Note:
See TracChangeset
for help on using the changeset viewer.