diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
commit | d154673f93ad95197bce8cadb995daa5bc39f5d8 (patch) | |
tree | 191522aa88f9f845a9c27b1ddb86116b87033c4b /src/modules/icolib | |
parent | be50a70bfd8b3f3daf0c3351fdce6e2fea515bd7 (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@7820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/icolib')
-rw-r--r-- | src/modules/icolib/extracticon.cpp | 14 | ||||
-rw-r--r-- | src/modules/icolib/skin2icons.cpp | 44 | ||||
-rw-r--r-- | src/modules/icolib/skin2opts.cpp | 34 |
3 files changed, 46 insertions, 46 deletions
diff --git a/src/modules/icolib/extracticon.cpp b/src/modules/icolib/extracticon.cpp index 39113d2ef5..96973f0791 100644 --- a/src/modules/icolib/extracticon.cpp +++ b/src/modules/icolib/extracticon.cpp @@ -185,19 +185,19 @@ UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize if ((DWORD)(pDosHeader->e_lfanew) >= fileLen) goto cleanup;
pRes = _GetResourceTable(pDosHeader);
- if ( !pRes) goto cleanup;
- if ( !phicon) {
+ if (!pRes) goto cleanup;
+ if (!phicon) {
retval = _FindResourceCount(pRes, (int)RT_GROUP_ICON);
goto cleanup;
}
pIconDir = (NEWHEADER*)_FindResource(pDosHeader, pRes, iconIndex, (int)RT_GROUP_ICON, &cbSize);
- if ( !pIconDir) goto cleanup;
+ if (!pIconDir) goto cleanup;
if (pIconDir->Reserved || pIconDir->ResType != RES_ICON) goto cleanup;
idIcon = LookupIconIdFromDirectoryEx((LPBYTE)pIconDir, TRUE, cxIconSize, cyIconSize, flags);
pIcon = (LPBITMAPINFOHEADER)_FindResource(pDosHeader, pRes, -idIcon, (int)RT_ICON, &cbSize);
- if ( !pIcon) goto cleanup;
+ if (!pIcon) goto cleanup;
if (pIcon->biSize != sizeof(BITMAPINFOHEADER) && pIcon->biSize != sizeof(BITMAPCOREHEADER)) {
_ASSERT(0);
@@ -222,12 +222,12 @@ UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, H return 0;
// do we just want a count?
- if ( !phicon)
+ if (!phicon)
return 1;
flags |= LR_LOADFROMFILE;
hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
- if ( !hicon)
+ if (!hicon)
return 0;
*phicon = hicon;
@@ -255,7 +255,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC return 0;
// failed to read file signature
- if ( !ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) {
+ if (!ReadFile(hFile, &magic, sizeof(magic), &read, NULL) || (read != sizeof(magic))) {
CloseHandle(hFile);
return 0;
}
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index e5a21e7a56..139a369eb2 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -115,7 +115,7 @@ IconSourceFile* IconSourceFile_Get(const TCHAR* file, bool isPath) {
TCHAR fileFull[ MAX_PATH ];
- if ( !file)
+ if (!file)
return NULL;
if (isPath)
@@ -185,7 +185,7 @@ static int InitializeBitmapInfoHeader(HBITMAP bitmap, BITMAPINFOHEADER* bi) bi->biPlanes = 1;
if (bi->biClrImportant > bi->biClrUsed)
bi->biClrImportant = bi->biClrUsed;
- if ( !bi->biSizeImage)
+ if (!bi->biSizeImage)
bi->biSizeImage = BytesPerScanLine(bi->biWidth, bi->biBitCount, 32) * abs(bi->biHeight);
return 0; // Success
}
@@ -236,9 +236,9 @@ static int GetIconData(HICON icon, BYTE** data, int* size) int MonoInfoSize, ColorInfoSize;
int MonoBitsSize, ColorBitsSize;
- if ( !data || !size) return 1; // Failure
+ if (!data || !size) return 1; // Failure
- if ( !GetIconInfo(icon, &iconInfo)) return 1; // Failure
+ if (!GetIconInfo(icon, &iconInfo)) return 1; // Failure
if (InternalGetDIBSizes(iconInfo.hbmMask, &MonoInfoSize, &MonoBitsSize) ||
InternalGetDIBSizes(iconInfo.hbmColor, &ColorInfoSize, &ColorBitsSize)) {
@@ -311,8 +311,8 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item) {
if (item && item->icon_ref_count) {
item->icon_ref_count--;
- if ( !item->icon_ref_count) {
- if ( !item->icon_size)
+ if (!item->icon_ref_count) {
+ if (!item->icon_size)
if (GetIconData(item->icon, &item->icon_data, &item->icon_size))
item->icon_size = 0; // Failure
SafeDestroyIcon(&item->icon);
@@ -324,7 +324,7 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item) IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon)
{
- if ( !file)
+ if (!file)
return NULL;
IconSourceFile* r_file = IconSourceFile_Get(file, true);
@@ -349,7 +349,7 @@ IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int c IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyIcon)
{
- if ( !path)
+ if (!path)
return NULL;
TCHAR file[ MAX_PATH ];
@@ -357,7 +357,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI TCHAR *comma = _tcsrchr(file, ',');
int n;
- if ( !comma)
+ if (!comma)
n = 0;
else {
n = _ttoi(comma+1);
@@ -393,7 +393,7 @@ int IconSourceItem_Release(IconSourceItem** pitem) if (pitem && *pitem && (*pitem)->ref_count) {
IconSourceItem* item = *pitem;
item->ref_count--;
- if ( !item->ref_count) {
+ if (!item->ref_count) {
int indx;
if ((indx = iconSourceList.getIndex(item)) != -1) {
IconSourceFile_Release(&item->file);
@@ -414,7 +414,7 @@ int IconSourceItem_Release(IconSourceItem** pitem) static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new)
{
- if ( !sectionName)
+ if (!sectionName)
return NULL;
int indx;
@@ -436,7 +436,7 @@ static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new) static void IcoLib_RemoveSection(SectionItem* section)
{
- if ( !section)
+ if (!section)
return;
int indx;
@@ -480,14 +480,14 @@ IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big) static void IcoLib_FreeIcon(IcolibItem* icon)
{
- if ( !icon) return;
+ if (!icon) return;
SAFE_FREE((void**)&icon->name);
SAFE_FREE((void**)&icon->description);
SAFE_FREE((void**)&icon->default_file);
SAFE_FREE((void**)&icon->temp_file);
if (icon->section) {
- if ( !--icon->section->ref_count)
+ if (!--icon->section->ref_count)
IcoLib_RemoveSection(icon->section);
icon->section = NULL;
}
@@ -606,7 +606,7 @@ static INT_PTR IcoLib_RemoveIcon(WPARAM wParam, LPARAM lParam) void KillModuleIcons(int hLangpack)
{
- if ( !bModuleInitialized)
+ if (!bModuleInitialized)
return;
mir_cslock lck(csIconList);
@@ -634,7 +634,7 @@ HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big) hIcon = IconSourceItem_GetIcon(item->source_small);
}
- if ( !hIcon && item->default_file) {
+ if (!hIcon && item->default_file) {
int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON);
int cy = item->cy ? item->cy : GetSystemMetrics(big ? SM_CYICON : SM_CYSMICON);
IconSourceItem* def_icon = GetIconSourceItem(item->default_file, item->default_indx, cx, cy);
@@ -679,7 +679,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) big = big && !item->cx;
IconSourceItem* &source = big ? item->source_big : item->source_small;
- if ( !source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) {
+ if (!source && !db_get_ts(NULL, "SkinIcons", item->name, &dbv)) {
TCHAR tszFullPath[MAX_PATH];
PathToAbsoluteT(dbv.ptszVal, tszFullPath);
int cx = item->cx ? item->cx : GetSystemMetrics(big ? SM_CXICON : SM_CXSMICON);
@@ -691,10 +691,10 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) if (source)
hIcon = IconSourceItem_GetIcon(source);
- if ( !hIcon)
+ if (!hIcon)
hIcon = IconItem_GetDefaultIcon(item, big);
- if ( !hIcon)
+ if (!hIcon)
return hIconBlank;
return hIcon;
@@ -711,7 +711,7 @@ HICON IconItem_GetIcon(IcolibItem* item, bool big) HICON IcoLib_GetIcon(const char* pszIconName, bool big)
{
- if ( !pszIconName)
+ if (!pszIconName)
return hIconBlank;
mir_cslock lck(csIconList);
@@ -725,7 +725,7 @@ HICON IcoLib_GetIcon(const char* pszIconName, bool big) HANDLE IcoLib_GetIconHandle(const char* pszIconName)
{
- if ( !pszIconName)
+ if (!pszIconName)
return NULL;
mir_cslock lck(csIconList);
@@ -860,7 +860,7 @@ void UnloadIcoLibModule(void) {
int i;
- if ( !bModuleInitialized) return;
+ if (!bModuleInitialized) return;
DestroyHookableEvent(hIconsChangedEvent);
DestroyHookableEvent(hIcons2ChangedEvent);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index a761d7854c..e61a8783d8 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -46,12 +46,12 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) int n;
HICON hIcon;
- if ( !path)
+ if (!path)
return (HICON)NULL;
lstrcpyn(file, path, SIZEOF(file));
comma = _tcsrchr(file, ',');
- if ( !comma)
+ if (!comma)
n = 0;
else {
n = _ttoi(comma+1);
@@ -78,7 +78,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) if (szIconName)
item = IcoLib_FindIcon(szIconName);
- if ( !item && hIcon) // find by HICON
+ if (!item && hIcon) // find by HICON
item = IcoLib_FindHIcon(hIcon, big);
int res = 1;
@@ -103,7 +103,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) {
HICON hIcon = NULL;
- if ( !item->temp_reset) {
+ if (!item->temp_reset) {
HICON hRefIcon = IconItem_GetIcon(item, false);
hIcon = CopyIcon(hRefIcon);
if (item->source_small && item->source_small->icon == hRefIcon)
@@ -119,7 +119,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) }
}
- if ( !hIcon && item->default_file) {
+ if (!hIcon && item->default_file) {
IconSourceItem_Release(&item->default_icon);
item->default_icon = GetIconSourceItem(item->default_file, item->default_indx, item->cx, item->cy);
if (item->default_icon) {
@@ -132,7 +132,7 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item) }
}
- if ( !hIcon)
+ if (!hIcon)
return CopyIcon(hIconBlank);
}
return hIcon;
@@ -197,7 +197,7 @@ static void UndoChanges(int iconIndx, int cmd) {
IcolibItem *item = iconList[ iconIndx ];
- if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
+ if (!item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
else {
SAFE_FREE((void**)&item->temp_file);
@@ -286,7 +286,7 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
ofn.nMaxFile = MAX_PATH*2;
- if ( !GetOpenFileName(&ofn))
+ if (!GetOpenFileName(&ofn))
return NULL;
return mir_tstrdup(file);
@@ -343,7 +343,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR else
tvi.hItem = TreeView_GetRoot(hwndTree);
- if ( !name)
+ if (!name)
return tvi.hItem;
tvi.mask = TVIF_TEXT;
@@ -354,7 +354,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR {
TreeView_GetItem(hwndTree, &tvi);
- if ( !lstrcmp(tvi.pszText, name))
+ if (!lstrcmp(tvi.pszText, name))
return tvi.hItem;
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -470,7 +470,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
TCHAR str[MAX_PATH], *file;
GetDlgItemText(hwndDlg, IDC_ICONSET, str, SIZEOF(str));
- if ( !(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE)))
+ if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE)))
break;
SetDlgItemText(hwndDlg, IDC_ICONSET, file);
SAFE_FREE((void**)&file);
@@ -526,7 +526,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
}
- if ( !onItem && dropHiLite != -1) {
+ if (!onItem && dropHiLite != -1) {
ImageList_DragLeave(hwndDragOver);
ListView_SetItemState(hPPreview, dropHiLite, 0, LVIS_DROPHILITED);
UpdateWindow(hPPreview);
@@ -584,7 +584,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_SIZE: // make the dlg resizeable
- if ( !IsIconic(hwndDlg)) {
+ if (!IsIconic(hwndDlg)) {
UTILRESIZEDIALOG urd = {0};
urd.cbSize = sizeof(urd);
urd.hInstance = hInst;
@@ -697,7 +697,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR itemName[1024];
HTREEITEM hSection;
- if ( !hwndTree) break;
+ if (!hwndTree) break;
TreeView_SelectItem(hwndTree, NULL);
TreeView_DeleteAllItems(hwndTree);
@@ -722,8 +722,8 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM pItemName = TranslateTS(pItemName);
hItem = FindNamedTreeItemAt(hwndTree, hSection, pItemName);
- if ( !sectionName || !hItem) {
- if ( !hItem) {
+ if (!sectionName || !hItem) {
+ if (!hItem) {
TVINSERTSTRUCT tvis = {0};
TreeItem *treeItem = (TreeItem *)mir_alloc(sizeof(TreeItem));
treeItem->value = SECTIONPARAM_MAKE(indx, sectionLevel, sectionName ? 0 : SECTIONPARAM_HAVEPAGE);
@@ -822,7 +822,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
mir_cslock lck(csIconList);
hIcon = iconList[lvi.lParam]->temp_icon;
- if ( !hIcon)
+ if (!hIcon)
hIcon = IconItem_GetIcon_Preview(iconList[lvi.lParam]);
}
|