- Timestamp:
- Oct 14, 1999, 3:19:22 AM (26 years ago)
- Location:
- trunk/src/win32k/misc
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/misc/malloc.c
r847 r1271 1 /* $Id: malloc.c,v 1. 1 1999-09-06 02:20:02bird Exp $1 /* $Id: malloc.c,v 1.2 1999-10-14 01:19:21 bird Exp $ 2 2 * 3 3 * Heap. … … 19 19 20 20 #define SIGNATURE 0xBEEFFEEB 21 #define CB_HDR (sizeof(MEMBLOCK) - 1) /* size of MEMBLOCK header (in bytes) */ 21 /*#define CB_HDR (sizeof(MEMBLOCK) - 1) /* size of MEMBLOCK header (in bytes) */ 22 #define CB_HDR (int)&(((PMEMBLOCK)0)->achUserData[0]) 22 23 #define PNEXT_BLOCK(a) ((PMEMBLOCK)((unsigned)(a) + CB_HDR + (a)->cbSize)) 23 24 … … 25 26 #define INCL_DOSERRORS 26 27 #ifdef RING0 27 #define INCL_NOAPI28 #define INCL_NOAPI 28 29 #else 29 #define INCL_DOSMEMMGR30 #define INCL_DOSMEMMGR 30 31 #endif 32 31 33 32 34 /****************************************************************************** … … 34 36 ******************************************************************************/ 35 37 #include <os2.h> 36 38 #ifdef RING0 39 #include "dev32hlp.h" 40 #include "asmutils.h" 41 #else 42 #include <builtin.h> 43 #define Int3() __interrupt(3) 44 #endif 37 45 #include "log.h" 38 #include "dev32hlp.h"39 #include "asmutils.h"40 46 #include "malloc.h" 41 #include "memory.h"47 #include <memory.h> 42 48 43 49 … … 45 51 * Structs and Typedefs 46 52 ******************************************************************************/ 53 #pragma pack(1) 47 54 typedef struct _MEMBLOCK /* MB */ 48 55 { … … 54 61 unsigned char achUserData[1]; 55 62 } MEMBLOCK, *PMEMBLOCK; 56 63 #pragma pack() 57 64 58 65 /****************************************************************************** 59 66 * Global data 60 67 ******************************************************************************/ 68 /*#pragma info(nogen, nouni, noext)*/ 61 69 static PMEMBLOCK pUsed; /* pointer to the used memblock chain. */ 62 70 static PMEMBLOCK pFree; /* pointer to the free memblock chain. */ 63 71 static unsigned cbFree; /* bytes of free user memory in the heap.*/ 64 unsigned _uHeapMinPtr; /* heap pointers are greater or equal to this.*/ 65 unsigned _uHeapMaxPtr; /* heap pointers are less than this. */ 72 unsigned _uHeapMinPtr; /* heap pointers are greater or equal to this.*/ 73 unsigned _uHeapMaxPtr; /* heap pointers are less than this. */ 74 #ifndef RING0 75 char fInited; /* init flag */ 76 #endif 66 77 67 78 /****************************************************************************** … … 277 288 pUsed = NULL; 278 289 279 #if RING0290 #ifdef RING0 280 291 pFree = D32Hlp_VMAlloc(VMDHA_SWAP | VMDHA_USEHIGHMEM, cbSize, ~0UL); 281 292 #else 282 if (DosAllocMem( &pFree, cbSize, PAG_COMMIT | PAG_READ | PAG_WRITE) != 0)283 pFree = NULL 293 if (DosAllocMem((void*)&pFree, cbSize, PAG_COMMIT | PAG_READ | PAG_WRITE) != 0) 294 pFree = NULL; 284 295 #endif 285 296 if (pFree == NULL) … … 308 319 return -2; 309 320 } 321 #endif 322 #ifdef RING3 323 fInited = TRUE; 310 324 #endif 311 325 return 0; … … 323 337 { 324 338 void *pvRet = NULL; 339 325 340 #ifdef DEBUG_ALLOC 326 341 if (!_heap_check()) … … 384 399 pvRet = malloc(cbNew); 385 400 if (pvRet != NULL) 401 { 386 402 memcpy(pvRet, pv, pMemblock->cbSize); 387 } 388 403 free(pv); 404 } 405 } 406 return pvRet; 389 407 } 390 408 return NULL; … … 598 616 599 617 618 #if !defined(RING0) && defined(__IBMC__) 619 620 /** 621 * Initialize Memory Functions 622 * Called from _exeentry. 623 */ 624 int _rmem_init(void) 625 { 626 int rc = heapInit(HEAP_SIZE); 627 return rc; 628 } 629 630 /** 631 * Initialize Memory Functions 632 * Called from _exeentry. 633 */ 634 int _rmem_term(void) 635 { 636 return 0; 637 } 638 639 #endif -
trunk/src/win32k/misc/new.cpp
r847 r1271 1 /* $Id: new.cpp,v 1. 1 1999-09-06 02:20:02bird Exp $1 /* $Id: new.cpp,v 1.2 1999-10-14 01:19:21 bird Exp $ 2 2 * 3 3 * new - new and delete operators. … … 20 20 21 21 #include "new.h" 22 #include "cout.h"23 22 #include "malloc.h" 23 #include "log.h" 24 24 25 25 26 #pragma info(none) 26 27 /** 27 28 * New. … … 40 41 void *operator new(size_t size, void *location) 41 42 { 42 cout << "operator new(size,location) not implemented"<< endl;43 dprintf(("operator new(size,location) not implemented\n")); 43 44 return NULL; 44 45 } … … 50 51 void *operator new[](size_t size) 51 52 { 52 cout << "operator new[](size) not implemented"<< endl;53 dprintf(("operator new[](size) not implemented\n")); 53 54 return NULL; 54 55 } … … 60 61 void *operator new[](size_t size, void *location) 61 62 { 62 cout << "operator new[](size,location) not implemented"<< endl;63 dprintf(("operator new[](size,location) not implemented\n")); 63 64 return NULL; 64 65 } 65 66 66 67 #ifndef __DEBUG_ALLOC__ 67 68 /** 68 69 * Delete. … … 80 81 void operator delete[](void *location) 81 82 { 82 cout << "operator delete[](location) - not implemented" << endl; 83 dprintf(("operator delete[](location) - not implemented\n")); 84 } 85 #endif 86 87 /*** 88 * debug! 89 ***/ 90 91 /** 92 * New. 93 * @returns pointer to allocated memory. 94 * @param Size Size requested. 95 */ 96 void *operator new(size_t size, const char *filename, size_t lineno) 97 { 98 return malloc(size); 83 99 } 84 100 101 102 /** 103 * stub 104 */ 105 void *operator new(size_t size, const char *filename, size_t lineno, void *location) 106 { 107 dprintf(("operator new(size,location) not implemented\n")); 108 return NULL; 109 } 110 111 112 /** 113 * stub 114 */ 115 void *operator new[](size_t size, const char *filename, size_t lineno) 116 { 117 dprintf(("operator new[](size) not implemented\n")); 118 return NULL; 119 } 120 121 122 /** 123 * stub 124 */ 125 void *operator new[](size_t size, const char *filename, size_t lineno, void *location) 126 { 127 dprintf(("operator new[](size,location) not implemented\n")); 128 return NULL; 129 } 130 131 #ifdef __DEBUG_ALLOC__ 132 /** 133 * Delete. 134 * @param location Pointer to memory block which are to be freed. 135 */ 136 void operator delete(void *location, const char *filename, size_t lineno) 137 { 138 free(location); 139 } 140 141 142 /** 143 * stub 144 */ 145 void operator delete[](void *location, const char *filename, size_t lineno) 146 { 147 dprintf(("operator delete[](location) - not implemented\n")); 148 } 149 #endif -
trunk/src/win32k/misc/stricmp.c
r847 r1271 1 /* $Id: stricmp.c,v 1. 1 1999-09-06 02:20:02bird Exp $1 /* $Id: stricmp.c,v 1.2 1999-10-14 01:19:21 bird Exp $ 2 2 * 3 3 * stricmp - Case insensitive string compare. … … 18 18 *******************************************************************************/ 19 19 #include <string.h> 20 20 #pragma info(nogen, noext, nouni) 21 21 22 22 /** 23 * strcmpi - case insensitive string compare. Not i subsys library. 23 * stricmp - case insensitive string compare. 24 * Not i subsys library. 24 25 * @param psz1 String 1 25 * @par mapsz2 String 226 * @param psz2 String 2 26 27 * @return 0 if equal 27 28 * != 0 if not equal … … 37 38 } 38 39 40 41 42 /** 43 * strnicmp - case insensitive string compare for up to cch chars of the strings. 44 * Not i subsys library. 45 * @param psz1 String 1 46 * @param psz2 String 2 47 * @return 0 if equal 48 * != 0 if not equal 49 */ 50 int strnicmp(const char *psz1, const char *psz2, size_t cch) 51 { 52 int iRet; 53 54 while (cch > 0 && (iRet = upcase(*psz1) - upcase(*psz2)) == 0 && *psz1 != '\0') 55 psz1++, psz2++, cch--; 56 57 return iRet; 58 } 59 -
trunk/src/win32k/misc/vsprintf.c
r847 r1271 1 /* $Id: vsprintf.c,v 1. 1 1999-09-06 02:20:02 bird Exp $1 /* $Id: vsprintf.c,v 1.2 1999-10-14 01:19:22 bird Exp $ 2 2 * 3 3 * vsprintf and sprintf … … 31 31 #include <stdarg.h> 32 32 33 #include "dev32.h" 33 #ifdef RING0 34 #include "dev32.h" 35 #else 36 #define SSToDS(a) (a) 37 #endif 34 38 #include "sprintf.h" 35 39 … … 128 132 } 129 133 else if (fFlags & (NTSF_PLUS | NTSF_BLANK)) 130 psz[i++] = fFlags & NTSF_PLUS ? '+' : ' ';134 psz[i++] = (char)(fFlags & NTSF_PLUS ? '+' : ' '); 131 135 } 132 136 … … 135 139 psz[i++] = '0'; 136 140 if (uiBase == 16) 137 psz[i++] = fFlags & NTSF_CAPITAL ? 'X' : 'x';141 psz[i++] = (char)(fFlags & NTSF_CAPITAL ? 'X' : 'x'); 138 142 } 139 143 … … 181 185 182 186 187 #pragma info(notrd) 183 188 /** 184 189 * Partial vsprintf implementation. … … 295 300 char *pszStr = va_arg(args, char*); 296 301 297 if (pszStr >(char*)0x10000)302 if (pszStr < (char*)0x10000) 298 303 pszStr = "<NULL>"; 299 304 cchStr = _strnlen(pszStr, (unsigned)cchPrecision);
Note:
See TracChangeset
for help on using the changeset viewer.