summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-17 12:04:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-17 12:04:21 +0000
commitfe4e211fe45a0b04190d06dbf34fa13883df871a (patch)
tree04ac31b85c5107e35af6903492e3f0db08119e28 /plugins/Clist_modern
parent93bbcf1646e427be610273ae977a349705dcf39c (diff)
more memory fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@4072 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp84
1 files changed, 24 insertions, 60 deletions
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index a3efe5439b..5c6e7df153 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -67,8 +67,6 @@ static SortedList * pEffectStack = NULL;
static SKINOBJECTSLIST * pCurrentSkin = NULL;
static char ** pszSettingName = NULL;
static int nArrayLen = 0;
-static char * iniCurrentSection = NULL;
-static char * szFileName = NULL;
static BYTE pbGammaWeight[256] = {0};
static BYTE pbGammaWeightAdv[256] = {0};
@@ -194,48 +192,22 @@ HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, co
// if ( strlen(szValue)>0 && szValue[strlen(szValue)-1] == '\n' )
// szValue[strlen(szValue)-1] = '\0'; //kill linefeed at the end
- switch(szValue[0])
- {
+ switch(szValue[0]) {
case 'b':
- {
- BYTE P;
- P = (BYTE)atoi(szValue+1);
- db_set_b(NULL,szSection,szName,P);
- }
+ db_set_b(NULL, szSection, szName, (BYTE)atoi(szValue+1));
break;
+
case 'w':
- {
- WORD P;
- P = (WORD)atoi(szValue+1);
- db_set_w(NULL,szSection,szName,P);
- }
+ db_set_w(NULL, szSection, szName, (WORD)atoi(szValue+1));
break;
+
case 'd':
- {
- DWORD P;
- P = (DWORD)atoi(szValue+1);
- db_set_dw(NULL,szSection,szName,P);
- }
+ db_set_dw(NULL, szSection, szName, (DWORD)atoi(szValue+1));
break;
+
case 's':
db_set_s(NULL,szSection,szName,szValue+1);
break;
- case 'f':
- if (szFileName)
- {
- char fn[MAX_PATH] = {0};
- char bb[MAX_PATH*2] = {0};
- int pp, i;
- pp = -1;
- PathToRelative(szFileName, fn);
- {
- for (i = strlen(fn); i >= 0; i--) if (fn[i] == '.') break;
- if (i>0) fn[i] = '\0';
- }
- _snprintf(bb,SIZEOF(bb),"%s\\%s",fn,szValue+1);
- db_set_s(NULL,szSection,szName,bb);
- }
- break;
}
return S_OK;
}
@@ -1933,7 +1905,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename)
//this function is required to load PNG to dib buffer myself
-HBITMAP ske_LoadGlyphImage_Png2Dib(char * szFilename)
+static HBITMAP ske_LoadGlyphImage_Png2Dib(const TCHAR *tszFilename)
{
HANDLE hFile, hMap = NULL;
BYTE* ppMap = NULL;
@@ -1946,12 +1918,12 @@ HBITMAP ske_LoadGlyphImage_Png2Dib(char * szFilename)
return (HBITMAP)NULL;
}
- if (( hFile = CreateFileA( szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )) != INVALID_HANDLE_VALUE )
- if (( hMap = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL )) != NULL )
- if (( ppMap = ( BYTE* )MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL )
- cbFileSize = GetFileSize( hFile, NULL );
+ if ((hFile = CreateFile(tszFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
+ if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL )) != NULL)
+ if ((ppMap = ( BYTE* )MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL)
+ cbFileSize = GetFileSize(hFile, NULL);
- if ( cbFileSize != 0 ) {
+ if (cbFileSize != 0) {
PNG2DIB param;
param.pSource = ppMap;
param.cbSourceSize = cbFileSize;
@@ -2000,9 +1972,8 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName)
BITMAP bmpInfo;
{
- int l;
- l = lstrlen(tszFileName);
- memmove(ext,szFileName +(l-4),5);
+ int l = lstrlen(tszFileName);
+ lstrcpyn(ext, tszFileName+(l-4),5);
}
if ( !_tcschr(tszFileName,'%') && !PathFileExists(tszFileName))
return NULL;
@@ -2012,33 +1983,27 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName)
f = 1;
}
else if ( ServiceExists("Image/Png2Dib") && mir_bool_tstrcmpi(ext, _T(".png"))) {
- hBitmap = ske_LoadGlyphImage_Png2Dib(szFileName);
+ hBitmap = ske_LoadGlyphImage_Png2Dib(tszFileName);
GetObject(hBitmap, sizeof(BITMAP), &bmpInfo);
f = (bmpInfo.bmBits != NULL);
- // hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFileName);
- // f = 1;
-
}
- else if (hImageDecoderModule == NULL || !mir_bool_tstrcmpi(ext, _T(".png")))
- hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFileName);
- else
- {
+ else if (hImageDecoderModule == NULL || !mir_bool_tstrcmpi(ext, _T(".png"))) {
+ hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)tszFileName);
+ }
+ else {
f = 1;
ImgNewDecoder(&m_pImgDecoder);
- if ( !ImgNewDIBFromFile(m_pImgDecoder, szFileName, &pImg))
- {
+ if ( !ImgNewDIBFromFile(m_pImgDecoder, _T2A(tszFileName), &pImg)) {
ImgGetHandle(pImg, &hBitmap, (LPVOID *)&pBitmapBits);
ImgDeleteDecoder(m_pImgDecoder);
}
}
- if (hBitmap)
- {
-
+
+ if (hBitmap) {
GetObject(hBitmap, sizeof(BITMAP), &bmpInfo);
if (bmpInfo.bmBitsPixel == 32)
ske_PreMultiplyChanells(hBitmap,f);
- else
- {
+ else {
HDC dc24,dc32;
HBITMAP hBitmap32,obmp24,obmp32;
dc32 = CreateCompatibleDC(NULL);
@@ -2055,7 +2020,6 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName)
hBitmap = hBitmap32;
ske_PreMultiplyChanells(hBitmap,0);
}
-
}
return hBitmap;
}