Changeset 64883 in vbox for trunk/include/iprt/asn1-generator-pass.h
- Timestamp:
- Dec 15, 2016 3:26:20 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asn1-generator-pass.h
r62583 r64883 372 372 # define RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi, a_OfApi, a_OfMember) \ 373 373 RTASN1TMPL_BEGIN_COMMON(); \ 374 RTAsn1MemInitA llocation(&pThis->Allocation, pAllocator); \374 RTAsn1MemInitArrayAllocation(&pThis->Allocation, pAllocator, sizeof(a_ItemType)); \ 375 375 int rc = RT_CONCAT(a_OfApi,_Init)(&pThis->a_OfMember, &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable)); \ 376 376 if (RT_FAILURE(rc)) \ … … 555 555 pCursor = &ThisCursor; \ 556 556 pThis->a_OfMember.Asn1Core.pOps = &RT_CONCAT3(g_,RTASN1TMPL_INT_NAME,_Vtable); \ 557 RTAsn1CursorInitA llocation(pCursor, &pThis->Allocation); \557 RTAsn1CursorInitArrayAllocation(pCursor, &pThis->Allocation, sizeof(a_ItemType)); \ 558 558 \ 559 559 uint32_t i = 0; \ … … 561 561 && RT_SUCCESS(rc)) \ 562 562 { \ 563 rc = RTAsn1MemGrowArray(&pThis->Allocation, \ 564 (void **)&pThis->paItems, \ 565 sizeof(pThis->paItems[0]), \ 566 i, \ 567 i + 1); \ 563 rc = RTAsn1MemResizeArray(&pThis->Allocation, (void ***)&pThis->papItems, i, i + 1); \ 568 564 if (RT_SUCCESS(rc)) \ 569 565 { \ 570 rc = RT_CONCAT(a_ItemApi,_DecodeAsn1)(pCursor, 0, &pThis->paItems[i], "paItems[#]"); \566 rc = RT_CONCAT(a_ItemApi,_DecodeAsn1)(pCursor, 0, pThis->papItems[i], "papItems[#]"); \ 571 567 if (RT_SUCCESS(rc)) \ 572 568 { \ … … 663 659 RTASN1TMPL_BEGIN_COMMON(); \ 664 660 for (uint32_t i = 0; i < pThis->cItems && rc == VINF_SUCCESS; i++) \ 665 rc = pfnCallback(RT_CONCAT(a_ItemApi,_GetAsn1Core)( &pThis->paItems[i]), "paItems[#]", uDepth, pvUser); \661 rc = pfnCallback(RT_CONCAT(a_ItemApi,_GetAsn1Core)(pThis->papItems[i]), "papItems[#]", uDepth, pvUser); \ 666 662 RTASN1TMPL_END_COMMON() 667 663 # define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi) … … 773 769 if (RT_SUCCESS(rc)) \ 774 770 { \ 775 RTAsn1MemInitA llocation(&pThis->Allocation, pAllocator); \771 RTAsn1MemInitArrayAllocation(&pThis->Allocation, pAllocator, sizeof(a_ItemType)); \ 776 772 uint32_t const cItems = pSrc->cItems; \ 777 773 if (cItems > 0) \ 778 774 { \ 779 rc = RTAsn1Mem GrowArray(&pThis->Allocation, (void **)&pThis->paItems, sizeof(pThis->paItems[0]), 0, cItems); \775 rc = RTAsn1MemResizeArray(&pThis->Allocation, (void ***)&pThis->papItems, 0, cItems); \ 780 776 if (RT_SUCCESS(rc)) \ 781 777 { \ … … 783 779 while (i < cItems) \ 784 780 { \ 785 rc = RT_CONCAT(a_ItemApi,_Clone)( &pThis->paItems[i], &pSrc->paItems[i], pAllocator); \781 rc = RT_CONCAT(a_ItemApi,_Clone)(pThis->papItems[i], pSrc->papItems[i], pAllocator); \ 786 782 if (RT_SUCCESS(rc)) \ 787 783 pThis->cItems = ++i; \ … … 990 986 if (cItems == pRight->cItems) \ 991 987 for (uint32_t i = 0; iDiff == 0 && i < cItems; i++) \ 992 iDiff = RT_CONCAT(a_ItemApi,_Compare)( &pLeft->paItems[i], &pRight->paItems[i]); \988 iDiff = RT_CONCAT(a_ItemApi,_Compare)(pLeft->papItems[i], pRight->papItems[i]); \ 993 989 else \ 994 990 iDiff = cItems < pRight->cItems ? -1 : 1; \ … … 1135 1131 RTASN1TMPL_BEGIN_COMMON(); \ 1136 1132 for (uint32_t i = 0; RT_SUCCESS(rc) && i < pThis->cItems; i++) \ 1137 rc = RT_CONCAT(a_ItemApi,_CheckSanity)( &pThis->paItems[i], fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \1138 pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::pa Items[#]"); \1133 rc = RT_CONCAT(a_ItemApi,_CheckSanity)(pThis->papItems[i], fFlags & RTASN1_CHECK_SANITY_F_COMMON_MASK, \ 1134 pErrInfo, RT_XSTR(RTASN1TMPL_TYPE) "::papItems[#]"); \ 1139 1135 if (RT_SUCCESS(rc)) { RTASN1TMPL_SET_SEQ_EXEC_CHECK_SANITY(); } \ 1140 1136 RTASN1TMPL_END_COMMON() … … 1269 1265 uint32_t i = pThis->cItems; \ 1270 1266 while (i-- > 0) \ 1271 RT_CONCAT(a_ItemApi,_Delete)(&pThis->paItems[i]); \ 1272 RTAsn1MemFree(&pThis->Allocation, pThis->paItems); \ 1273 pThis->paItems = NULL; \ 1267 RT_CONCAT(a_ItemApi,_Delete)(pThis->papItems[i]); \ 1268 RTAsn1MemFreeArray(&pThis->Allocation, (void **)pThis->papItems); \ 1269 pThis->papItems = NULL; \ 1270 pThis->cItems = 0; \ 1274 1271 RTASN1TMPL_END_COMMON() 1275 1272 # define RTASN1TMPL_SEQ_OF(a_ItemType, a_ItemApi) RTASN1TMPL_SET_SEQ_OF_COMMON(a_ItemType, a_ItemApi)
Note:
See TracChangeset
for help on using the changeset viewer.