Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

  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. }