diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
commit | 3f23417a1099f73dc28ec1b7d6ec2a1a7fc2b7a2 (patch) | |
tree | 3e0bcd88c55dad310da0dc980e252bf9fbfa6dc5 /src/modules/utils | |
parent | 537b94169bf2483798a651ee3b96f7904eebe7b4 (diff) |
- PLUGININFO structure removed at all;
- Options_AddPage & UserInfo_AddPage replaced MS_OPT_ADDPAGE & MS_USERINFO_ADDPAGE services respectively
- total internal redesign of options' translation
- code reformatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils')
-rw-r--r-- | src/modules/utils/bmpfilter.cpp | 62 | ||||
-rw-r--r-- | src/modules/utils/hyperlink.cpp | 18 | ||||
-rw-r--r-- | src/modules/utils/imgconv.cpp | 12 | ||||
-rw-r--r-- | src/modules/utils/md5.cpp | 6 | ||||
-rw-r--r-- | src/modules/utils/openurl.cpp | 16 | ||||
-rw-r--r-- | src/modules/utils/path.cpp | 184 | ||||
-rw-r--r-- | src/modules/utils/resizer.cpp | 2 | ||||
-rw-r--r-- | src/modules/utils/sha1.cpp | 4 | ||||
-rw-r--r-- | src/modules/utils/timezones.cpp | 20 | ||||
-rw-r--r-- | src/modules/utils/utf.cpp | 16 | ||||
-rw-r--r-- | src/modules/utils/utils.cpp | 18 | ||||
-rw-r--r-- | src/modules/utils/windowlist.cpp | 2 |
12 files changed, 180 insertions, 180 deletions
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 8cedc1ba87..2e656dbf63 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_png.h"
#include "m_imgsrvc.h"
-static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName )
+static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName)
{
IPicture *pic;
HBITMAP hBmp, hBmpCopy;
@@ -36,63 +36,63 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) short picType;
TCHAR szFilename[MAX_PATH];
- if ( !pathToAbsoluteT(ptszFileName, szFilename, NULL ))
+ if ( !pathToAbsoluteT(ptszFileName, szFilename, NULL))
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName);
int filenameLen = lstrlen(szFilename);
- if ( filenameLen > 4 ) {
+ if (filenameLen > 4) {
TCHAR* pszExt = szFilename + filenameLen - 4;
- if ( ServiceExists( MS_IMG_LOAD ))
- return CallService( MS_IMG_LOAD, (WPARAM)szFilename, IMGL_TCHAR );
+ if (ServiceExists(MS_IMG_LOAD))
+ return CallService(MS_IMG_LOAD, (WPARAM)szFilename, IMGL_TCHAR);
- if ( !lstrcmpi( pszExt, _T(".bmp")) || !lstrcmpi( pszExt, _T(".rle"))) {
+ if ( !lstrcmpi(pszExt, _T(".bmp")) || !lstrcmpi(pszExt, _T(".rle"))) {
//LoadImage can do this much faster
- return (INT_PTR)LoadImage( hMirandaInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
+ return (INT_PTR)LoadImage(hMirandaInst, szFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
- if ( !lstrcmpi( pszExt, _T(".png"))) {
+ if ( !lstrcmpi(pszExt, _T(".png"))) {
HANDLE hFile, hMap = NULL;
BYTE* ppMap = NULL;
INT_PTR cbFileSize = 0;
BITMAPINFOHEADER* pDib;
BYTE* pDibBits;
- if ( !ServiceExists( MS_PNG2DIB )) {
- MessageBox( NULL, TranslateT( "You need an image services plugin to process PNG images." ), TranslateT( "Error" ), MB_OK );
+ if ( !ServiceExists(MS_PNG2DIB)) {
+ MessageBox(NULL, TranslateT("You need an image services plugin to process PNG images."), TranslateT("Error"), MB_OK);
return 0;
}
- if (( hFile = CreateFile( 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(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 ( cbFileSize != 0 ) {
+ if (cbFileSize != 0) {
PNG2DIB param;
param.pSource = ppMap;
param.cbSourceSize = cbFileSize;
param.pResult = &pDib;
- if ( CallService( MS_PNG2DIB, 0, ( LPARAM )¶m )) {
- pDibBits = ( BYTE* )( pDib+1 );
- HDC sDC = GetDC( NULL );
- HBITMAP hBitmap = CreateDIBitmap( sDC, pDib, CBM_INIT, pDibBits, ( BITMAPINFO* )pDib, DIB_PAL_COLORS );
- SelectObject( sDC, hBitmap );
- ReleaseDC( NULL, sDC );
- GlobalFree( pDib );
+ if (CallService(MS_PNG2DIB, 0, (LPARAM)¶m)) {
+ pDibBits = (BYTE*)(pDib+1);
+ HDC sDC = GetDC(NULL);
+ HBITMAP hBitmap = CreateDIBitmap(sDC, pDib, CBM_INIT, pDibBits, (BITMAPINFO*)pDib, DIB_PAL_COLORS);
+ SelectObject(sDC, hBitmap);
+ ReleaseDC(NULL, sDC);
+ GlobalFree(pDib);
cbFileSize = (INT_PTR)hBitmap;
}
else cbFileSize = 0;
}
- if ( ppMap != NULL ) UnmapViewOfFile( ppMap );
- if ( hMap != NULL ) CloseHandle( hMap );
- if ( hFile != NULL ) CloseHandle( hFile );
+ if (ppMap != NULL) UnmapViewOfFile(ppMap);
+ if (hMap != NULL) CloseHandle(hMap);
+ if (hFile != NULL) CloseHandle(hFile);
return (INT_PTR)cbFileSize;
} }
- if (S_OK != OleLoadPicturePath( LPOLESTR(( const wchar_t* )StrConvU(szFilename)), NULL, 0, 0, IID_IPicture, (PVOID*)&pic ))
+ if (S_OK != OleLoadPicturePath(LPOLESTR((const wchar_t*)StrConvU(szFilename)), NULL, 0, 0, IID_IPicture, (PVOID*)&pic))
return 0;
pic->get_Type(&picType);
@@ -109,9 +109,9 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) hdc=GetDC(NULL);
hdcMem1=CreateCompatibleDC(hdc);
hdcMem2=CreateCompatibleDC(hdc);
- hOldBitmap=( HBITMAP )SelectObject(hdcMem1, hBmp);
+ hOldBitmap=(HBITMAP)SelectObject(hdcMem1, hBmp);
hBmpCopy=CreateCompatibleBitmap(hdcMem1, bmpInfo.bmWidth, bmpInfo.bmHeight);
- hOldBitmap2=( HBITMAP )SelectObject(hdcMem2, hBmpCopy);
+ hOldBitmap2=(HBITMAP)SelectObject(hdcMem2, hBmpCopy);
BitBlt(hdcMem2, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, hdcMem1, 0, 0, SRCCOPY);
SelectObject(hdcMem1, hOldBitmap);
SelectObject(hdcMem2, hOldBitmap2);
@@ -126,12 +126,12 @@ static INT_PTR sttBitmapLoader( const TCHAR* ptszFileName ) static INT_PTR BmpFilterLoadBitmap(WPARAM, LPARAM lParam)
{
- return sttBitmapLoader( StrConvT(( const char* )lParam ));
+ return sttBitmapLoader(StrConvT((const char*)lParam));
}
static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam)
{
- return sttBitmapLoader(( const wchar_t* )lParam );
+ return sttBitmapLoader((const wchar_t*)lParam);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -187,7 +187,7 @@ static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam) TCHAR *filter=(TCHAR*)lParam, *pfilter;
lstrcpyn(filter, TranslateT("All Bitmaps"), bytesLeft); bytesLeft-=lstrlen(filter);
- _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft );
+ _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft);
pfilter=filter+lstrlen(filter)+1; bytesLeft=wParam-(pfilter-filter);
lstrcpyn(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft);
pfilter+=lstrlen(pfilter)+1; bytesLeft=wParam-(pfilter-filter);
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index bde00a35ef..2705347f36 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -47,12 +47,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); /* always succeeds */
/* fall thru */
case WM_SYSCOLORCHANGE:
- if (!(dat->flags&HLKF_HASENABLECOLOR)) {
+ if ( !(dat->flags&HLKF_HASENABLECOLOR)) {
if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) dat->enableColor=RGB(0, 0, 255);
else dat->enableColor=GetSysColor(COLOR_HOTLIGHT);
dat->focusColor = RGB(GetRValue(dat->enableColor) / 2, GetGValue(dat->enableColor) / 2, GetBValue(dat->enableColor) / 2);
}
- if (!(dat->flags&HLKF_HASDISABLECOLOR))
+ if ( !(dat->flags&HLKF_HASDISABLECOLOR))
dat->disableColor=GetSysColor(COLOR_GRAYTEXT);
break;
@@ -101,7 +101,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_LBUTTONDOWN:
{ POINT pt;
POINTSTOPOINT(pt, MAKEPOINTS(lParam));
- if (!PtInRect(&dat->rcText, pt)) break;
+ if ( !PtInRect(&dat->rcText, pt)) break;
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), STN_CLICKED), (LPARAM)hwnd);
return 0;
}
@@ -131,12 +131,12 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA { RECT rcWnd;
POINT pt;
HWND hwndParent;
- if (!GetWindowRect(hwnd, &rcWnd)) break;
+ if ( !GetWindowRect(hwnd, &rcWnd)) break;
pt.x=rcWnd.left;
pt.y=rcWnd.top;
hwndParent=GetParent(hwnd);
if (hwndParent == NULL) hwndParent=hwnd;
- if (!ScreenToClient(hwndParent, &pt)) break;
+ if ( !ScreenToClient(hwndParent, &pt)) break;
rcWnd.right=pt.x+(rcWnd.right-rcWnd.left);
rcWnd.bottom=pt.y+(rcWnd.bottom-rcWnd.top);
rcWnd.left=pt.x;
@@ -149,7 +149,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA case WM_CREATE:
case HLK_MEASURETEXT:
{ TCHAR szText[256];
- if (!GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
+ if ( !GetWindowText(hwnd, szText, SIZEOF(szText))) return 0;
lParam=(LPARAM)szText;
/* fall thru */
case WM_SETTEXT:
@@ -176,15 +176,15 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA }
if (dat->hEnableFont != NULL && hPrevFont != NULL) SelectObject(hdc, hPrevFont);
ReleaseDC(hwnd, hdc);
- if (!fMeasured) return 0; /* text change failed */
+ if ( !fMeasured) return 0; /* text change failed */
SendMessage(hwnd, HLK_INVALIDATE, 0, 0);
break;
}}
case WM_SETCURSOR:
{ POINT pt;
HCURSOR hCursor;
- if (!GetCursorPos(&pt)) return FALSE;
- if (!ScreenToClient(hwnd, &pt)) return FALSE;
+ if ( !GetCursorPos(&pt)) return FALSE;
+ if ( !ScreenToClient(hwnd, &pt)) return FALSE;
if (PtInRect(&dat->rcText, pt)) {
hCursor=(HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR);
if (hCursor == NULL) hCursor=LoadCursor(NULL, IDC_HAND); /* Win2000+ */
diff --git a/src/modules/utils/imgconv.cpp b/src/modules/utils/imgconv.cpp index 118ffc3acb..d4d72f066e 100644 --- a/src/modules/utils/imgconv.cpp +++ b/src/modules/utils/imgconv.cpp @@ -46,9 +46,9 @@ void ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cx ULONG cxDelta = cxRow - bmi.bmiHeader.biWidth;
ARGB *pargbMask = (ARGB *)pvBits;
- for (ULONG y = bmi.bmiHeader.biHeight + 1; --y; )
+ for (ULONG y = bmi.bmiHeader.biHeight + 1; --y;)
{
- for (ULONG x = bmi.bmiHeader.biWidth + 1; --x; )
+ for (ULONG x = bmi.bmiHeader.biWidth + 1; --x;)
{
if (*pargbMask++)
{
@@ -68,12 +68,12 @@ void ConvertToPARGB32(HDC hdc, ARGB *pargb, HBITMAP hbmp, SIZE& sizImage, int cx free(pvBits);
}
-bool HasAlpha( ARGB *pargb, SIZE& sizImage, int cxRow)
+bool HasAlpha(ARGB *pargb, SIZE& sizImage, int cxRow)
{
ULONG cxDelta = cxRow - sizImage.cx;
- for (ULONG y = sizImage.cy; y--; )
+ for (ULONG y = sizImage.cy; y--;)
{
- for (ULONG x = sizImage.cx; x--; )
+ for (ULONG x = sizImage.cx; x--;)
{
if (*pargb++ & 0xFF000000)
return true;
@@ -92,7 +92,7 @@ void ConvertBufferToPARGB32(HANDLE hPaintBuffer, HDC hdc, HICON hIcon, SIZE& siz if (SUCCEEDED(hr))
{
ARGB *pargb = (ARGB *)prgbQuad;
- if (!HasAlpha(pargb, sizIcon, cxRow))
+ if ( !HasAlpha(pargb, sizIcon, cxRow))
{
ICONINFO info;
if (GetIconInfo(hIcon, &info))
diff --git a/src/modules/utils/md5.cpp b/src/modules/utils/md5.cpp index 241aa2270f..94cd69bbe2 100644 --- a/src/modules/utils/md5.cpp +++ b/src/modules/utils/md5.cpp @@ -147,7 +147,7 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]* * On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if (!((data - (const mir_md5_byte_t *)0) & 3)) {
+ if ( !((data - (const mir_md5_byte_t *)0) & 3)) {
/* data are properly aligned */
X = (const mir_md5_word_t *)data;
} else {
@@ -361,9 +361,9 @@ void md5_hash_string(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[ INT_PTR GetMD5Interface(WPARAM, LPARAM lParam)
{
struct MD5_INTERFACE *md5i = (struct MD5_INTERFACE*) lParam;
- if ( md5i == NULL )
+ if (md5i == NULL)
return 1;
- if ( md5i->cbSize != sizeof( struct MD5_INTERFACE ))
+ if (md5i->cbSize != sizeof(struct MD5_INTERFACE))
return 1;
md5i->md5_init = md5_init;
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 46e95f954e..296b9a3ecc 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -73,7 +73,7 @@ static int DoDdeRequest(const char *szItemName, HWND hwndDdeMsg) struct DdeMsgWindowData *dat=(struct DdeMsgWindowData*)GetWindowLongPtr(hwndDdeMsg, 0);
hSzItemName=GlobalAddAtomA(szItemName);
- if (!PostMessage(dat->hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDdeMsg, MAKELPARAM(CF_TEXT, hSzItemName))) {
+ if ( !PostMessage(dat->hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDdeMsg, MAKELPARAM(CF_TEXT, hSzItemName))) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
@@ -89,7 +89,7 @@ static int DoDdeRequest(const char *szItemName, HWND hwndDdeMsg) if (thisTick>timeoutTick) break;
} while (MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutTick-thisTick, QS_ALLINPUT) == WAIT_OBJECT_0);
- if (!dat->fData) {
+ if ( !dat->fData) {
GlobalDeleteAtom(hSzItemName);
return 1;
}
@@ -107,7 +107,7 @@ static int DdeOpenUrl(const char *szBrowser, char *szUrl, int newWindow, HWND hw hSzBrowser=GlobalAddAtomA(szBrowser);
hSzTopic=GlobalAddAtomA("WWW_OpenURL");
dat->fAcked=0;
- if (!SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDdeMsg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, &dwResult)
+ if ( !SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDdeMsg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, &dwResult)
|| !dat->fAcked) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
@@ -146,13 +146,13 @@ static void OpenURLThread(void *arg) DWORD dataLength;
int success=0;
- if (!hUrlInfo->szUrl) return;
+ if ( !hUrlInfo->szUrl) return;
hwndDdeMsg=CreateWindow(WNDCLASS_DDEMSGWINDOW, _T(""), 0, 0, 0, 0, 0, NULL, NULL, hMirandaInst, NULL);
SetWindowLongPtr(hwndDdeMsg, 0, (LONG_PTR)&msgWndData);
- if (!_strnicmp(hUrlInfo->szUrl, "ftp:", 4) || !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) pszProtocol="ftp";
- if (!_strnicmp(hUrlInfo->szUrl, "mailto:", 7)) pszProtocol="mailto";
- if (!_strnicmp(hUrlInfo->szUrl, "news:", 5)) pszProtocol="news";
+ if ( !_strnicmp(hUrlInfo->szUrl, "ftp:", 4) || !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) pszProtocol="ftp";
+ if ( !_strnicmp(hUrlInfo->szUrl, "mailto:", 7)) pszProtocol="mailto";
+ if ( !_strnicmp(hUrlInfo->szUrl, "news:", 5)) pszProtocol="news";
else pszProtocol="http";
wsprintfA(szSubkey, "%s\\shell\\open\\command", pszProtocol);
if (RegOpenKeyExA(HKEY_CURRENT_USER, szSubkey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS
@@ -184,7 +184,7 @@ static void OpenURLThread(void *arg) for (i=0;isalpha(hUrlInfo->szUrl[i]);i++);
if (hUrlInfo->szUrl[i] == ':') szResult=mir_strdup(hUrlInfo->szUrl);
else {
- if (!_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) {
+ if ( !_strnicmp(hUrlInfo->szUrl, "ftp.", 4)) {
szResult=(char*)mir_alloc(lstrlenA(hUrlInfo->szUrl)+7);
wsprintfA(szResult, "ftp://%s", hUrlInfo->szUrl);
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index c2915fb7ed..c38f09bcf5 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -33,9 +33,9 @@ static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam); static int pathIsAbsolute(const char *path)
{
- if ( strlen(path) <= 2 )
+ if (strlen(path) <= 2)
return 0;
- if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\'))
+ if ((path[1] == ':'&&path[2] == '\\') || (path[0] == '\\'&&path[1] == '\\'))
return 1;
return 0;
}
@@ -44,8 +44,8 @@ static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam) {
char *pSrc = (char*)wParam;
char *pOut = (char*)lParam;
- if (!pSrc||!strlen(pSrc)||strlen(pSrc)>MAX_PATH) return 0;
- if (!pathIsAbsolute(pSrc)) {
+ if ( !pSrc || !strlen(pSrc) || strlen(pSrc)>MAX_PATH) return 0;
+ if ( !pathIsAbsolute(pSrc)) {
mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
return strlen(pOut);
}
@@ -67,21 +67,21 @@ static INT_PTR pathToRelative(WPARAM wParam, LPARAM lParam) int pathToAbsolute(const char *pSrc, char *pOut, char* base)
{
- if ( !pSrc || !strlen( pSrc ) || strlen( pSrc ) > MAX_PATH )
+ if ( !pSrc || !strlen(pSrc) || strlen(pSrc) > MAX_PATH)
return 0;
- if ( base == NULL )
+ if (base == NULL)
base = szMirandaPath;
char buf[MAX_PATH];
- if ( pSrc[0] < ' ')
- return mir_snprintf( pOut, MAX_PATH, "%s", pSrc );
- else if ( pathIsAbsolute( pSrc ))
+ if (pSrc[0] < ' ')
+ return mir_snprintf(pOut, MAX_PATH, "%s", pSrc);
+ else if (pathIsAbsolute(pSrc))
return GetFullPathNameA(pSrc, MAX_PATH, pOut, NULL);
- else if ( pSrc[0] != '\\' )
- mir_snprintf( buf, MAX_PATH, "%s%s", base, pSrc );
+ else if (pSrc[0] != '\\')
+ mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc);
else
- mir_snprintf( buf, MAX_PATH, "%s%s", base, pSrc+1 );
+ mir_snprintf(buf, MAX_PATH, "%s%s", base, pSrc+1);
return GetFullPathNameA(buf, MAX_PATH, pOut, NULL);
}
@@ -91,42 +91,42 @@ static INT_PTR pathToAbsolute(WPARAM wParam, LPARAM lParam) return pathToAbsolute((char*)wParam, (char*)lParam, szMirandaPath);
}
-void CreatePathToFile( char* szFilePath )
+void CreatePathToFile(char* szFilePath)
{
- char* pszLastBackslash = strrchr( szFilePath, '\\' );
- if ( pszLastBackslash == NULL )
+ char* pszLastBackslash = strrchr(szFilePath, '\\');
+ if (pszLastBackslash == NULL)
return;
*pszLastBackslash = '\0';
- CreateDirectoryTree( szFilePath );
+ CreateDirectoryTree(szFilePath);
*pszLastBackslash = '\\';
}
-int CreateDirectoryTree( const char *szDir )
+int CreateDirectoryTree(const char *szDir)
{
DWORD dwAttributes;
char *pszLastBackslash, szTestDir[ MAX_PATH ];
- lstrcpynA( szTestDir, szDir, SIZEOF( szTestDir ));
- if (( dwAttributes = GetFileAttributesA( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ lstrcpynA(szTestDir, szDir, SIZEOF(szTestDir));
+ if ((dwAttributes = GetFileAttributesA(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- pszLastBackslash = strrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
+ pszLastBackslash = strrchr(szTestDir, '\\');
+ if (pszLastBackslash == NULL)
return 0;
*pszLastBackslash = '\0';
- CreateDirectoryTree( szTestDir );
+ CreateDirectoryTree(szTestDir);
*pszLastBackslash = '\\';
- return ( CreateDirectoryA( szTestDir, NULL ) == 0 ) ? GetLastError() : 0;
+ return (CreateDirectoryA(szTestDir, NULL) == 0) ? GetLastError() : 0;
}
static INT_PTR createDirTree(WPARAM, LPARAM lParam)
{
- if ( lParam == 0 )
+ if (lParam == 0)
return 1;
- return CreateDirectoryTree(( char* )lParam );
+ return CreateDirectoryTree((char*)lParam);
}
static TCHAR szMirandaPathW[MAX_PATH];
@@ -134,9 +134,9 @@ static TCHAR szMirandaPathWLower[MAX_PATH]; static int pathIsAbsoluteW(const TCHAR *path)
{
- if ( lstrlen(path) <= 2 )
+ if (lstrlen(path) <= 2)
return 0;
- if ((path[1] == ':'&&path[2] == '\\')||(path[0] == '\\'&&path[1] == '\\'))
+ if ((path[1] == ':'&&path[2] == '\\') || (path[0] == '\\'&&path[1] == '\\'))
return 1;
return 0;
}
@@ -145,10 +145,10 @@ static INT_PTR pathToRelativeW(WPARAM wParam, LPARAM lParam) {
TCHAR *pSrc = (TCHAR*)wParam;
TCHAR *pOut = (TCHAR*)lParam;
- if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH )
+ if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
return 0;
- if ( !pathIsAbsoluteW( pSrc ))
+ if ( !pathIsAbsoluteW(pSrc))
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
else {
TCHAR szTmp[MAX_PATH];
@@ -168,18 +168,18 @@ int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base) if ( !pSrc || !wcslen(pSrc) || wcslen(pSrc) > MAX_PATH)
return 0;
- if ( base == NULL )
+ if (base == NULL)
base = szMirandaPathW;
TCHAR buf[MAX_PATH];
- if ( pSrc[0] < ' ')
- return mir_sntprintf( pOut, MAX_PATH, _T("%s"), pSrc );
- else if ( pathIsAbsoluteW( pSrc ))
+ if (pSrc[0] < ' ')
+ return mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
+ else if (pathIsAbsoluteW(pSrc))
return GetFullPathName(pSrc, MAX_PATH, pOut, NULL);
- else if ( pSrc[0] != '\\' )
- mir_sntprintf( buf, MAX_PATH, _T("%s%s"), base, pSrc );
+ else if (pSrc[0] != '\\')
+ mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc);
else
- mir_sntprintf( buf, MAX_PATH, _T("%s%s"), base, pSrc+1 );
+ mir_sntprintf(buf, MAX_PATH, _T("%s%s"), base, pSrc+1);
return GetFullPathName(buf, MAX_PATH, pOut, NULL);
}
@@ -189,49 +189,49 @@ static INT_PTR pathToAbsoluteW(WPARAM wParam, LPARAM lParam) return pathToAbsoluteW((TCHAR*)wParam, (TCHAR*)lParam, szMirandaPathW);
}
-void CreatePathToFileW( WCHAR* wszFilePath )
+void CreatePathToFileW(WCHAR* wszFilePath)
{
- WCHAR* pszLastBackslash = wcsrchr( wszFilePath, '\\' );
- if ( pszLastBackslash == NULL )
+ WCHAR* pszLastBackslash = wcsrchr(wszFilePath, '\\');
+ if (pszLastBackslash == NULL)
return;
*pszLastBackslash = '\0';
- CreateDirectoryTreeW( wszFilePath );
+ CreateDirectoryTreeW(wszFilePath);
*pszLastBackslash = '\\';
}
-int CreateDirectoryTreeW( const WCHAR* szDir )
+int CreateDirectoryTreeW(const WCHAR* szDir)
{
DWORD dwAttributes;
WCHAR* pszLastBackslash, szTestDir[ MAX_PATH ];
- lstrcpynW( szTestDir, szDir, SIZEOF( szTestDir ));
- if (( dwAttributes = GetFileAttributesW( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ lstrcpynW(szTestDir, szDir, SIZEOF(szTestDir));
+ if ((dwAttributes = GetFileAttributesW(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return 0;
- pszLastBackslash = wcsrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
+ pszLastBackslash = wcsrchr(szTestDir, '\\');
+ if (pszLastBackslash == NULL)
return 0;
*pszLastBackslash = '\0';
- CreateDirectoryTreeW( szTestDir );
+ CreateDirectoryTreeW(szTestDir);
*pszLastBackslash = '\\';
- return ( CreateDirectoryW( szTestDir, NULL ) == 0 ) ? GetLastError() : 0;
+ return (CreateDirectoryW(szTestDir, NULL) == 0) ? GetLastError() : 0;
}
static INT_PTR createDirTreeW(WPARAM, LPARAM lParam)
{
- if ( lParam == 0 )
+ if (lParam == 0)
return 1;
- return CreateDirectoryTreeW(( WCHAR* )lParam );
+ return CreateDirectoryTreeW((WCHAR*)lParam);
}
int InitPathUtilsW(void)
{
GetModuleFileName(hMirandaInst, szMirandaPathW, SIZEOF(szMirandaPathW));
TCHAR *p = _tcsrchr(szMirandaPathW, '\\');
- if ( p )
+ if (p)
p[1] = 0;
mir_sntprintf(szMirandaPathWLower, SIZEOF(szMirandaPathWLower), _T("%s"), szMirandaPathW);
_tcslwr(szMirandaPathWLower);
@@ -244,10 +244,10 @@ int InitPathUtilsW(void) TCHAR *GetContactID(HANDLE hContact)
{
TCHAR *theValue = {0};
- char *szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (DBGetContactSettingByte(hContact, szProto, "ChatRoom", 0) == 1) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv)) {
+ if ( !DBGetContactSettingTString(hContact, szProto, "ChatRoomID", &dbv)) {
theValue = (TCHAR *)mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
return theValue;
@@ -258,7 +258,7 @@ TCHAR *GetContactID(HANDLE hContact) ci.hContact = hContact;
ci.szProto = szProto;
ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
switch (ci.type) {
case CNFT_ASCIIZ:
return (TCHAR *)ci.pszVal;
@@ -301,9 +301,9 @@ static __forceinline char *GetEnvironmentVariableX(char *variable) return mir_strdup(result);
return NULL;
}
-static __forceinline char *GetProfileDirX( char* )
+static __forceinline char *GetProfileDirX(char*)
{
- return mir_t2a( g_profileDir );
+ return mir_t2a(g_profileDir);
}
static __forceinline char *SHGetSpecialFolderPathX(int iCSIDL, char* var)
{
@@ -331,22 +331,22 @@ static __forceinline char *GetUserNameX(char *) static __forceinline char *GetProfileNameX(char *)
{
TCHAR szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- return mir_t2a( szProfileName );
+ return mir_t2a(szProfileName);
}
static __forceinline char *GetPathVarX(char *, int code)
{
TCHAR szFullPath[MAX_PATH], szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
- _tcslwr( szProfileName );
+ _tcscpy(szProfileName, g_profileName);
+ _tcslwr(szProfileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- switch( code ) {
+ switch(code) {
case 1:
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, szProfileName);
break;
@@ -357,7 +357,7 @@ static __forceinline char *GetPathVarX(char *, int code) mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, szProfileName);
break;
}
- return makeFileName( szFullPath );
+ return makeFileName(szFullPath);
}
static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return _tcscmp(s1, s2); }
@@ -390,9 +390,9 @@ static __forceinline TCHAR *SHGetSpecialFolderPathX(int iCSIDL, TCHAR* var) return mir_tstrdup(result);
return NULL;
}
-static __forceinline TCHAR *GetProfileDirX( TCHAR* )
+static __forceinline TCHAR *GetProfileDirX(TCHAR*)
{
- return mir_tstrdup( g_profileDir );
+ return mir_tstrdup(g_profileDir);
}
static __forceinline TCHAR *GetModulePathX(TCHAR *, HMODULE hModule)
{
@@ -413,21 +413,21 @@ static __forceinline TCHAR *GetUserNameX(TCHAR *) static __forceinline TCHAR *GetProfileNameX(TCHAR *)
{
TCHAR szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- return mir_tstrdup( szProfileName );
+ return mir_tstrdup(szProfileName);
}
static __forceinline TCHAR *GetPathVarX(TCHAR *, int code)
{
TCHAR szFullPath[MAX_PATH], szProfileName[MAX_PATH];
- _tcscpy( szProfileName, g_profileName );
+ _tcscpy(szProfileName, g_profileName);
TCHAR *pos = _tcsrchr(szProfileName, '.');
- if ( lstrcmp( pos, _T(".dat")) == 0 )
+ if (lstrcmp(pos, _T(".dat")) == 0)
*pos = 0;
- switch( code ) {
+ switch(code) {
case 1:
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, szProfileName);
break;
@@ -438,7 +438,7 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code) mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s"), g_profileDir, szProfileName);
break;
}
- return mir_tstrdup( szFullPath );
+ return mir_tstrdup(szFullPath);
}
template<typename XCHAR>
@@ -450,38 +450,38 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) theKey[keyLength] = 0;
if (hContact) {
- if (!_xcscmp(theKey, XSTR(key, "nick")))
+ if ( !_xcscmp(theKey, XSTR(key, "nick")))
theValue = GetContactNickX(key, hContact);
- else if (!_xcscmp(theKey, XSTR(key, "proto")))
+ else if ( !_xcscmp(theKey, XSTR(key, "proto")))
theValue = mir_a2x(key, (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0));
- else if (!_xcscmp(theKey, XSTR(key, "userid")))
+ else if ( !_xcscmp(theKey, XSTR(key, "userid")))
theValue = GetContactIDX(key, hContact);
}
- if (!theValue) {
- if (!_xcscmp(theKey, XSTR(key, "miranda_path")))
+ if ( !theValue) {
+ if ( !_xcscmp(theKey, XSTR(key, "miranda_path")))
theValue = GetModulePathX(key, NULL);
- else if (!_xcscmp(theKey, XSTR(key, "appdata")))
+ else if ( !_xcscmp(theKey, XSTR(key, "appdata")))
theValue = SHGetSpecialFolderPathX(CSIDL_APPDATA, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "mydocuments")))
+ else if ( !_xcscmp(theKey, XSTR(key, "mydocuments")))
theValue = SHGetSpecialFolderPathX(CSIDL_PERSONAL, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "desktop")))
+ else if ( !_xcscmp(theKey, XSTR(key, "desktop")))
theValue = SHGetSpecialFolderPathX(CSIDL_DESKTOPDIRECTORY, theKey);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_profile")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_profile")))
theValue = GetProfileDirX(key);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_profilename")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_profilename")))
theValue = GetProfileNameX(key);
- else if (!_xcscmp(theKey, XSTR(key, "username")))
+ else if ( !_xcscmp(theKey, XSTR(key, "username")))
theValue = GetUserNameX(key);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_avatarcache")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_avatarcache")))
theValue = GetPathVarX(key, 1);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_logpath")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_logpath")))
theValue = GetPathVarX(key, 2);
- else if (!_xcscmp(theKey, XSTR(key, "miranda_userdata")))
+ else if ( !_xcscmp(theKey, XSTR(key, "miranda_userdata")))
theValue = GetPathVarX(key, 3);
}
- if (!theValue)
+ if ( !theValue)
theValue = GetEnvironmentVariableX(theKey);
return theValue;
@@ -502,7 +502,7 @@ XCHAR *GetVariableFromArray(REPLACEVARSARRAY *vars, XCHAR *key, size_t keyLength template<typename XCHAR>
XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data)
{
- if (!str)
+ if ( !str)
return NULL;
XCHAR *p;
@@ -526,7 +526,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) }
else varStart = p+1;
}
- else if (!varStart)
+ else if ( !varStart)
length++;
}
@@ -553,7 +553,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) }
else varStart = p+1;
}
- else if (!varStart)
+ else if ( !varStart)
*q++ = *p;
}
@@ -565,7 +565,7 @@ XCHAR *ReplaceVariables(XCHAR *str, REPLACEVARSDATA *data) static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam)
{
REPLACEVARSDATA *data = (REPLACEVARSDATA *)lParam;
- if (!(data->dwFlags & RVF_UNICODE))
+ if ( !(data->dwFlags & RVF_UNICODE))
return (INT_PTR)ReplaceVariables<char>((char *)wParam, data);
@@ -577,7 +577,7 @@ int InitPathUtils(void) char *p = 0;
GetModuleFileNameA(hMirandaInst, szMirandaPath, SIZEOF(szMirandaPath));
p = strrchr(szMirandaPath, '\\');
- if ( p )
+ if (p)
p[1] = 0;
mir_snprintf(szMirandaPathLower, MAX_PATH, "%s", szMirandaPath);
_strlwr(szMirandaPathLower);
diff --git a/src/modules/utils/resizer.cpp b/src/modules/utils/resizer.cpp index 1ddfa3fb75..a443fef0ae 100644 --- a/src/modules/utils/resizer.cpp +++ b/src/modules/utils/resizer.cpp @@ -61,7 +61,7 @@ INT_PTR ResizeDialog(WPARAM, LPARAM lParam) int procResult;
int extendedDlg, itemCount;
- if (urd == NULL||urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
+ if (urd == NULL || urd->cbSize != sizeof(UTILRESIZEDIALOG)) return 1;
pTemplate=(DLGTEMPLATE*)LockResource(LoadResource(urd->hInstance, FindResourceA(urd->hInstance, urd->lpTemplate, MAKEINTRESOURCEA(5))));
pTemplateEx=(START_OF_DLGTEMPLATEEX*)pTemplate;
extendedDlg=pTemplateEx->signature == 0xFFFF;
diff --git a/src/modules/utils/sha1.cpp b/src/modules/utils/sha1.cpp index 3d71239bab..2fede54718 100644 --- a/src/modules/utils/sha1.cpp +++ b/src/modules/utils/sha1.cpp @@ -162,9 +162,9 @@ static void shaHashBlock(mir_sha1_ctx *ctx) { INT_PTR GetSHA1Interface(WPARAM, LPARAM lParam)
{
struct SHA1_INTERFACE *sha1i = (struct SHA1_INTERFACE*) lParam;
- if ( sha1i == NULL )
+ if (sha1i == NULL)
return 1;
- if ( sha1i->cbSize != sizeof( struct SHA1_INTERFACE ))
+ if (sha1i->cbSize != sizeof(struct SHA1_INTERFACE))
return 1;
sha1i->sha1_init = shaInit;
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index c562ce6460..05e83afa51 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -138,7 +138,7 @@ static void CalcTsOffset(MIM_TIMEZONE *tz) SystemTimeToFileTime(&st, &ft);
time_t ts1 = FileTimeToUnixTime(&ft);
- if (!fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl))
+ if ( !fnSystemTimeToTzSpecificLocalTime(&tz->tzi, &st, &stl))
return;
SystemTimeToFileTime(&stl, &ft);
@@ -187,7 +187,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
DBFreeVariant(&dbv);
@@ -198,7 +198,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) if (timezone == -1)
{
char* szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (!DBGetContactSettingTString(hContact, szProto, "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, szProto, "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);
DBFreeVariant(&dbv);
@@ -349,13 +349,13 @@ static const ListMessages cbMessages = static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags)
{
- if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB)))
+ if ( !(dwFlags & (TZF_PLF_CB | TZF_PLF_LB)))
{
TCHAR tszClassName[128];
GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
- if (!_tcsicmp(tszClassName, _T("COMBOBOX")))
+ if ( !_tcsicmp(tszClassName, _T("COMBOBOX")))
dwFlags |= TZF_PLF_CB;
- else if (!_tcsicmp(tszClassName, _T("LISTBOX")))
+ else if ( !_tcsicmp(tszClassName, _T("LISTBOX")))
dwFlags |= TZF_PLF_LB;
}
if (dwFlags & TZF_PLF_CB)
@@ -379,7 +379,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) if (hContact)
{
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
+ if ( !DBGetContactSettingTString(hContact, "UserInfo", "TzName", &dbv))
{
unsigned hash = hashstr(dbv.ptszVal);
for (int i = 0; i < g_timezonesBias.getCount(); ++i)
@@ -442,7 +442,7 @@ static void timeapiStoreListResult(HANDLE hContact, HWND hWnd, DWORD dwFlags) }
-static INT_PTR GetTimeApi( WPARAM, LPARAM lParam )
+static INT_PTR GetTimeApi(WPARAM, LPARAM lParam)
{
TIME_API* tmi = (TIME_API*)lParam;
if (tmi == NULL)
@@ -542,9 +542,9 @@ void RecalculateTime(void) MIM_TIMEZONE &tz = g_timezones[i];
if (tz.offset != INT_MIN) tz.offset = INT_MIN;
- if (!found)
+ if ( !found)
{
- if (!wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) ||
+ if ( !wcscmp(tz.tzi.StandardName, myInfo.myTZ.tzi.StandardName) ||
!wcscmp(tz.tzi.DaylightName, myInfo.myTZ.tzi.DaylightName))
{
_tcscpy(myInfo.myTZ.tszName, tz.tszName);
diff --git a/src/modules/utils/utf.cpp b/src/modules/utils/utf.cpp index 4c86e1c4ee..d9479f59d3 100644 --- a/src/modules/utils/utf.cpp +++ b/src/modules/utils/utf.cpp @@ -78,7 +78,7 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen) len += 2;
continue;
}
- if (!(val = getSurrogateValue(src, srclen)))
+ if ( !(val = getSurrogateValue(src, srclen)))
{
return -2;
}
@@ -96,10 +96,10 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen) int Ucs2toUtf8Len(const wchar_t *src)
{
- if ( src == 0 )
+ if (src == 0)
return 0;
- return Ucs2toUtf8Len( src, (int)wcslen( src ));
+ return Ucs2toUtf8Len(src, (int)wcslen(src));
}
/* wide char to UTF-8 string conversion */
@@ -115,7 +115,7 @@ int Ucs2toUtf8(const wchar_t *src, int srclen, char *dst, int dstlen) if (ch < 0x80) /* 0x00-0x7f: 1 byte */
{
- if (!len--) return -1; /* overflow */
+ if ( !len--) return -1; /* overflow */
*dst++ = ch;
continue;
}
@@ -130,7 +130,7 @@ int Ucs2toUtf8(const wchar_t *src, int srclen, char *dst, int dstlen) continue;
}
- if (!(val = getSurrogateValue(src, srclen)))
+ if ( !(val = getSurrogateValue(src, srclen)))
{
return -2;
}
@@ -259,7 +259,7 @@ char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2) int len;
bool needs_free = false;
wchar_t* tempBuf = NULL;
- if ( ucs2 )
+ if (ucs2)
*ucs2 = NULL;
if (str == NULL)
@@ -292,9 +292,9 @@ char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2) }
}
- if ( tempBuf == NULL ) {
+ if (tempBuf == NULL) {
tempBuf = (wchar_t*)mir_alloc((destlen + 1) * sizeof(wchar_t));
- if ( tempBuf == NULL )
+ if (tempBuf == NULL)
return NULL;
}
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 6372bac5cb..96b69de775 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -301,7 +301,7 @@ static INT_PTR GetCountryByNumber(WPARAM wParam, LPARAM) {
int i;
- for (i=0; i < SIZEOF(countries); i++ )
+ for (i=0; i < SIZEOF(countries); i++)
if ((int)wParam == countries[i].id) return (INT_PTR)countries[i].szName;
return (INT_PTR)NULL;
}
@@ -406,7 +406,7 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam) if (wParam & RWPF_NOACTIVATE)
wp.showCmd = SW_SHOWNOACTIVATE;
- if (!(wParam & RWPF_NOMOVE))
+ if ( !(wParam & RWPF_NOMOVE))
AssertInsideScreen((WPARAM) &wp.rcNormalPosition, 0);
SetWindowPlacement(swp->hwnd, &wp);
@@ -421,15 +421,15 @@ static INT_PTR RestartMiranda(WPARAM, LPARAM) PROCESS_INFORMATION pi;
STARTUPINFO si = { 0 };
si.cb = sizeof(si);
- GetModuleFileName( NULL, mirandaPath, SIZEOF(mirandaPath));
- mir_sntprintf( cmdLine, SIZEOF( cmdLine ), _T("/restart:%d"), GetCurrentProcessId());
- CreateProcess( mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
+ GetModuleFileName(NULL, mirandaPath, SIZEOF(mirandaPath));
+ mir_sntprintf(cmdLine, SIZEOF(cmdLine), _T("/restart:%d"), GetCurrentProcessId());
+ CreateProcess(mirandaPath, cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
-typedef BOOL (APIENTRY *PGENRANDOM)( PVOID, ULONG );
+typedef BOOL (APIENTRY *PGENRANDOM)(PVOID, ULONG);
static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam)
{
@@ -442,7 +442,7 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) pfnRtlGenRandom = (PGENRANDOM)GetProcAddress(hModule, "SystemFunction036");
if (pfnRtlGenRandom)
{
- if (!pfnRtlGenRandom((PVOID)lParam, wParam))
+ if ( !pfnRtlGenRandom((PVOID)lParam, wParam))
pfnRtlGenRandom = NULL;
}
}
@@ -450,7 +450,7 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam) {
srand(GetTickCount());
unsigned short* buf = (unsigned short*)lParam;
- for (; (long)(wParam-=2) >= 0; )
+ for (; (long)(wParam-=2) >= 0;)
*(buf++) = (unsigned short)rand();
if (lParam < 0)
*(char*)buf = (char)(rand() & 0xFF);
@@ -578,7 +578,7 @@ int LoadUtilsModule(void) void UnloadUtilsModule(void)
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
FreeWindowList();
UninitTimeZones();
diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index 059d3dd1d7..f1ccff236b 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -92,7 +92,7 @@ int InitWindowList(void) void FreeWindowList(void)
{
- if ( windowList ) {
+ if (windowList) {
mir_free(windowList);
windowList = NULL;
}
|