summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-09-29 17:38:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-09-29 17:38:21 +0000
commitb4dda82ea61973078e7fe6678af7aaa72ea0d30b (patch)
tree3cff106e7ad9ec849c257bff58e221eda159d994
parentfb530563908192710e111786f636da2ebccb7924 (diff)
runtime allocation functions replaced with mir_*
function strdupn() removed git-svn-id: http://svn.miranda-ng.org/main/trunk@15475 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp31
-rw-r--r--plugins/Clist_modern/src/modern_skinbutton.cpp3
-rw-r--r--plugins/Clist_modern/src/modern_skinengine.cpp66
-rw-r--r--plugins/Clist_modern/src/modern_skinselector.cpp44
-rw-r--r--plugins/Clist_modern/src/modern_utils.cpp27
-rw-r--r--plugins/Clist_modern/src/stdafx.h3
6 files changed, 58 insertions, 116 deletions
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index 5ccdafd151..742c5b939c 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -108,7 +108,7 @@ CLCPaint::CLCPaint()
_FillQuickHash();
};
-void CLCPaint::cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint)
+void CLCPaint::cliPaintClc(HWND hwnd, ClcData *dat, HDC hdc, RECT *rcPaint)
{
if (MirandaExiting()) return;
g_CluiData.mutexPaintLock++;
@@ -194,7 +194,7 @@ int CLCPaint::GetBasicFontID(ClcContact *contact)
}
}
-void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height)
+void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height)
{
if (szText == NULL || !szText[0]) {
text_size->cy = 0;
@@ -245,7 +245,7 @@ void CLCPaint::GetTextSize(SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR
}
}
-void CLCPaint::AddParam(MODERNMASK *mpModernMask, DWORD dwParamHash, const char* const szValue, DWORD dwValueHash)
+void CLCPaint::AddParam(MODERNMASK *mpModernMask, DWORD dwParamHash, const char* const szValue, DWORD dwValueHash)
{
static MASKPARAM param = { 0 }; //AddParameter will clear it so it can be static to avoid initializations
_FillParam(&param, dwParamHash, szValue, dwValueHash);
@@ -268,14 +268,14 @@ tPaintCallbackProc CLCPaint::PaintCallbackProc(HWND hWnd, HDC hDC, RECT *rcPaint
return NULL;
}
-void CLCPaint::_FillQuickHash()
+void CLCPaint::_FillQuickHash()
{
int i;
for (i = 0; i < hi_LastItem; i++)
HASH[i] = mod_CalcHash(HASHTEXT[i]);
}
-void CLCPaint::_SetHotTrackColour(HDC hdc, ClcData *dat)
+void CLCPaint::_SetHotTrackColour(HDC hdc, ClcData *dat)
{
if (dat->gammaCorrection) {
COLORREF oldCol, newCol;
@@ -414,7 +414,7 @@ RECT CLCPaint::_GetRectangle(ClcData *dat, RECT *row_rc, RECT *free_row_rc, int
-void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley)
+void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, TCHAR *szText, int start, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley)
{
if (szText == NULL)return;
uTextFormat &= ~DT_RIGHT;
@@ -511,15 +511,15 @@ void CLCPaint::_DrawTextSmiley(HDC hdcMem, RECT *free_rc, SIZE * text_size, TCH
}
-void CLCPaint::_AddParameter(MODERNMASK *mpModernMask, MASKPARAM * lpParam)
+void CLCPaint::_AddParameter(MODERNMASK *mpModernMask, MASKPARAM * lpParam)
{
- mpModernMask->pl_Params = (MASKPARAM *)realloc(mpModernMask->pl_Params, (mpModernMask->dwParamCnt + 1)*sizeof(MASKPARAM));
+ mpModernMask->pl_Params = (MASKPARAM *)mir_realloc(mpModernMask->pl_Params, (mpModernMask->dwParamCnt + 1)*sizeof(MASKPARAM));
memmove(&(mpModernMask->pl_Params[mpModernMask->dwParamCnt]), lpParam, sizeof(MASKPARAM));
mpModernMask->dwParamCnt++;
memset(lpParam, 0, sizeof(MASKPARAM));
}
-void CLCPaint::_FillParam(MASKPARAM * lpParam, DWORD dwParamHash, const char* const szValue, DWORD dwValueHash)
+void CLCPaint::_FillParam(MASKPARAM *lpParam, DWORD dwParamHash, const char* const szValue, DWORD dwValueHash)
{
lpParam->bMaskParamFlag = MPF_EQUAL | MPF_HASHED;
lpParam->dwId = dwParamHash;
@@ -530,17 +530,17 @@ void CLCPaint::_FillParam(MASKPARAM * lpParam, DWORD dwParamHash, const char* c
lpParam->dwValueHash = dwValueHash;
if (szValue)
- lpParam->szValue = strdupn(szValue, (int)mir_strlen(szValue));
+ lpParam->szValue = mir_strndup(szValue, (int)mir_strlen(szValue));
else
lpParam->szValue = NULL;
}
-void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex)
+void CLCPaint::_AddParamShort(MODERNMASK *mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex)
{
AddParam(mpModernMask, HASH[dwParamIndex], HASHTEXT[dwValueIndex], HASH[dwValueIndex]);
}
-MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
+MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContact *Drawing, int indent, int index, BOOL selected, BOOL hottrack, ClcData *dat)
{
if (Drawing == NULL)
return 0;
@@ -595,8 +595,9 @@ MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac
}
_AddParamShort(mpModernMask, hi_HasAvatar, (dat->avatars_show && Drawing->avatar_data != NULL) ? hi_True : hi_False);
_AddParamShort(mpModernMask, hi_Rate, hi_None + Drawing->bContactRate);
- break;
}
+ break;
+
case CLCIT_DIVIDER:
_AddParamShort(mpModernMask, hi_Type, hi_Divider);
break;
@@ -1820,8 +1821,8 @@ void CLCPaint::_DrawLines(HWND hWnd, ClcData *dat, int paintMode, RECT* rcPaint,
_PaintRowItems(hWnd, pc.hdcMem, dat, Drawing, row_rc, free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint);
if (mpRequest) {
if (!dat->force_in_dialog) {
- free(mpRequest->pl_Params[1].szValue);
- mpRequest->pl_Params[1].szValue = strdupn("Ovl", 3);
+ mir_free(mpRequest->pl_Params[1].szValue);
+ mpRequest->pl_Params[1].szValue = mir_strndup("Ovl", 3);
mpRequest->pl_Params[1].dwValueHash = mod_CalcHash("Ovl");
{
RECT mrc = row_rc;
diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp
index ad1facd9bc..6c979c87f0 100644
--- a/plugins/Clist_modern/src/modern_skinbutton.cpp
+++ b/plugins/Clist_modern/src/modern_skinbutton.cpp
@@ -622,10 +622,9 @@ static HWND ModernSkinButtonCreateWindow(ModernSkinButtonCtrl * bct, HWND parent
int ModernSkinButtonRedrawAll()
{
- DWORD i;
if (!ModernSkinButtonModuleIsLoaded) return 0;
g_mutex_bLockUpdating++;
- for (i = 0; i < ButtonsCount; i++) {
+ for (DWORD i = 0; i < ButtonsCount; i++) {
if (pcli->hwndContactList && Buttons[i].hwnd == NULL)
Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, pcli->hwndContactList);
ModernSkinButtonPaintWorker(Buttons[i].hwnd, 0);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp
index 13fd8e2bcd..159022c6f1 100644
--- a/plugins/Clist_modern/src/modern_skinengine.cpp
+++ b/plugins/Clist_modern/src/modern_skinengine.cpp
@@ -585,7 +585,7 @@ BOOL ske_SetRectOpaque(HDC memdc, RECT *fr, BOOL force)
if (!bmp.bmBits) {
f = 1;
- bits = (BYTE*)malloc(bmp.bmWidthBytes*bmp.bmHeight);
+ bits = (BYTE*)mir_alloc(bmp.bmWidthBytes*bmp.bmHeight);
GetBitmapBits(hbmp, bmp.bmWidthBytes*bmp.bmHeight, bits);
}
else
@@ -609,7 +609,7 @@ BOOL ske_SetRectOpaque(HDC memdc, RECT *fr, BOOL force)
}
if (f) {
SetBitmapBits(hbmp, bmp.bmWidthBytes*bmp.bmHeight, bits);
- free(bits);
+ mir_free(bits);
}
// DeleteObject(hbmp);
return 1;
@@ -937,7 +937,7 @@ HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque)
return NULL;
unsigned int cRect = 64;
- PRGNDATA pRgnData = (PRGNDATA)malloc(sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ PRGNDATA pRgnData = (PRGNDATA)mir_alloc(sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
memset(pRgnData, 0, sizeof(RGNDATAHEADER));
pRgnData->rdh.dwSize = sizeof(RGNDATAHEADER);
pRgnData->rdh.iType = RDH_RECTANGLES;
@@ -959,7 +959,7 @@ HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque)
else {
if (pRgnData->rdh.nCount == cRect) {
cRect = cRect + 64;
- pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ pRgnData = (PRGNDATA)mir_realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
}
SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, g_pCachedWindow->Height - y, x, g_pCachedWindow->Height - y + 1);
@@ -972,7 +972,7 @@ HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque)
if (lastin) {
if (pRgnData->rdh.nCount == cRect) {
cRect = cRect + 64;
- pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
+ pRgnData = (PRGNDATA)mir_realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
}
SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, g_pCachedWindow->Height - y, g_pCachedWindow->Width, g_pCachedWindow->Height - y + 1);
@@ -981,7 +981,7 @@ HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque)
}
HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
- free(pRgnData);
+ mir_free(pRgnData);
return hRgn;
}
@@ -1445,7 +1445,7 @@ void ske_PreMultiplyChannels(HBITMAP hbmp, BYTE Mult)
Len = bh*bw * 4;
flag = (bmp.bmBits == NULL);
if (flag) {
- pBitmapBits = (LPBYTE)malloc(Len);
+ pBitmapBits = (LPBYTE)mir_alloc(Len);
GetBitmapBits(hbmp, Len, pBitmapBits);
}
else
@@ -1467,7 +1467,7 @@ void ske_PreMultiplyChannels(HBITMAP hbmp, BYTE Mult)
}
if (flag) {
Len = SetBitmapBits(hbmp, Len, pBitmapBits);
- free(pBitmapBits);
+ mir_free(pBitmapBits);
}
return;
}
@@ -1584,7 +1584,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename)
}
/*memory allocation */
- colormap = (BYTE*)malloc(header.width*header.height * 4);
+ colormap = (BYTE*)mir_alloc(header.width*header.height * 4);
cx = header.width;
cy = header.height;
fseek(fp, header.id_lenght, SEEK_CUR);
@@ -1603,7 +1603,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename)
if (size > sizeof(header)) {
tga_header_t *tgahdr = (tga_header_t*)mem;
if (tgahdr->pixel_depth == 32 && (tgahdr->image_type == 2 || tgahdr->image_type == 10)) {
- colormap = (BYTE*)malloc(tgahdr->width*tgahdr->height * 4);
+ colormap = (BYTE*)mir_alloc(tgahdr->width*tgahdr->height * 4);
cx = tgahdr->width;
cy = tgahdr->height;
ske_ReadTGAImageData((void*)(mem + sizeof(tga_header_t) + tgahdr->id_lenght + tgahdr->cm_length), size - (sizeof(tga_header_t) + tgahdr->id_lenght + tgahdr->cm_length), colormap, cx*cy * 4, tgahdr->image_type == 10);
@@ -1617,7 +1617,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename)
HBITMAP hbmp = ske_CreateDIB32Point(cx, cy, (void**)&pt);
if (hbmp)
memcpy(pt, colormap, cx*cy * 4);
- free(colormap);
+ mir_free(colormap);
return hbmp;
}
return NULL;
@@ -2096,7 +2096,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
if (effect->EffectID == 0xFF) return false;
if (!width || !height) return false;
if (!destPt) return false;
- buf = (sbyte*)malloc(width*height*sizeof(BYTE));
+ buf = (sbyte*)mir_alloc(width*height*sizeof(BYTE));
{
matrix = effect->EffectMatrix.matrix;
mcTopStart = 2 - effect->EffectMatrix.topEffect;
@@ -2138,7 +2138,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
maxX = min((int)width, maxX + mcRightEnd - 1);
maxY = min((int)height, maxY + mcBottomEnd - 1);
- outbuf = (sbyte*)malloc(width*height*sizeof(sbyte));
+ outbuf = (sbyte*)mir_alloc(width*height*sizeof(sbyte));
memset(outbuf, 0, width*height*sizeof(sbyte));
for (y = (DWORD)minY; y < (DWORD)maxY; y++) {
int val;
@@ -2168,7 +2168,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
buflineMid++;
}
}
- free(buf);
+ mir_free(buf);
buf = outbuf;
}
{
@@ -2201,7 +2201,7 @@ static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD he
destline += 4;
}
}
- free(buf);
+ mir_free(buf);
}
return false;
}
@@ -2244,7 +2244,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
bool destHasNotDIB = (bmpDest.bmBits == NULL);
BYTE *pDestBits;
if (destHasNotDIB) {
- pDestBits = (BYTE*)malloc(bmpDest.bmHeight * bmpDest.bmWidthBytes);
+ pDestBits = (BYTE*)mir_alloc(bmpDest.bmHeight * bmpDest.bmWidthBytes);
GetBitmapBits(hDestBitmap, bmpDest.bmHeight*bmpDest.bmWidthBytes, pDestBits);
}
else
@@ -2289,7 +2289,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
// replace end of string by elipsis
bNeedFreeWorkString = TRUE;
- lpWorkString = (TCHAR*)malloc((visibleCharCount + 4) * sizeof(TCHAR));
+ lpWorkString = (TCHAR*)mir_alloc((visibleCharCount + 4) * sizeof(TCHAR));
memcpy((void*)lpWorkString, lpString, visibleCharCount * sizeof(TCHAR));
memcpy((void*)(lpWorkString + visibleCharCount), _T("..."), 4 * sizeof(TCHAR)); // 3 + 1
@@ -2430,10 +2430,10 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect,
DeleteDC(hOffscreenDC);
if (destHasNotDIB)
- free(pDestBits);
+ mir_free(pDestBits);
if (bNeedFreeWorkString)
- free((void*)lpWorkString);
+ mir_free((void*)lpWorkString);
return 0;
}
@@ -2503,7 +2503,7 @@ HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i)
if (bm.bmBitsPixel == 32) {
BYTE *bits = (BYTE*)bm.bmBits;
if (!bits) {
- bits = (BYTE*)malloc(bm.bmWidthBytes*bm.bmHeight);
+ bits = (BYTE*)mir_alloc(bm.bmWidthBytes*bm.bmHeight);
GetBitmapBits(imi.hbmImage, bm.bmWidthBytes*bm.bmHeight, bits);
}
@@ -2535,7 +2535,7 @@ HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i)
if (!bm.bmBits) {
SetBitmapBits(imi.hbmImage, bm.bmWidthBytes*bm.bmHeight, bits);
- free(bits);
+ mir_free(bits);
}
}
}
@@ -2625,13 +2625,13 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
bool NoDIBImage = (imbt.bmBits == NULL);
if (NoDIBImage) {
- imimagbits = (BYTE*)malloc(cy*imbt.bmWidthBytes);
+ imimagbits = (BYTE*)mir_alloc(cy*imbt.bmWidthBytes);
GetBitmapBits(ici.hbmColor, cy*imbt.bmWidthBytes, (void*)imimagbits);
}
else imimagbits = (BYTE*)imbt.bmBits;
if (immaskbt.bmBits == NULL) {
- immaskbits = (BYTE*)malloc(cy*immaskbt.bmWidthBytes);
+ immaskbits = (BYTE*)mir_alloc(cy*immaskbt.bmWidthBytes);
GetBitmapBits(ici.hbmMask, cy*immaskbt.bmWidthBytes, (void*)immaskbits);
}
else immaskbits = (BYTE*)immaskbt.bmBits;
@@ -2705,8 +2705,8 @@ BOOL ske_DrawIconEx(HDC hdcDst, int xLeft, int yTop, HICON hIcon, int cxWidth, i
BLENDFUNCTION bf = { AC_SRC_OVER, diFlags & 128, alpha, AC_SRC_ALPHA };
ske_AlphaBlend(hdcDst, xLeft, yTop, cxWidth, cyWidth, imDC, 0, 0, cx, icy, bf);
- if (immaskbt.bmBits == NULL) free(immaskbits);
- if (imbt.bmBits == NULL) free(imimagbits);
+ if (immaskbt.bmBits == NULL) mir_free(immaskbits);
+ if (imbt.bmBits == NULL) mir_free(imimagbits);
SelectObject(imDC, oldBmp);
DeleteObject(imBmp);
if (no32bit)DeleteObject(tBmp);
@@ -3597,7 +3597,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
alpha = alpha ? alpha : 255;
if (bmp_bottom.bmBits) bb = BottomBuffer = (BYTE*)bmp_bottom.bmBits;
else {
- BottomBuffer = (BYTE*)malloc(bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes);
+ BottomBuffer = (BYTE*)mir_alloc(bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes);
GetBitmapBits(iciBottom.hbmColor, bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes, BottomBuffer);
bb = BottomBuffer + vstep_b*(bmp_bottom.bmHeight - 1);
vstep_b = -vstep_b;
@@ -3605,7 +3605,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
if (bmp_top.bmBits) tb = TopBuffer = (BYTE*)bmp_top.bmBits;
else {
- TopBuffer = (BYTE*)malloc(bmp_top.bmHeight*bmp_top.bmWidthBytes);
+ TopBuffer = (BYTE*)mir_alloc(bmp_top.bmHeight*bmp_top.bmWidthBytes);
GetBitmapBits(iciTop.hbmColor, bmp_top.bmHeight*bmp_top.bmWidthBytes, TopBuffer);
tb = TopBuffer + vstep_t*(bmp_top.bmHeight - 1);
vstep_t = -vstep_t;
@@ -3616,7 +3616,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
bmb = BottomMaskBuffer;
}
else {
- BottomMaskBuffer = (BYTE*)malloc(bmp_bottom_mask.bmHeight*bmp_bottom_mask.bmWidthBytes);
+ BottomMaskBuffer = (BYTE*)mir_alloc(bmp_bottom_mask.bmHeight*bmp_bottom_mask.bmWidthBytes);
GetBitmapBits(iciBottom.hbmMask, bmp_bottom_mask.bmHeight*bmp_bottom_mask.bmWidthBytes, BottomMaskBuffer);
bmb = BottomMaskBuffer + vstep_bm*(bmp_bottom_mask.bmHeight - 1);
vstep_bm = -vstep_bm;
@@ -3628,7 +3628,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
tmb = TopMaskBuffer;
}
else {
- TopMaskBuffer = (BYTE*)malloc(bmp_top_mask.bmHeight*bmp_top_mask.bmWidthBytes);
+ TopMaskBuffer = (BYTE*)mir_alloc(bmp_top_mask.bmHeight*bmp_top_mask.bmWidthBytes);
GetBitmapBits(iciTop.hbmMask, bmp_top_mask.bmHeight*bmp_top_mask.bmWidthBytes, TopMaskBuffer);
tmb = TopMaskBuffer + vstep_tm*(bmp_top_mask.bmHeight - 1);
vstep_tm = -vstep_tm;
@@ -3661,10 +3661,10 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha)
db += vstep_d;
}
- if (!bmp_bottom.bmBits) free(BottomBuffer);
- if (!bmp_top.bmBits) free(TopBuffer);
- if (!bmp_bottom_mask.bmBits) free(BottomMaskBuffer);
- if (!bmp_top_mask.bmBits) free(TopMaskBuffer);
+ if (!bmp_bottom.bmBits) mir_free(BottomBuffer);
+ if (!bmp_top.bmBits) mir_free(TopBuffer);
+ if (!bmp_bottom_mask.bmBits) mir_free(BottomMaskBuffer);
+ if (!bmp_top_mask.bmBits) mir_free(TopMaskBuffer);
}
else {
ske_DrawIconEx(tempDC, 0, 0, hBottom, 16, 16, 0, NULL, DI_NORMAL);
diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp
index 9eb678bc24..a6dd454f4e 100644
--- a/plugins/Clist_modern/src/modern_skinselector.cpp
+++ b/plugins/Clist_modern/src/modern_skinselector.cpp
@@ -38,51 +38,23 @@ int SkinSelector_DeleteMask(MODERNMASK *mm)
{
if (!mm->pl_Params) return 0;
for (int i = 0; i < (int)mm->dwParamCnt; i++) {
- free(mm->pl_Params[i].szName);
- free(mm->pl_Params[i].szValue);
+ mir_free(mm->pl_Params[i].szName);
+ mir_free(mm->pl_Params[i].szValue);
}
- free(mm->pl_Params);
+ mir_free(mm->pl_Params);
return 1;
}
-#if __GNUC__
-#define NOINLINEASM
-#endif
-
DWORD mod_CalcHash(const char *szStr)
{
-#if defined _M_IX86 && !defined _NUMEGA_BC_FINALCHECK && !defined NOINLINEASM
- __asm { //this breaks if szStr is empty
- xor edx, edx
- xor eax, eax
- mov esi, szStr
- mov al, [esi]
- xor cl, cl
- lph_top : //only 4 of 9 instructions in here don't use AL, so optimal pipe use is impossible
- xor edx, eax
- inc esi
- xor eax, eax
- and cl, 31
- mov al, [esi]
- add cl, 5
- test al, al
- rol eax, cl //rol is u-pipe only, but pairable
- //rol doesn't touch z-flag
- jnz lph_top //5 clock tick loop. not bad.
-
- xor eax, edx
- }
-#else
DWORD hash = 0;
- int i;
int shift = 0;
- for (i = 0; szStr[i]; i++) {
+ for (int i = 0; szStr[i]; i++) {
hash ^= szStr[i] << shift;
if (shift > 24) hash ^= (szStr[i] >> (32 - shift)) & 0x7F;
shift = (shift + 5) & 0x1F;
}
return hash;
-#endif
}
int AddModernMaskToList(MODERNMASK *mm, LISTMODERNMASK * mmTemplateList)
@@ -283,22 +255,22 @@ int ParseToModernMask(MODERNMASK *mm, char *szText)
// Get param name
if (pszParam && paramlen) {
- param.szName = strdupn(pszParam, paramlen);
+ param.szName = mir_strndup(pszParam, paramlen);
param.dwId = mod_CalcHash(param.szName);
}
else { // ParamName = 'Module'
- param.szName = _strdup("Module");
+ param.szName = mir_strdup("Module");
param.dwId = mod_CalcHash(param.szName);
}
- param.szValue = strdupn(pszValue, valuelen);
+ param.szValue = mir_strndup(pszValue, valuelen);
if (!(except & EXCEPTION_WILD)) {
param.dwValueHash = mod_CalcHash(param.szValue);
param.bMaskParamFlag |= MPF_HASHED;
}
if (curParam >= mm->dwParamCnt) {
- mm->pl_Params = (MASKPARAM*)realloc(mm->pl_Params, (mm->dwParamCnt + 1)*sizeof(MASKPARAM));
+ mm->pl_Params = (MASKPARAM*)mir_realloc(mm->pl_Params, (mm->dwParamCnt + 1)*sizeof(MASKPARAM));
mm->dwParamCnt++;
}
mm->pl_Params[curParam] = param;
diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp
index 196398b68f..03152cbf9a 100644
--- a/plugins/Clist_modern/src/modern_utils.cpp
+++ b/plugins/Clist_modern/src/modern_utils.cpp
@@ -23,22 +23,6 @@ char * __cdecl strstri(char *a, const char *b)
return NULL;
}
-//copy len symbols from string - do not check is it null terminated or len is more then actual
-char * strdupn(const char * src, int len)
-{
- char * p;
- if (src == NULL) return NULL;
- p = (char*)malloc(len + 1);
- if (!p) return 0;
- memcpy(p, src, len);
- p[len] = '\0';
- return p;
-}
-
-#ifdef _DEBUG
-#undef DeleteObject
-#endif
-
void TRACE_ERROR()
{
DWORD t = GetLastError();
@@ -64,17 +48,6 @@ void TRACE_ERROR()
LocalFree(lpMsgBuf);
}
-BOOL DebugDeleteObject(HGDIOBJ a)
-{
- BOOL res = DeleteObject(a);
- if (!res) TRACE_ERROR();
- return res;
-}
-
-#ifdef _DEBUG
-#define DeleteObject(a) DebugDeleteObject(a)
-#endif
-
// load small icon (not shared) it IS NEED to be destroyed
HICON LoadSmallIcon(HINSTANCE hInstance, int index)
{
diff --git a/plugins/Clist_modern/src/stdafx.h b/plugins/Clist_modern/src/stdafx.h
index d7ec890625..745f4884b0 100644
--- a/plugins/Clist_modern/src/stdafx.h
+++ b/plugins/Clist_modern/src/stdafx.h
@@ -175,7 +175,6 @@ void MakeButtonSkinned(HWND hWnd);
#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);}
extern void TRACE_ERROR();
-extern BOOL DebugDeleteObject(HGDIOBJ a);
extern void IvalidateDisplayNameCache(DWORD mode);
extern LIST<ClcCacheEntry> clistCache;
@@ -202,8 +201,6 @@ enum
#define MirandaLoading() ((g_CluiData.bSTATE<STATE_NORMAL))
#define MirandaExiting() ((g_CluiData.bSTATE>STATE_NORMAL))
-char * strdupn(const char * src, int len);
-
#define SORTBY_NAME 0
#define SORTBY_STATUS 1
#define SORTBY_LASTMSG 2