Ignore:
Timestamp:
Nov 25, 2006, 8:56:42 PM (19 years ago)
Author:
cinc
Message:

Implemented wpAllocMem() and wpFreeMem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/desktop/class_c/wpobject.c

    r104 r105  
    4747#include "wpobject.ih"
    4848
     49#include "desktoptypes.h"
     50
    4951NOM_Scope gpointer NOMLINK impl_WPObject_wpAllocMem(WPObject* nomSelf, const CORBA_unsigned_long cbBytes,
    5052                                                    CORBA_unsigned_long* prc, CORBA_Environment *ev)
    5153{
     54
    5255/* WPObjectData* nomThis=WPObjectGetData(nomSelf); */
    53   gpointer nomRetval;
     56  gpointer ptrMem=NULLHANDLE;
     57  PUSEITEM pui;
    5458
    55   return nomRetval;
     59  /* Add mem for the inuse list structures */
     60  ptrMem=NOMMalloc(cbBytes+sizeof(USEITEM)+sizeof(MEMORYITEM));
     61
     62  if(!ptrMem) {
     63    if(prc)
     64      *prc=(gulong)NOMERROR_NOT_ENOUGH_MEMORY;
     65    return NULLHANDLE;
     66  }
     67
     68  /* Fill the structures */
     69  pui=(PUSEITEM)ptrMem;
     70  pui->type=(ULONG)USAGE_MEMORY;
     71  pui++;
     72  ((MEMORYITEM*)pui)->cbBuffer=cbBytes;
     73 
     74#warning !!!!! Memory is not in inuse list !!!!!
     75  /* Add memory to in use list */
     76  //_wpAddToObjUseList(somSelf, (PUSEITEM)pMem);
     77 
     78  return ptrMem+sizeof(USEITEM)+sizeof(MEMORYITEM);   
    5679}
    5780
     
    6184  CORBA_boolean nomRetval;
    6285
    63   return nomRetval;
     86  if(!pByte)
     87    return FALSE;
     88
     89  /* remove from inuse list */
     90#warning !!!!! Memory not removed from inuse list !!!!!
     91  //_wpDeleteFromObjUseList(somSelf, (PUSEITEM)(pByte-sizeof(USEITEM)-sizeof(MEMORYITEM)) );
     92
     93  NOMFree(pByte-sizeof(USEITEM)-sizeof(MEMORYITEM));
     94  return TRUE; /* free can't fail */;
    6495}
    6596
Note: See TracChangeset for help on using the changeset viewer.