resizeablestringformatter.cpp
来自「跨操作系统的微型中间件」· C++ 代码 · 共 30 行
CPP
30 行
/* File: ResizeableStringFormatter.cpp Contains: Implements object defined in ResizeableStringFormatter.h */#include "ResizeableStringFormatter.h"void ResizeableStringFormatter::BufferIsFull(char* inBuffer, UInt32 inBufferLen){ //allocate a buffer twice as big as the old one, and copy over the contents UInt32 theNewBufferSize = this->GetTotalBufferSize() * 2; if (theNewBufferSize == 0) theNewBufferSize = 64; char* theNewBuffer = new char[theNewBufferSize]; ::memcpy(theNewBuffer, inBuffer, inBufferLen); //if the old buffer was dynamically allocated also, we'd better delete it. if (inBuffer != fOriginalBuffer) delete [] inBuffer; fStartPut = theNewBuffer; fCurrentPut = theNewBuffer + inBufferLen; fEndPut = theNewBuffer + theNewBufferSize;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?