diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-14 20:06:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-14 20:06:14 +0000 |
commit | 26dd9ff89c617734e4f7959f1967fb98d7f3478f (patch) | |
tree | b911c8fe9377a2aa1eb8a05d5f46eb21771a035c | |
parent | eb4a70dde5107116aa29b7a673f34a27a71fcd5d (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1940 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rwxr-xr-x | plugins/Msg_Export/src/utils.cpp | 22 | ||||
-rw-r--r-- | src/modules/database/dbutils.cpp | 19 |
2 files changed, 19 insertions, 22 deletions
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 79c6ff29b8..08d7323b36 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -428,7 +428,7 @@ bool bCreatePathToFile( tstring sFilePath ) bool bWriteToFile( HANDLE hFile , const char * pszSrc , int nLen = -1 )
{
if( nLen < 0 )
- nLen = strlen( pszSrc );
+ nLen = (int)strlen( pszSrc );
DWORD dwBytesWritten;
return WriteFile( hFile , pszSrc , nLen , &dwBytesWritten , NULL ) && (dwBytesWritten == (DWORD)nLen);
}
@@ -452,7 +452,7 @@ bool bWriteToFile( HANDLE hFile , const char * pszSrc , int nLen = -1 ) bool bWriteTextToFile( HANDLE hFile , const _TCHAR * pszSrc , bool bUtf8File ,int nLen = -1 )
{
if( nLen < 0 )
- nLen = _tcslen( pszSrc );
+ nLen = (int)_tcslen( pszSrc );
if( ! bUtf8File )
{
// We need to downgrade text to ansi
@@ -473,7 +473,7 @@ bool bWriteTextToFile( HANDLE hFile , const _TCHAR * pszSrc , bool bUtf8File ,in bool bWriteTextToFile( HANDLE hFile , const char * pszSrc , bool bUtf8File ,int nLen = -1 )
{
if( nLen == -1 )
- nLen = strlen( pszSrc );
+ nLen = (int)strlen( pszSrc );
wchar_t * pszWstr = new wchar_t[nLen];
bool bRet = false;
if( MultiByteToWideChar(CP_ACP, 0, pszSrc, nLen, pszWstr, nLen ) == nLen )
@@ -1138,7 +1138,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) szTemp[1] = 0;
ReplaceAll( output , _T("%Gender%") , szTemp );
- if( ! bWriteTextToFile( hFile , output.data(), bWriteUTF8Format, output.size() ) )
+ if( ! bWriteTextToFile( hFile , output.data(), bWriteUTF8Format, (int)output.size() ) )
{
DisplayErrorDialog( LPGENT("Failed to write user details to file :\n") , sFilePath , NULL );
CloseHandle( hFile );
@@ -1161,7 +1161,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT,dbei.timestamp,(LPARAM)&dbtts);
- nIndent = _tcslen( szTemp );
+ nIndent = (int)_tcslen( szTemp );
szTemp[nIndent++] = ' ';
// Write first part of line with name and timestamp
@@ -1230,7 +1230,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) bool bWriteOk = false;
- int nLen = strlen( pszData );
+ int nLen = (int)strlen( pszData );
if( (pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
{
if( bWriteTextToFile( hFile , pszType , bWriteUTF8Format ) &&
@@ -1243,7 +1243,7 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) }
else
{
- nLen = strlen( pszData );
+ nLen = (int)strlen( pszData );
if( (pszData - (char *)dbei.pBlob) + nLen < (int)dbei.cbBlob )
{
if( bWriteNewLine( hFile , nIndent ) &&
@@ -1360,13 +1360,13 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) if( nMsgLenght < dbei.cbBlob )
{
size_t nFriendlyLen = strlen( &pszStr[nMsgLenght] );
- bWriteTextToFile( hFile , &pszStr[nMsgLenght] , bWriteUTF8Format , nFriendlyLen );
+ bWriteTextToFile( hFile , &pszStr[nMsgLenght] , bWriteUTF8Format , (int)nFriendlyLen );
size_t nEmailOffset = nMsgLenght + nFriendlyLen + 1;
if( nEmailOffset < dbei.cbBlob )
{
bWriteTextToFile( hFile , _T("<") , bWriteUTF8Format );
size_t nEmailLen = strlen( &pszStr[nEmailOffset] );
- bWriteTextToFile( hFile , &pszStr[nEmailOffset] , bWriteUTF8Format , nEmailLen );
+ bWriteTextToFile( hFile , &pszStr[nEmailOffset] , bWriteUTF8Format , (int)nEmailLen );
bWriteTextToFile( hFile , _T(">") , bWriteUTF8Format );
}
}
@@ -1441,7 +1441,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) { // Get Blob data size
- int nSize = CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)lparam,0);
+ int nSize = (int)CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)lparam,0);
if( nSize > 0 )
{
dbei.cbBlob = nSize;
@@ -1473,7 +1473,7 @@ int nExportEvent(WPARAM wparam,LPARAM lparam) #ifdef _UNICODE
bool bWriteIndentedToFile( HANDLE hFile , int nIndent , const char * pszSrc , bool bUtf8File )
{
- int nLen = strlen( pszSrc );
+ int nLen = (int)strlen( pszSrc );
wchar_t * pszWstr = new wchar_t[nLen+1];
bool bRet = false;
if( MultiByteToWideChar(CP_ACP, 0, pszSrc, nLen, pszWstr, nLen ) == nLen )
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index cca96a763c..fe0ba20b34 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -123,13 +123,13 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (egt->datatype == DBVT_WCHAR)
{
WCHAR* msg = NULL;
- if (dbei->flags & DBEF_UTF) {
- char* str = (char*)alloca(dbei->cbBlob + 1);
- if (str == NULL) return NULL;
- memcpy(str, dbei->pBlob, dbei->cbBlob);
- str[dbei->cbBlob] = 0;
+ if (dbei->flags & DBEF_UTF) {
+ char* str = (char*)alloca(dbei->cbBlob + 1);
+ if (str == NULL) return NULL;
+ memcpy(str, dbei->pBlob, dbei->cbBlob);
+ str[dbei->cbBlob] = 0;
Utf8DecodeCP(str, egt->codepage, &msg);
- }
+ }
else {
size_t msglen = strlen((char*)dbei->pBlob) + 1, msglenW = 0;
if (msglen != dbei->cbBlob) {
@@ -154,7 +154,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) if (dbei->flags & DBEF_UTF)
Utf8DecodeCP(msg, egt->codepage, NULL);
- return (INT_PTR)msg;
+ return (INT_PTR)msg;
}
return 0;
}
@@ -195,10 +195,7 @@ static INT_PTR DbEventGetIcon(WPARAM wParam, LPARAM lParam) }
}
- if (wParam & LR_SHARED)
- return (INT_PTR)icon;
- else
- return (INT_PTR)CopyIcon(icon);
+ return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
}
static INT_PTR DbEventGetStringT(WPARAM wParam, LPARAM lParam)
|