Ignore:
Timestamp:
Feb 15, 2002, 4:07:41 PM (24 years ago)
Author:
sandervl
Message:

Wine 20020215 resync + added extended logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/oleaut32/safearray.c

    r6944 r7916  
    2121#define SYSDUPSTRING(str) SysAllocStringLen((str), SysStringLen(str))
    2222
    23 /* Localy used methods */
     23/* Locally used methods */
    2424static INT 
    2525endOfDim(LONG *coor, SAFEARRAYBOUND *mat, LONG dim, LONG realDim);
     
    102102};
    103103
    104 static const int LAST_VARTYPE = sizeof(VARTYPE_SIZE)/sizeof(ULONG);
     104static const int LAST_VARTYPE = sizeof(VARTYPE_SIZE)/sizeof(VARTYPE_SIZE[0]);
    105105
    106106
     
    128128
    129129  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 */
     140HRESULT 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);
    130150}
    131151
     
    357377    }
    358378    else if( psa->fFeatures == FADF_VARIANT) {
    359       HRESULT hr = VariantCopy(pv, elementStorageAddress);
     379      HRESULT hr;
     380      VariantInit(pv);
     381      hr = VariantCopy(pv, elementStorageAddress);
    360382      if (FAILED(hr)) {
    361383        SafeArrayUnlock(psa);
     
    514536  if(! validCoordinate(rgIndices, psa))
    515537    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   */
    516542
    517543  /* Figure out the number of items to skip */
     
    786812    lDelta *= psa->rgsabound[cDims].cElements;
    787813
     814  TRACE("elements=%ld, Lbound=%ld (delta=%ld)\n", psaboundNew->cElements, psaboundNew->lLbound, lDelta);
     815
    788816  if (lDelta == 0) { ;/* same size, maybe a change of lLbound, just set it */
    789817
     
    883911       releasing to the system the unused memory */
    884912
    885     if((pvNewBlock = HeapReAlloc(GetProcessHeap(), 0, psa->pvData,
     913    if((pvNewBlock = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, psa->pvData,
    886914       (ulWholeArraySize + lDelta) * psa->cbElements)) == NULL)
    887915        return FALSE; /* TODO If we get here it means:
     
    896924       the descriptor in SafeArrayCreateVector function. */
    897925
    898     if((pvNewBlock = HeapAlloc(GetProcessHeap(), 0,
     926    if((pvNewBlock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    899927       ulWholeArraySize * psa->cbElements)) == NULL)
    900928        return FALSE;
     
    9931021  HRESULT hRes;
    9941022
     1023  if (!psa->cDims) return FALSE;
    9951024  for(; iter<psa->cDims; iter++) {
     1025    TRACE("coor[%d]=%ld\n", iter, coor[iter]);
    9961026    if((hRes = SafeArrayGetLBound(psa, (iter+1), &lLBound)) != S_OK)
    9971027      return FALSE;
     
    9991029      return FALSE;
    10001030 
    1001     if(lLBound == lUBound)
     1031    if(lLBound > lUBound)
    10021032      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))
    10071035      return FALSE;
    10081036  }
    1009   return FALSE;
     1037  return TRUE;
    10101038
    10111039
Note: See TracChangeset for help on using the changeset viewer.