windows-nt/Source/XPSP1/NT/shell/ext/ratings/common/bufbase.cpp

43 lines
1 KiB
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
/*****************************************************************/
/** Microsoft Windows for Workgroups **/
/** Copyright (C) Microsoft Corp., 1991-1992 **/
/*****************************************************************/
/* BUFBASE.CPP -- Implementation of BUFFER_BASE class.
*
* History:
* 03/24/93 gregj Created base class
*
*/
#include "npcommon.h"
#include "buffer.h"
// The following code would be nice in OOP fashion, but since the
// derived class's virtuals aren't available until after the derived
// class's constructor is done, this Alloc() call will not go anywhere.
// Therefore each derived class must stick the if statement in its
// constructor.
#if 0
BUFFER_BASE::BUFFER_BASE( UINT cbInitial /* =0 */ )
: _cb( 0 ) // buffer not allocated yet
{
if (cbInitial)
Resize( cbInitial );
}
#endif
BOOL BUFFER_BASE::Resize( UINT cbNew )
{
BOOL fSuccess;
if (QuerySize() == 0)
fSuccess = Alloc( cbNew );
else {
fSuccess = Realloc( cbNew );
}
if (fSuccess)
_cb = cbNew;
return fSuccess;
}