Ignore:
Timestamp:
Oct 4, 1999, 11:56:04 AM (26 years ago)
Author:
sandervl
Message:

Lots of changes by several people (see changelog for 4 October

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/os2heap.cpp

    r1104 r1118  
    1 /* $Id: os2heap.cpp,v 1.10 1999-10-01 16:03:10 sandervl Exp $ */
     1/* $Id: os2heap.cpp,v 1.11 1999-10-04 09:55:56 sandervl Exp $ */
    22
    33/*
     
    150150  heapelem->flags   = 0;    //only used when allocated with LocalAlloc
    151151  heapelem->lockCnt = 0;    //..    ..
     152  heapelem->magic   = MAGIC_NR_HEAP;
    152153
    153154  if(hmutex) {
     
    179180    return(FALSE);
    180181
     182  if(helem->magic != MAGIC_NR_HEAP)
     183  {
     184    dprintf(("OS2Heap::Lock ERROR BAD HEAP POINTER:%X\n", lpMem));
     185    return FALSE;
     186  }
     187
    181188  helem->lockCnt++;
    182189
     
    195202    return(FALSE);
    196203
     204  if(helem->magic != MAGIC_NR_HEAP)
     205  {
     206    dprintf(("OS2Heap::UnLock ERROR BAD HEAP POINTER:%X\n", lpMem));
     207    return FALSE;
     208  }
     209
    197210  helem->lockCnt--;
    198211
     
    208221    return(FALSE);
    209222
     223  if(helem->magic != MAGIC_NR_HEAP)
     224  {
     225    dprintf(("OS2Heap::GetFlags ERROR BAD HEAP POINTER:%X\n", lpMem));
     226    return FALSE;
     227  }
     228
    210229  return(helem->flags);
    211230}
     
    219238    return(666);
    220239
     240  if(helem->magic != MAGIC_NR_HEAP)
     241  {
     242    dprintf(("OS2Heap::GetLockCnt ERROR BAD HEAP POINTER:%X\n", lpMem));
     243    return FALSE;
     244  }
     245
    221246  return(helem->lockCnt);
    222247}
     
    235260LPVOID OS2Heap::ReAlloc(DWORD dwFlags, LPVOID lpMem, DWORD dwBytes)
    236261{
     262  HEAPELEM *helem = (HEAPELEM *)((char *)lpMem - sizeof(HEAPELEM));
    237263  LPVOID lpNewMem;
    238264  int    i;
     
    245271//  if (lpMem == 0)   return NULL;
    246272
     273  if (helem->magic != MAGIC_NR_HEAP)
     274  {
     275    dprintf(("OS2Heap::ReAlloc ERROR BAD HEAP POINTER:%X\n", lpMem));
     276    return lpMem;
     277  }
     278
    247279  if (Size(0,lpMem) == dwBytes) return lpMem; // if reallocation with same size
    248280                                                // don't do anything
     
    267299    return(FALSE);
    268300  }
     301
     302  if(helem->magic != MAGIC_NR_HEAP)
     303  {
     304    dprintf(("OS2Heap::Free ERROR BAD HEAP POINTER:%X\n", lpMem));
     305    return FALSE;
     306  }
     307
    269308#ifdef DEBUG1
    270309  int size = Size(0, lpMem);
Note: See TracChangeset for help on using the changeset viewer.