Skip to content

Commit

Permalink
Fixed some code style warnings.
Browse files Browse the repository at this point in the history
Signed-off-by: raspopov <raspopov@cherubicsoft.com>
  • Loading branch information
raspopov committed Apr 18, 2021
1 parent 1a6d4eb commit c12adbf
Showing 6 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions SearchManager/Item.cpp
Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ void CItem::ParseURL(bool bGuid)
const CString guid = _T("{") + Path.Mid( 4, 36 ) + _T("}");

// Cut-off the GUID from the Path and URL
Path = Path.Left( 3 ) + (LPCTSTR)Path.Mid( 42 );
Path = Path.Left( 3 ) + Path.Mid( 42 );
URL = Protocol + _T(":///") + Path;

if ( SUCCEEDED( CLSIDFromString( guid, &Guid ) ) && bGuid )
@@ -279,18 +279,18 @@ int CRoot::InsertTo(CListCtrl& list, int group_id) const

item.iSubItem = 2;
const static CString in_scope = LoadString( IDS_ROOT_IN_SCOPE );
item.pszText = const_cast< LPTSTR >( IncludedInCrawlScope ? (LPCTSTR)in_scope : _T("") );
item.pszText = const_cast< LPTSTR >( IncludedInCrawlScope ? static_cast< LPCTSTR >( in_scope ) : _T("") );
VERIFY( list.SetItem( &item ) );

item.iSubItem = 3;
const static CString hier = LoadString( IDS_ROOT_HIER );
item.pszText = const_cast< LPTSTR >( IsHierarchical ? (LPCTSTR)hier : _T("") );
item.pszText = const_cast< LPTSTR >( IsHierarchical ? static_cast< LPCTSTR >( hier ) : _T("") );
VERIFY( list.SetItem( &item ) );

item.iSubItem = 4;
const static CString notify = LoadString( IDS_ROOT_NOTIFY );
const static CString notify_only = LoadString( IDS_ROOT_NOTIFY_ONLY );
item.pszText = const_cast< LPTSTR >( ProvidesNotifications ? ( UseNotificationsOnly ? (LPCTSTR)notify_only : (LPCTSTR)notify ): _T("") );
item.pszText = const_cast< LPTSTR >( ProvidesNotifications ? ( UseNotificationsOnly ? static_cast< LPCTSTR >( notify_only ) : static_cast< LPCTSTR >( notify ) ): _T("") );
VERIFY( list.SetItem( &item ) );

return item.iItem;
@@ -419,18 +419,18 @@ int CRule::InsertTo(CListCtrl& list, int group_id) const
item.iSubItem = 2;
const static CString incl = LoadString( IDS_RULE_INCLUDE );
const static CString excl = LoadString( IDS_RULE_EXCLUDE );
item.pszText = const_cast< LPTSTR >( IsInclude ? (LPCTSTR)incl : (LPCTSTR)excl );
item.pszText = const_cast< LPTSTR >( IsInclude ? static_cast< LPCTSTR >( incl ) : static_cast< LPCTSTR >( excl ) );
VERIFY( list.SetItem( &item ) );

item.iSubItem = 3;
const static CString def = LoadString( IDS_RULE_DEFAULT );
const static CString user = LoadString( IDS_RULE_USER );
item.pszText = const_cast< LPTSTR >( IsDefault ? (LPCTSTR)def : (LPCTSTR)user );
item.pszText = const_cast< LPTSTR >( IsDefault ? static_cast< LPCTSTR >( def ) : static_cast< LPCTSTR >( user ) );
VERIFY( list.SetItem( &item ) );

item.iSubItem = 4;
const static CString child = LoadString( IDS_RULE_HAS_CHILD );
item.pszText = const_cast< LPTSTR >( HasChild ? (LPCTSTR)child : _T("") );
item.pszText = const_cast< LPTSTR >( HasChild ? static_cast< LPCTSTR >( child ) : _T("") );
VERIFY( list.SetItem( &item ) );

return item.iItem;
2 changes: 1 addition & 1 deletion SearchManager/SearchManager.cpp
Original file line number Diff line number Diff line change
@@ -373,7 +373,7 @@ LSTATUS RegRenumberKeys(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpNumberKey)
break;
}

keys.insert( number );
keys.emplace( number );
}

