本文整理汇总了C++中SAFE_DELETE_ARRAY函数的典型用法代码示例。如果您正苦于以下问题:C++ SAFE_DELETE_ARRAY函数的具体用法?C++ SAFE_DELETE_ARRAY怎么用?C++ SAFE_DELETE_ARRAY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SAFE_DELETE_ARRAY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//.........这里部分代码省略.........
z.avail_in = comp_size;
if(total_buf_size + comp_size >= file_size)
{
flush = Z_FINISH;
}
in_fs.read((char *)comp_input_buf, comp_size);
total_buf_size += comp_size;
}
//圧縮
status = deflate(&z, flush);
//圧縮が完了したらループ脱出
if (status == Z_STREAM_END)
{
break;
}
//エラー時はループ脱出
if (status != Z_OK)
{
break;
}
//出力バッファが一杯になったら暗号化ファイルに書き出し
if (z.avail_out == 0)
{
//バッファサイズ算出
buf_size = CIPHER_BUF_SIZE;
total_comp_buf_size += buf_size;
buf_size = m_blow_fish.GetOutputLength(buf_size);
total_cipher_buf_size += buf_size;
//暗号化
m_blow_fish.Encode(input_buf, output_buf, buf_size);
//ファイルへ書き込み
cipher_file->write((char *)output_buf, buf_size);
//バッファメモリ、バッファサイズ設定
z.next_out = input_buf;
z.avail_out = PmCipher::CIPHER_BUF_SIZE;
}
}
//最後のバッファを出力
if ((buf_size = CIPHER_BUF_SIZE - z.avail_out) != 0)
{
//バッファサイズ算出
total_comp_buf_size += buf_size;
buf_size = m_blow_fish.GetOutputLength(buf_size);
total_cipher_buf_size += buf_size;
//暗号化
m_blow_fish.Encode(input_buf, output_buf, buf_size);
//ファイルへ書き込み
cipher_file->write((char *)output_buf, buf_size);
*cipher_file << std::flush;
}
//エラー時はサイズを0に
if (deflateEnd(&z) != Z_OK)
{
cr = CIPHER_ERR_FATAL;
total_buf_size = 0;
}
}
//無圧縮
else
{
//EOFまでループ
while(!in_fs.eof())
{
//バッファサイズ算出
buf_size = (total_buf_size + (unsigned long)PmCipher::CIPHER_BUF_SIZE > file_size)?(DWORD)(file_size - total_buf_size):PmCipher::CIPHER_BUF_SIZE;
//平文ファイルの読み込み
in_fs.read((char *)input_buf, buf_size);
buf_size = m_blow_fish.GetOutputLength((DWORD)buf_size);
//暗号化
m_blow_fish.Encode(input_buf, output_buf, buf_size);
//暗号化(出力)ファイルに書き出し
cipher_file->write((char *)output_buf, buf_size);
total_buf_size += buf_size;
//ファイルサイズ分読み込んだらループ脱出
if(file_size <= total_buf_size)
{
total_cipher_buf_size = total_buf_size;
break;
}
}
*cipher_file << std::flush;
}
//バッファメモリの解放
SAFE_DELETE_ARRAY(comp_input_buf);
SAFE_DELETE_ARRAY(input_buf);
SAFE_DELETE_ARRAY(output_buf);
//平文(入力)ファイルのクローズ
in_fs.close();
if(cr == CIPHER_OK)
{
//ファイルプロパティの生成、設定
*cipher_property = new PmCipherProperty();
(*cipher_property)->SetSourceSize(file_size);
(*cipher_property)->SetCompressSize(total_comp_buf_size);
(*cipher_property)->SetCipherSize(total_cipher_buf_size);
(*cipher_property)->SetPath(source_path);
}
return cr;
}
示例2: SongListProc
LRESULT CALLBACK SongListProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case IDM_SONGLIST_ADD_DIR:
{
DWORD size = 1024;
TCHAR* path = new TCHAR[size];
ZeroMemory(path, size);
BROWSEINFO bi;
bi.hwndOwner = songlist.hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = path;
bi.lpszTitle = L"ÇëÑ¡ÔñĿ¼";
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
LPITEMIDLIST lp = SHBrowseForFolder(&bi);
if (lp != NULL && SHGetPathFromIDList(lp, path))
PostThreadMessage(songlist.thread_id, ID_CMD_DIR, (WPARAM)path, 0);
else
SAFE_DELETE_ARRAY(path);
}
break;
case IDM_SONGLIST_ADD_FILE:
{
DWORD size = 1024;
TCHAR* filename = new TCHAR[size];
ZeroMemory(filename, size);
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = songlist.hWnd;
ofn.lpstrFile = filename;
ofn.nMaxFile = size;
ofn.lpstrFileTitle = L"Ñ¡Ôñ²¥·ÅÎļþ";
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) && wcslen(filename) > 0)
PostThreadMessage(songlist.thread_id, ID_CMD_FILE, (WPARAM)filename, 0);
else
SAFE_DELETE_ARRAY(filename);
}
break;
case IDM_SONGLIST_ADD_CD:
{
PostThreadMessage(songlist.thread_id, ID_CMD_CD, (WPARAM)lParam, 0);
}
break;
}
break;
case WM_DRAWITEM:
{
DrawItem((LPDRAWITEMSTRUCT)lParam);
}
break;
case WM_MEASUREITEM:
{
LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam;
lpMeasureItemStruct->itemHeight = 16;
}
break;
case WM_DROPFILES:
{
HDROP hDrop = (HDROP)wParam;
UINT n = DragQueryFile(hDrop, -1, NULL, 0);
if (n > 0)
{
DWORD size = 512;
wchar_t* filename = new wchar_t[size];
wmemset(filename, 0, size);
DragQueryFile(hDrop, 0, filename, size);
PostThreadMessage(songlist.thread_id, ID_CMD_FILE, (WPARAM)filename, 0);
}
DragFinish(hDrop);
}
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例3: SAFE_DELETE_ARRAY
PCMAudioFrame::~PCMAudioFrame()
{
SAFE_DELETE_ARRAY(data_);
}
示例4: _T
//.........这里部分代码省略.........
}
szCompiledFile += fileext;
#ifdef XBOX
szCompiledFile = SetPathDrive( szCompiledFile, EngineGetToolBox()->GetDrive() );
#endif
LPVOID pShaderFileData = NULL;
UINT shaderLen = 0;
struct _stat shaderFilestat;
// checking if compiled version exists, if we can load it into a buffer and if the file stats of the shader (not compiled) are readable
if (CheckFileExists(szCompiledFile) && ( _tstat( szFile, &shaderFilestat ) == 0) && LoadFileIntoBuffer( szCompiledFile, pShaderFileData, shaderLen, true ))
{
m_ToolBox->Log( LOGINFORMATION, _T("Reading compiled shader file: %s\n"), szCompiledFile.c_str() );
// create a shader buffer to store the compiled shader
hr = D3DXCreateBuffer( shaderLen, &shaderBuf );
if (SUCCEEDED(hr))
{
time_t storedMTime = 0;
// get the compiled date out of the file
memcpy( &storedMTime, pShaderFileData, sizeof(time_t) );
// if the stored modified time in the compiled shader file is the same as the current
// modified time of the shader file
if( storedMTime == shaderFilestat.st_mtime )
{
// reduce the buffer size by the preamble (mod time)
shaderLen -= (int)sizeof(time_t);
// copy the compiled shader into the shader buffer
memcpy( shaderBuf->GetBufferPointer(), ((TCHAR *) pShaderFileData)+ sizeof(time_t), shaderLen);
bLoadedCompiled = true;
}
}
SAFE_DELETE_ARRAY( pShaderFileData );
}
if (!bLoadedCompiled && bCompile)
{
if (pDefines)
EngineGetToolBox()->Log( LOGINFORMATION, _T("Compiling shader %s:%d\n"), GetName()->GetString(), pDefines->GetValuesEncoding().iEncoding );
else
EngineGetToolBox()->Log( LOGINFORMATION, _T("Compiling shader %s\n"), GetName()->GetString() );
hr = D3DXCompileShader( m_Code,
len,//length of string in bytes
pMacros, //can add that matrix of macros here
&includeInterface, //for include directories
"main",//? temp
profile, //vs_1_1 for example
0, //compiling options?
&shaderBuf,
&pErrorMsgs,
NULL );
}
//now actually create the shader
if( hr == D3D_OK &&
shaderBuf )
{
if (!bLoadedCompiled)
{
struct _stat shaderFilestat;
// get the shader file's modified time
if (_tstat( szFile, &shaderFilestat ) == 0)
{
m_ToolBox->Log( LOGINFORMATION, _T("Writing compiled shader file: %s\n"), szCompiledFile.c_str() );
示例5: SAFE_DELETE_ARRAY
VertexDeclImpl::~VertexDeclImpl()
{
//SAFE_RELEASE(m_pDecl);
SAFE_DELETE_ARRAY(m_pVertexElement);
m_pGraphics->UnregisterResource(this);
}
示例6: XBREAK
/**
@brief openGL 디바이스 텍스쳐를 생성하고 pSrc의 이미지를 로딩시킨다.
*/
GLuint XGraphicsOpenGL::CreateTextureGL( void* const pImgSrc
, int wSrc, int hSrc
, XE::xtPixelFormat formatImgSrc
, int wSrcAligned, int hSrcAligned
, XE::xtPixelFormat formatSurface ) const
{
// XBREAK( pImgSrc == nullptr );
const int bppImgSrc = XE::GetBpp( formatImgSrc );
const int bppSurface = XE::GetBpp( formatSurface );
const auto glFormatSurface = XGraphicsOpenGL::sToGLFormat( formatSurface );
const auto glTypeSurface = XGraphicsOpenGL::sToGLType( formatSurface );
XBREAK( pImgSrc && bppImgSrc == 2 ); // 아직 16bit픽셀소스는 지원하지 않음.
GLuint idTexture = 0;
glGenTextures( 1, &idTexture );
CHECK_GL_ERROR();
if( idTexture == 0 ) {
XERROR( "failed create texture: sizeSrc(%d,%d)", wSrc, hSrc );
return 0;
}
XGraphicsOpenGL::sBindTexture( idTexture );
CHECK_GL_ERROR();
const int sizeSrcAligned = wSrcAligned * hSrcAligned;
//////////////////////////////////////////////////////////////////////////
if( bppSurface == 4 ) {
DWORD *temp = nullptr;
if( pImgSrc ) {
// gl텍스쳐로 쓰기 위해 정렬된 사이즈의 메모리에 이미지를 복사
DWORD* _temp = temp = new DWORD[sizeSrcAligned];
memset( _temp, 0, sizeSrcAligned * bppSurface );
int i, j;
DWORD *src = (DWORD* const)pImgSrc;
for( i = 0; i < hSrc; i++ ) {
for( j = 0; j < wSrc; j++ ) {
*_temp++ = *src++;
}
_temp += (wSrcAligned - wSrc);
}
}
glTexImage2D( GL_TEXTURE_2D,
0,
GL_RGBA,
wSrcAligned,
hSrcAligned,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
temp );
s_glFmt = GL_RGBA;
s_glType = GL_UNSIGNED_BYTE;
#ifdef _DEBUG
auto glErr = glGetError();
XASSERT( glErr == GL_NO_ERROR );
#endif // _DEBUG
SAFE_DELETE_ARRAY( temp );
} else
//////////////////////////////////////////////////////////////////////////
if( bppSurface == 2 ) {
WORD *pDst = nullptr;
// gl텍스쳐로 쓰기 위해 정렬된 사이즈의 메모리에 이미지를 복사
if( pImgSrc ) {
WORD *_pDst = pDst = new WORD[ sizeSrcAligned ];
memset( _pDst, 0, sizeSrcAligned * bppSurface );
if( formatSurface == XE::xPF_RGB565
|| formatSurface == XE::xPF_RGB555 ) {
XE::ConvertBlockABGR8888ToRGB565( pDst, wSrcAligned, hSrcAligned, (DWORD*)pImgSrc, wSrc, hSrc );
} else
if( formatSurface == XE::xPF_ARGB4444 ) {
// 현재 WIN32 opengl에서는 RGBA4444로 넘겨야 제대로 나오지만 기기 opengl에서는 어떤게 맞는지 알수없음. 아마도 같지 않을까 함.
XE::ConvertBlockABGR8888ToRGBA4444( pDst, wSrcAligned, hSrcAligned, (DWORD*)pImgSrc, wSrc, hSrc );
} else
if( formatSurface == XE::xPF_ARGB1555 ) {
XE::ConvertBlockABGR8888ToRGBA1555( pDst, wSrcAligned, hSrcAligned, (DWORD*)pImgSrc, wSrc, hSrc );
} else {
XBREAK(1);
}
}
const auto glFormatImgSrc = glFormatSurface;
const auto glTypeSrc = glTypeSurface;
glTexImage2D( GL_TEXTURE_2D,
0,
glFormatSurface, // internal format
wSrcAligned,
hSrcAligned,
0,
glFormatImgSrc, // pImgSrc의 포맷이지만 위에거랑 맞춰야 해서 같은걸 씀.
glTypeSrc,
pDst );
s_glFmt = glFormatSurface;
s_glType = glTypeSrc;
CHECK_GL_ERROR();
SAFE_DELETE_ARRAY( pDst );
}
// XGraphicsOpenGL::sBindTexture( 0 );
CHECK_GL_ERROR();
//.........这里部分代码省略.........
示例7: glGenTextures
/**
@brief 이미지의 일부분을 gl텍스쳐로 만든다.
*/
GLuint XGraphicsOpenGL::CreateTextureSubGL( void* const pImgSrc
, const XE::POINT& sizeSrc // pImgSrc의 크기
, const XE::xRECTi& rectSrc // pImgSrc에서 잘라낼 영역
, XE::xtPixelFormat formatImgSrc
, XE::xtPixelFormat formatSurface )
{
const XE::POINT sizeTex = rectSrc.GetSize();
const XE::POINT sizeTexAligned = XGraphics::sAlignPowSize( sizeTex );
const int bppSurface = XE::GetBpp( formatSurface );
GLuint glTexture = 0;
glGenTextures( 1, &glTexture );
CHECK_GL_ERROR();
if( XBREAK( glTexture == 0 ) )
return 0;
if( pImgSrc ) {
XGraphicsOpenGL::sBindTexture( glTexture );
CHECK_GL_ERROR();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
CHECK_GL_ERROR();
const auto glTypeTexel = XGraphicsOpenGL::sToGLType( formatSurface );
const auto glformatTexel = XGraphicsOpenGL::sToGLFormat( formatSurface );
// 영역만큼 이미지 잘라내어 pDst에 옮김.
DWORD *pSrc = (DWORD*)pImgSrc;
DWORD *pBuffClipped = new DWORD[ sizeTexAligned.Size() ];
DWORD *_pDst = pBuffClipped;
pSrc += (rectSrc.GetTop() * sizeSrc.w + rectSrc.GetLeft());
memset( pBuffClipped, 0, sizeTexAligned.Size() * bppSurface );
for( int i = 0; i < sizeTexAligned.h; ++i ) {
for( int j = 0; j < sizeTexAligned.w; ++j )
*_pDst++ = *pSrc++;
pSrc += ( sizeSrc.w - sizeTex.w );
_pDst += ( sizeTexAligned.w - sizeTex.w );
}
if( bppSurface == 4 ) {
glTexImage2D( GL_TEXTURE_2D,
0,
glformatTexel,
sizeTexAligned.w,
sizeTexAligned.h,
0,
glformatTexel,
glTypeTexel,
pBuffClipped );
CHECK_GL_ERROR();
} else // if( bppSurface == 4 ) {
if( bppSurface == 2 ) {
WORD *pDst16 = new WORD[ sizeTexAligned.Size() ];
memset( pDst16, 0, sizeTexAligned.Size() * bppSurface );
if( formatSurface == XE::xPF_RGB565 ) {
XE::ConvertBlockABGR8888ToRGB565( pDst16, sizeTexAligned, pBuffClipped, sizeTexAligned );
} else
if( formatSurface == XE::xPF_ARGB4444 ) {
XE::ConvertBlockABGR8888ToRGBA4444( pDst16, sizeTexAligned, pBuffClipped, sizeTexAligned );
}
glTexImage2D( GL_TEXTURE_2D,
0,
glformatTexel,
sizeTexAligned.w,
sizeTexAligned.h,
0,
glformatTexel,
glTypeTexel,
pDst16 );
CHECK_GL_ERROR();
SAFE_DELETE_ARRAY( pDst16 );
} // if( bppSurface == 2 ) {
// XSurface::sAddSizeTotalVMem( sizeTexAligned.Size() * bppSurface );
SAFE_DELETE_ARRAY( pBuffClipped );
} // if( pImgSrc ) {
return glTexture;
} // CreateTextureSubGL()
示例8: SAFE_DELETE_ARRAY
void CSXFile::Cleanup()
{
SAFE_DELETE_ARRAY(m_Filename);
Close();
}
示例9: if
//.........这里部分代码省略.........
break;
case SET_DS_CBUFFERS1:
context->Serialise_DSSetConstantBuffers1(0, 0, 0x0, 0x0, 0x0);
break;
case SET_GS_CBUFFERS1:
context->Serialise_GSSetConstantBuffers1(0, 0, 0x0, 0x0, 0x0);
break;
case SET_PS_CBUFFERS1:
context->Serialise_PSSetConstantBuffers1(0, 0, 0x0, 0x0, 0x0);
break;
case SET_CS_CBUFFERS1:
context->Serialise_CSSetConstantBuffers1(0, 0, 0x0, 0x0, 0x0);
break;
#else
case COPY_SUBRESOURCE_REGION1:
case UPDATE_SUBRESOURCE1:
case CLEAR_VIEW:
case SET_VS_CBUFFERS1:
case SET_HS_CBUFFERS1:
case SET_DS_CBUFFERS1:
case SET_GS_CBUFFERS1:
case SET_PS_CBUFFERS1:
case SET_CS_CBUFFERS1:
RDCERR("Replaying log with D3D11.1 events on a build without D3D11.1 support");
break;
#endif
case BEGIN_EVENT:
context->Serialise_BeginEvent(0, L"");
break;
case SET_MARKER:
context->Serialise_SetMarker(0, L"");
break;
case END_EVENT:
context->Serialise_EndEvent();
break;
case CONTEXT_CAPTURE_FOOTER:
{
bool HasCallstack = false;
m_pSerialiser->Serialise("HasCallstack", HasCallstack);
if(HasCallstack)
{
size_t numLevels = 0;
uint64_t *stack = NULL;
m_pSerialiser->Serialise("callstack", stack, numLevels);
m_pSerialiser->SetCallstack(stack, numLevels);
SAFE_DELETE_ARRAY(stack);
}
if(m_State == READING)
{
AddEvent(CONTEXT_CAPTURE_FOOTER, "IDXGISwapChain::Present()");
FetchDrawcall draw;
draw.name = L"Present()";
draw.flags |= eDraw_Present;
AddDrawcall(draw, true);
}
}
break;
default:
RDCERR("Unrecognised Chunk type %d", chunk);
break;
}
m_pSerialiser->PopContext(NULL, chunk);
if(context->m_State == READING && chunk == SET_MARKER)
{
// no push/pop necessary
}
else if(context->m_State == READING && chunk == BEGIN_EVENT)
{
// push down the drawcallstack to the latest drawcall
context->m_DrawcallStack.push_back(&context->m_DrawcallStack.back()->children.back());
}
else if(context->m_State == READING && chunk == END_EVENT)
{
// refuse to pop off further than the root drawcall (mismatched begin/end events e.g.)
RDCASSERT(context->m_DrawcallStack.size() > 1);
if(context->m_DrawcallStack.size() > 1)
context->m_DrawcallStack.pop_back();
}
else if(context->m_State == READING)
{
if(!m_AddedDrawcall)
context->AddEvent(chunk, m_pSerialiser->GetDebugStr());
}
m_AddedDrawcall = false;
if(forceExecute)
context->m_State = state;
}
示例10: SERIALISE_ELEMENT
//.........这里部分代码省略.........
// same accounting for the outer loop as above
m_RootEventID--;
if(numCmds == 0)
{
// do nothing, don't bother with the logic below
}
else if(m_LastEventID <= startEID)
{
RDCDEBUG("Queue Submit no replay %u == %u", m_LastEventID, startEID);
}
else if(m_DrawcallCallback && m_DrawcallCallback->RecordAllCmds())
{
RDCDEBUG("Queue Submit re-recording from %u", m_RootEventID);
vector<VkCommandBuffer> rerecordedCmds;
for(uint32_t c=0; c < numCmds; c++)
{
VkCommandBuffer cmd = RerecordCmdBuf(cmdIds[c]);
ResourceId rerecord = GetResID(cmd);
RDCDEBUG("Queue Submit fully re-recorded replay of %llu, using %llu", cmdIds[c], rerecord);
rerecordedCmds.push_back(Unwrap(cmd));
GetResourceManager()->ApplyBarriers(m_BakedCmdBufferInfo[rerecord].imgbarriers, m_ImageLayouts);
}
submitInfo.commandBufferCount = (uint32_t)rerecordedCmds.size();
submitInfo.pCommandBuffers = &rerecordedCmds[0];
ObjDisp(queue)->QueueSubmit(Unwrap(queue), 1, &submitInfo, Unwrap(fence));
}
else if(m_LastEventID > startEID && m_LastEventID < m_RootEventID)
{
RDCDEBUG("Queue Submit partial replay %u < %u", m_LastEventID, m_RootEventID);
uint32_t eid = startEID;
vector<ResourceId> trimmedCmdIds;
vector<VkCommandBuffer> trimmedCmds;
for(uint32_t c=0; c < numCmds; c++)
{
// account for the virtual vkBeginCommandBuffer label at the start of the events here
// so it matches up to baseEvent
eid++;
uint32_t end = eid + m_BakedCmdBufferInfo[cmdIds[c]].eventCount;
if(eid == m_PartialReplayData.baseEvent)
{
ResourceId partial = GetResID(RerecordCmdBuf(cmdIds[c]));
RDCDEBUG("Queue Submit partial replay of %llu at %u, using %llu", cmdIds[c], eid, partial);
trimmedCmdIds.push_back(partial);
trimmedCmds.push_back(Unwrap(RerecordCmdBuf(cmdIds[c])));
}
else if(m_LastEventID >= end)
{
RDCDEBUG("Queue Submit full replay %llu", cmdIds[c]);
trimmedCmdIds.push_back(cmdIds[c]);
trimmedCmds.push_back(Unwrap(GetResourceManager()->GetLiveHandle<VkCommandBuffer>(cmdIds[c])));
}
else
{
RDCDEBUG("Queue not submitting %llu", cmdIds[c]);
}
// 1 extra to account for the virtual end command buffer label (begin is accounted for above)
eid += 1+m_BakedCmdBufferInfo[cmdIds[c]].eventCount;
}
RDCASSERT(trimmedCmds.size() > 0);
submitInfo.commandBufferCount = (uint32_t)trimmedCmds.size();
submitInfo.pCommandBuffers = &trimmedCmds[0];
ObjDisp(queue)->QueueSubmit(Unwrap(queue), 1, &submitInfo, Unwrap(fence));
for(uint32_t i=0; i < trimmedCmdIds.size(); i++)
{
ResourceId cmd = trimmedCmdIds[i];
GetResourceManager()->ApplyBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts);
}
}
else
{
RDCDEBUG("Queue Submit full replay %u >= %u", m_LastEventID, m_RootEventID);
ObjDisp(queue)->QueueSubmit(Unwrap(queue), 1, &submitInfo, Unwrap(fence));
for(uint32_t i=0; i < numCmds; i++)
{
ResourceId cmd = GetResourceManager()->GetLiveID(cmdIds[i]);
GetResourceManager()->ApplyBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts);
}
}
}
SAFE_DELETE_ARRAY(cmds);
return true;
}
示例11: AddLogText
//.........这里部分代码省略.........
strcat(sql, "'");
strcat(sql, szTimeValue);
strcat(sql, "',");
}
break;
case DATA_OBJECT_STRING:
{
//rs->PutCollect((*epItr).c_str(), );
strcat(sql, "'");
const char* pStr = ep->GetStringAttr(0);
if(pStr)
strcat(sql, pStr);
else
strcat(sql, "");
strcat(sql, "',");
}
break;
case DATA_OBJECT_BUFFER:
{
//SaveBufferField((*goodsItr), (*epItr).c_str(), rs);
}
break;
case DATA_OBJECT_GUID:
{
CGUID tGUID;
ep->GetGuidAttr(0, tGUID);
char szGuid[128];
tGUID.tostring(szGuid);
//rs->PutCollect((*epItr).c_str(), szGuid);
strcat(sql, "'");
strcat(sql, szGuid);
strcat(sql, "',");
}
break;
case DATA_OBJECT_BOOL:
case DATA_OBJECT_CHAR:
case DATA_OBJECT_BYTE:
{
//rs->PutCollect((*epItr).c_str(), (BYTE)ep->GetLongAttr(0));
char value[32];
memset(value, 0, sizeof(value));
itoa((BYTE)ep->GetLongAttr(0), value, 10);
strcat(sql, value);
strcat(sql, ",");
}
break;
case DATA_OBJECT_SHORT:
case DATA_OBJECT_WORD:
case DATA_OBJECT_USHORT:
{
//rs->PutCollect((*epItr).c_str(), (WORD)ep->GetLongAttr(0));
char value[32];
memset(value, 0, sizeof(value));
itoa((WORD)ep->GetLongAttr(0), value, 10);
strcat(sql, value);
strcat(sql, ",");
}
break;
case DATA_OBJECT_FLOAT:
case DATA_OBJECT_LONG:
case DATA_OBJECT_ULONG:
case DATA_OBJECT_DWORD:
{
//rs->PutCollect((*epItr).c_str(), (DWORD)ep->GetLongAttr(0));
char value[32];
memset(value, 0, sizeof(value));
itoa((DWORD)ep->GetLongAttr(0), value, 10);
strcat(sql, value);
strcat(sql, ",");
}
break;
}
}
}
}
}
}
sqlLen = strlen(sql);
sql[sqlLen-1] = '\0';
strcat(sql, " union all select ");
}
sqlLen = strlen(sql);
sql[sqlLen-17] = '\0';
TESTHR(ExecuteCn(sql, cn));
SAFE_DELETE_ARRAY(sql);
return true;
}
catch (_com_error &e)
{
SAFE_DELETE_ARRAY(sql);
ReleaseRs(rs);
PrintErr(CStringReading::LoadString(IDS_DBS_RSDUPRGN,STR_DBS_DUPRGN_SAVERGNGOODSFAIL), e);
return false;
}
SAFE_DELETE_ARRAY(sql);
return false;
}
示例12: SAFE_DELETE_ARRAY
AnimationValue::~AnimationValue()
{
SAFE_DELETE_ARRAY(_value);
}
示例13: SAFE_DELETE_ARRAY
AppStatus::~AppStatus(void)
{
pC=0;
SAFE_DELETE_ARRAY(pItems);
}
示例14: SAFE_DELETE
//.........这里部分代码省略.........
m_current_compress_size = AlphaToLong(str_size, 10);
//プロパティ一覧ファイルの暗号化サイズ読み込み
m_fs_decrypt.read(str_size, 10);
m_cipher_index_size = AlphaToLong(str_size, 10);
m_current_cipher_size = m_cipher_index_size;
m_fs_decrypt.read(str_size, 10);
//平文受け取りバッファ
char *buf;
//サイズ等
unsigned int size, buf_size, j;
PmCipherProperty *cipher_property;
m_total_buf_size = 0ul;
m_total_decomp_buf_size = 0ul;
m_decrypt_init = true;
//ZLIBストリーム初期化
if(m_compress)
{
m_z.zalloc = Z_NULL;
m_z.zfree = Z_NULL;
m_z.opaque = Z_NULL;
if (inflateInit(&m_z) != Z_OK)
{
DecryptEnd();
return CIPHER_ERR_INVALID_FILE;
}
m_z.avail_in = 0;
m_z.avail_out = (unsigned int)(min(CIPHER_BUF_SIZE, m_current_source_size - m_total_buf_size));
m_z.next_out = m_output_buf;
}
CIPHER_RESULT dec_cr;
buf_size = 0;
str_index = new char[m_current_source_size];
//暗号化プロパティ一覧の復号完了までループ
do
{
dec_cr = Decrypt(&buf, &size);
memcpy(str_index + buf_size, buf, size);
buf_size += size;
}
while(dec_cr == CIPHER_DEC_NEXT);
char str_path[MAX_PATH];
//プロパティ一覧の生成
m_property_list = new PmCipherPropertyList();
buf_size = 0;
//ルートパスの取得
j = 0;
ZeroMemory(str_path, MAX_PATH);
for(j = 0; buf_size + j < m_current_source_size && j < MAX_PATH; j++)
{
if(str_index[buf_size + j] == '\n')
{
memcpy(str_path, str_index + buf_size, j);
m_root_path = string(str_path);
buf_size += j + 1;
break;
}
}
//プロパティ一覧文字列の解析
while(dec_cr == CIPHER_DEC_FINISH && buf_size < m_current_source_size)
{
cipher_property = new PmCipherProperty();
//ファイル位置の取得
cipher_property->SetOffset(AlphaToLong(str_index + buf_size, 10));
buf_size += 10;
//元ファイルサイズの取得
cipher_property->SetSourceSize(AlphaToLong(str_index + buf_size, 10));
buf_size += 10;
//圧縮ファイルサイズの取得
cipher_property->SetCompressSize(AlphaToLong(str_index + buf_size, 10));
buf_size += 10;
//暗号化ファイルサイズの取得
cipher_property->SetCipherSize(AlphaToLong(str_index + buf_size, 10));
buf_size += 10;
//ファイルパスの取得
j = 0;
ZeroMemory(str_path, MAX_PATH);
for(j = 0; buf_size + j < m_current_source_size && j < MAX_PATH; j++)
{
if(str_index[buf_size + j] == '\n')
{
memcpy(str_path, str_index + buf_size, j);
cipher_property->SetPath(string(str_path));
buf_size += j + 1;
break;
}
}
//プロパティをプロパティ一覧に追加
m_property_list->AddProperty(cipher_property);
}
//バッファメモリの解放
SAFE_DELETE_ARRAY(str_index);
DecryptEnd();
}
//ファイルが見つからないまたは、ディレクトリの場合エラー終了
else
{
cr = CIPHER_ERR_FILE_NOT_FOUND;
}
return cr;
}
示例15: SAFE_DELETE_ARRAY
// using the supplied font, build up a quad for each character in the string
// and assemble the quads into a vertex buffer ready for drawing/memcpy
//--------------------------------------------------------------------------------
void CPUTText::Recalculate()
{
SAFE_DELETE_ARRAY(mpMirrorBuffer);
mNumCharsInString = (int) mStaticText.size();
mpMirrorBuffer = new CPUTGUIVertex[(mNumCharsInString+1)*6];
bool Enabled = false;
if(CPUT_CONTROL_ACTIVE == mControlState)
{
Enabled = true;
}
// walk each character and build a quad from it
float characterPosition=0;
for(int ii=0; ii<mNumCharsInString; ii++)
{
// todo: unsafe cast from wchar_t to char! Some other way???
char character = (char) mStaticText[ii];
float3 UV1, UV2;
CPUT_SIZE size = mpFont->GetGlyphSize(character);
mpFont->GetGlyphUVS(character, Enabled, UV1, UV2);
if('\t'!=character)
{
AddQuadIntoMirrorBuffer(mpMirrorBuffer, ii*6, (float)mPosition.x+characterPosition, (float)mPosition.y, (float)size.width, (float)size.height, UV1, UV2);
}
else
{
// calculate tab width = # pixels to get to next tabstop
// Tabs are relative from BEGINNNING of the string, not absolute based on x-position of string. So in order for columns to line
// up, you need the starts of the strings to line up too.
// If you want 'absolute' x alignment behavior, use this:
//size.width = size.width - ((mPosition.x+characterPosition) % size.width);
// simply skip the amount of space indicated in the font's tab slot
int CurrentPositionForNextGlyph = (int) characterPosition;
size.width = size.width - (CurrentPositionForNextGlyph % size.width);
AddQuadIntoMirrorBuffer(mpMirrorBuffer, ii*6, (float)mPosition.x+characterPosition, (float)mPosition.y, (float)size.width, (float)size.height, UV1, UV2);
}
// store the max height of the string
mQuadSize.height = max(mQuadSize.height, size.height);
// step to next X location for next character
characterPosition+=size.width;
}
// store the total width of the string
mQuadSize.width = (int)characterPosition; // width of string in pixels
// tell gui system this control image is now dirty
// and needs to rebuild it's draw list
CPUTGuiControllerDX11::GetController()->ControlIsDirty();
// position or size may move - force a recalculation of this control's location
// if it is managed by the auto-arrange function
if(this->IsAutoArranged())
{
CPUTGuiControllerDX11::GetController()->Resize();
}
}