bufbase.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 1k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. /*****************************************************************/
  2. /**   Microsoft Windows for Workgroups **/
  3. /**       Copyright (C) Microsoft Corp., 1991-1992 **/
  4. /*****************************************************************/ 
  5. /* BUFBASE.CPP -- Implementation of BUFFER_BASE class.
  6.  *
  7.  * History:
  8.  * 03/24/93 gregj Created base class
  9.  *
  10.  */
  11. #include "npcommon.h"
  12. #include "buffer.h"
  13. // The following code would be nice in OOP fashion, but since the
  14. // derived class's virtuals aren't available until after the derived
  15. // class's constructor is done, this Alloc() call will not go anywhere.
  16. // Therefore each derived class must stick the if statement in its
  17. // constructor.
  18. #if 0
  19. BUFFER_BASE::BUFFER_BASE( UINT cbInitial /* =0 */ )
  20.   : _cb( 0 ) // buffer not allocated yet
  21. {
  22. if (cbInitial)
  23. Resize( cbInitial );
  24. }
  25. #endif
  26. BOOL BUFFER_BASE::Resize( UINT cbNew )
  27. {
  28. BOOL fSuccess;
  29. if (QuerySize() == 0)
  30. fSuccess = Alloc( cbNew );
  31. else {
  32. fSuccess = Realloc( cbNew );
  33. }
  34. if (fSuccess)
  35. _cb = cbNew;
  36. return fSuccess;
  37. }