if ( res == ERROR_SUCCESS )
2 changes: 1 addition & 1 deletion SearchManager/SearchManagerDlgOps.cpp
Original file line number Diff line number Diff line change
@@ -412,7 +412,7 @@ void CSearchManagerDlg::Rebuild()
CAutoPtr< CAsProcess >sys( CAsProcess::RunAsTrustedInstaller() );

folder.AppendChar( 0 ); // double null terminated for SHFileOperation
SHFILEOPSTRUCT fop = { GetSafeHwnd(), FO_DELETE, (LPCTSTR)folder, nullptr, FOF_ALLOWUNDO | FOF_NOCONFIRMATION };
SHFILEOPSTRUCT fop = { GetSafeHwnd(), FO_DELETE, static_cast< LPCTSTR >( folder ), nullptr, FOF_ALLOWUNDO | FOF_NOCONFIRMATION };
if ( GetFileAttributes( folder ) == INVALID_FILE_ATTRIBUTES || SHFileOperation( &fop ) == 0 )
{
// Set an option to revert to initial state
2 changes: 1 addition & 1 deletion SearchManager/SearchManagerDlgRefresh.cpp
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ int CSearchManagerDlg::GetGroupId(const CString& name, REFGUID guid)
const_cast< LPTSTR >( static_cast< LPCTSTR >( key ) ), 0, nullptr, 0, static_cast< int >( m_Groups.size() ) };
VERIFY( m_wndList.InsertGroup( grpRoots.iGroupId, &grpRoots ) != -1 );

m_Groups.insert( std::make_pair( key, grpRoots.iGroupId ) );
m_Groups.emplace( std::make_pair( key, grpRoots.iGroupId ) );

return grpRoots.iGroupId;
}
2 changes: 1 addition & 1 deletion SearchManager/System.h
Original file line number Diff line number Diff line change
@@ -245,7 +245,7 @@ class CAsProcess : public CAccessToken
NO_MULTIPLE_TRUSTEE,
TRUSTEE_IS_SID,
TRUSTEE_IS_USER,
(LPTSTR)( (TOKEN_USER*)pBuf )->User.Sid
static_cast< LPTSTR >( reinterpret_cast< TOKEN_USER* >( pBuf )->User.Sid )
}
};

10 changes: 5 additions & 5 deletions SearchManager/UrlDlg.cpp
Original file line number Diff line number Diff line change
@@ -97,8 +97,8 @@ BOOL CUrlDialog::OnInitDialog()
if ( SetMenuItemInfo( m_btnInsert.m_hMenu, 0, TRUE, &mi ) )
{
std::set < CString > items;
items.insert( DEFAULT_PROTOCOL _T("://") );
items.insert( FILE_PROTOCOL _T(":///") );
items.emplace( DEFAULT_PROTOCOL _T("://") );
items.emplace( FILE_PROTOCOL _T(":///") );

HKEY hProtocolsKey;
LSTATUS res = RegOpenKeyFull( HKEY_LOCAL_MACHINE, KEY_PROTOCOLS, KEY_ENUMERATE_SUB_KEYS, &hProtocolsKey );
@@ -119,7 +119,7 @@ BOOL CUrlDialog::OnInitDialog()
proto.MakeLower();
if ( proto.CompareNoCase( DEFAULT_PROTOCOL ) != 0 && proto.CompareNoCase( FILE_PROTOCOL ) != 0 )
{
items.insert( proto + _T("://") );
items.emplace( proto + _T("://") );
}
}
RegCloseKey( hProtocolsKey );
@@ -147,7 +147,7 @@ BOOL CUrlDialog::OnInitDialog()
DWORD user_size = MAX_PATH;
GetUserNameEx( EXTENDED_NAME_FORMAT::NameSamCompatible, user.GetBuffer( MAX_PATH ), &user_size );
user.ReleaseBuffer();
items.insert( user );
items.emplace( user );

CString computer;
DWORD computer_size = MAX_PATH;
@@ -167,7 +167,7 @@ BOOL CUrlDialog::OnInitDialog()
{
if ( ( buf[ i ].usri1_flags & UF_ACCOUNTDISABLE ) == 0 && ( buf[ i ].usri1_flags & UF_NORMAL_ACCOUNT ) != 0 )
{
items.insert( computer + _T('\\') + buf[ i ].usri1_name );
items.emplace( computer + _T('\\') + buf[ i ].usri1_name );
}
index = buf[ i ].usri1_next_index;
}

0 comments on commit c12adbf

Please sign in to comment.