From 82ae452fff08430d514f762f49e78fec90f88625 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Mar 2013 15:06:11 +0000 Subject: - rest of memory leaks - code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@4078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CryptoPP/src/main.cpp | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'plugins/CryptoPP/src') diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index 7869c8d416..dacdfda235 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -89,34 +89,34 @@ extern "C" __declspec(dllexport) int Unload() BOOL ExtractFileFromResource( HANDLE FH, int ResType, int ResId, DWORD* Size ) { - HRSRC RH; - PBYTE RP; - DWORD s,x; - - RH = FindResource( g_hInst, MAKEINTRESOURCE( ResId ), MAKEINTRESOURCE( ResType ) ); - - if ( RH == NULL ) return FALSE; - RP = (PBYTE) LoadResource( g_hInst, RH ); - if ( RP == NULL ) return FALSE; - s = SizeofResource( g_hInst, RH ); - if ( !WriteFile( FH, RP, s, &x, NULL ) ) return FALSE; - if ( x != s ) return FALSE; - if ( Size ) *Size = s; - return TRUE; + HRSRC RH = FindResource(g_hInst, MAKEINTRESOURCE(ResId), MAKEINTRESOURCE(ResType)); + if ( RH == NULL ) + return FALSE; + + PBYTE RP = (PBYTE) LoadResource( g_hInst, RH ); + if ( RP == NULL ) + return FALSE; + + DWORD x, s = SizeofResource(g_hInst, RH); + if ( !WriteFile(FH, RP, s, &x, NULL)) return FALSE; + if (x != s) return FALSE; + if (Size) *Size = s; + return TRUE; } - -void ExtractFile( char *FileName, int ResType, int ResId ) +void ExtractFile(char *FileName, int ResType, int ResId) { - HANDLE FH; - FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); - if ( FH == INVALID_HANDLE_VALUE ) return; - if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) MessageBoxA(0,"Can't extract","!!!",MB_OK); + HANDLE FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); + if (FH == INVALID_HANDLE_VALUE) + return; + + if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) + MessageBoxA(0,"Can't extract","!!!",MB_OK); CloseHandle( FH ); } - -size_t rtrim(LPCSTR str) { +size_t rtrim(LPCSTR str) +{ size_t len = strlen(str); LPSTR ptr = (LPSTR)str+len-1; -- cgit v1.2.3