Changeset 7916 for trunk/src/oleaut32/safearray.c
- Timestamp:
- Feb 15, 2002, 4:07:41 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oleaut32/safearray.c
r6944 r7916 21 21 #define SYSDUPSTRING(str) SysAllocStringLen((str), SysStringLen(str)) 22 22 23 /* Local y used methods */23 /* Locally used methods */ 24 24 static INT 25 25 endOfDim(LONG *coor, SAFEARRAYBOUND *mat, LONG dim, LONG realDim); … … 102 102 }; 103 103 104 static const int LAST_VARTYPE = sizeof(VARTYPE_SIZE)/sizeof( ULONG);104 static const int LAST_VARTYPE = sizeof(VARTYPE_SIZE)/sizeof(VARTYPE_SIZE[0]); 105 105 106 106 … … 128 128 129 129 return(S_OK); 130 } 131 132 /************************************************************************* 133 * SafeArrayAllocDescriptorEx (OLEAUT32.429) 134 * Allocate the appropriate amount of memory for the SafeArray descriptor 135 * 136 * This is a minimal implementation just to get things moving. 137 * 138 * The MSDN documentation on this doesn't tell us much. 139 */ 140 HRESULT WINAPI SafeArrayAllocDescriptorEx( 141 VARTYPE vt, 142 UINT cDims, 143 SAFEARRAY **ppsaOut) 144 { 145 if ( (vt >= LAST_VARTYPE) || 146 ( VARTYPE_SIZE[vt] == VARTYPE_NOT_SUPPORTED ) ) 147 return E_UNEXPECTED; 148 149 return SafeArrayAllocDescriptor (cDims, ppsaOut); 130 150 } 131 151 … … 357 377 } 358 378 else if( psa->fFeatures == FADF_VARIANT) { 359 HRESULT hr = VariantCopy(pv, elementStorageAddress); 379 HRESULT hr; 380 VariantInit(pv); 381 hr = VariantCopy(pv, elementStorageAddress); 360 382 if (FAILED(hr)) { 361 383 SafeArrayUnlock(psa); … … 514 536 if(! validCoordinate(rgIndices, psa)) 515 537 return DISP_E_BADINDEX; 538 539 /* Although it is dangerous to do this without having a lock, it is not 540 * illegal. Microsoft do warn of the danger. 541 */ 516 542 517 543 /* Figure out the number of items to skip */ … … 786 812 lDelta *= psa->rgsabound[cDims].cElements; 787 813 814 TRACE("elements=%ld, Lbound=%ld (delta=%ld)\n", psaboundNew->cElements, psaboundNew->lLbound, lDelta); 815 788 816 if (lDelta == 0) { ;/* same size, maybe a change of lLbound, just set it */ 789 817 … … 883 911 releasing to the system the unused memory */ 884 912 885 if((pvNewBlock = HeapReAlloc(GetProcessHeap(), 0, psa->pvData,913 if((pvNewBlock = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, psa->pvData, 886 914 (ulWholeArraySize + lDelta) * psa->cbElements)) == NULL) 887 915 return FALSE; /* TODO If we get here it means: … … 896 924 the descriptor in SafeArrayCreateVector function. */ 897 925 898 if((pvNewBlock = HeapAlloc(GetProcessHeap(), 0,926 if((pvNewBlock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 899 927 ulWholeArraySize * psa->cbElements)) == NULL) 900 928 return FALSE; … … 993 1021 HRESULT hRes; 994 1022 1023 if (!psa->cDims) return FALSE; 995 1024 for(; iter<psa->cDims; iter++) { 1025 TRACE("coor[%d]=%ld\n", iter, coor[iter]); 996 1026 if((hRes = SafeArrayGetLBound(psa, (iter+1), &lLBound)) != S_OK) 997 1027 return FALSE; … … 999 1029 return FALSE; 1000 1030 1001 if(lLBound ==lUBound)1031 if(lLBound > lUBound) 1002 1032 return FALSE; 1003 1004 if((coor[iter] >= lLBound) && (coor[iter] <= lUBound)) 1005 return TRUE; 1006 else 1033 1034 if((coor[iter] < lLBound) || (coor[iter] > lUBound)) 1007 1035 return FALSE; 1008 1036 } 1009 return FALSE;1037 return TRUE; 1010 1038 } 1011 1039
Note:
See TracChangeset
for help on using the changeset viewer.