create two new functions String::str() and String::toLower() to avoid
_tcslwr() calls and allow convenient string conversions
Modified: trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/unixfs.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp
Modified: trunk/reactos/subsys/system/explorer/utility/utility.h
_____
Modified: trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
--- trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/dialogs/searchprogram.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -151,9 +151,7 @@
TCHAR buffer[1024];
GetWindowText(GetDlgItem(_hwnd, IDC_FILTER), buffer,
COUNTOF(buffer));
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr(buffer);
-#endif
+ CharLower(buffer);
_lwr_filter = buffer;
HiddenWindow hide_listctrl(_list_ctrl);
@@ -230,10 +228,8 @@
String lwr_path = cache_entry._path;
String lwr_name = cache_entry._entry->_display_name;
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr(&lwr_path.at(0));
- _tcslwr(&lwr_name.at(0));
-#endif
+ lwr_path.toLower();
+ lwr_name.toLower();
if (_lwr_filter.empty())
if (_tcsstr(lwr_name, _T("uninstal")) ||
_tcsstr(lwr_name, _T("deinstal"))) // filter out deinstallation
links
_____
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
--- trunk/reactos/subsys/system/explorer/explorer.cpp 2005-11-01
18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/explorer.cpp 2005-11-01
20:30:17 UTC (rev 18937)
@@ -182,9 +182,7 @@
const FileTypeInfo& FileTypeManager::operator[](String ext)
{
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr(&ext.at(0));
-#endif
+ ext.toLower();
iterator found = find(ext);
if (found != end())
@@ -414,9 +412,7 @@
{
CachePair key(path, idx);
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr(&key.first.at(0));
-#endif
+ key.first.toLower();
PathIdxMap::iterator found = _pathIdxMap.find(key);
_____
Modified: trunk/reactos/subsys/system/explorer/shell/entries.cpp
--- trunk/reactos/subsys/system/explorer/shell/entries.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/shell/entries.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -514,7 +514,7 @@
LPCTSTR name = NULL;
TCHAR buffer[MAX_PATH];
- if ( !path || 0 == path_count )
+ if (!path || path_count==0)
return false;
const Entry* entry;
_____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
--- trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -679,7 +679,7 @@
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
ResString sFavorites(IDS_FAVORITES);
- tvi.item.pszText = (LPTSTR)sFavorites.c_str();
+ tvi.item.pszText = sFavorites.str();
tvi.item.iSelectedImage = tvi.item.iImage = 0;
HTREEITEM hitem_bookmarks = TreeView_InsertItem(_hsidebar,
&tvi);
@@ -1673,7 +1673,7 @@
TCHAR path[MAX_PATH];
- if (shell_entry->get_path(path,COUNTOF(path))) {
+ if (shell_entry->get_path(path, COUNTOF(path))) {
String url;
if (path[0] == ':')
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/shell/shellfs.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -128,7 +128,7 @@
// get full path of a shell entry
bool ShellEntry::get_path(PTSTR path, size_t path_count) const
{
- if ( !path || 0 == path_count )
+ if (!path || path_count==0)
return false;
/*
path[0] = TEXT('\0');
@@ -152,7 +152,7 @@
{
CONTEXT("ShellDirectory::get_path()");
- if ( !path || 0 == path_count )
+ if (!path || path_count==0)
return false;
path[0] = TEXT('\0');
_____
Modified: trunk/reactos/subsys/system/explorer/shell/unixfs.cpp
--- trunk/reactos/subsys/system/explorer/shell/unixfs.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/shell/unixfs.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -161,7 +161,7 @@
int level = 0;
size_t len = 0;
- if ( !path || 0 == path_count )
+ if (!path || path_count==0)
return false;
if ( path_count > 1 )
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -282,7 +282,7 @@
NMTTDISPINFO* ttdi = (NMTTDISPINFO*) pnmh;
int id = ttdi->hdr.idFrom;
- ttdi->lpszText = (LPTSTR)_entries[id]._title.c_str();
+ ttdi->lpszText = _entries[id]._title.str();
#ifdef TTF_DI_SETITEM
ttdi->uFlags |= TTF_DI_SETITEM;
#endif
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/taskbar/startmenu.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -257,9 +257,7 @@
*ignore_name = '\0';
String lwr_filter = _create_info._filter;
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr((LPTSTR)lwr_filter.c_str());
-#endif
+ lwr_filter.toLower();
int cnt = 0;
for(Entry*entry=dir._down; entry; entry=entry->_next) {
@@ -281,10 +279,8 @@
String lwr_name = entry->_data.cFileName;
String lwr_disp = entry->_display_name;
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr((LPTSTR)lwr_name.c_str());
- _tcslwr((LPTSTR)lwr_disp.c_str());
-#endif
+ lwr_name.toLower();
+ lwr_disp.toLower();
if (!_tcsstr(lwr_name,lwr_filter) &&
!_tcsstr(lwr_disp,lwr_filter))
continue;
@@ -1548,7 +1544,6 @@
try {
// insert directory "<user name>\Start Menu"
-
ShellDirectory usr_startmenu(GetDesktopFolder(),
SpecialFolderPath(CSIDL_STARTMENU, _hwnd), _hwnd);
_dirs.push_back(StartMenuDirectory(usr_startmenu,
(LPCTSTR)SpecialFolderFSPath(CSIDL_PROGRAMS, _hwnd)));
} catch(COMException&) {
@@ -2217,9 +2212,7 @@
super::AddEntries();
String lwr_filter = _create_info._filter;
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr((LPTSTR)lwr_filter.c_str());
-#endif
+ lwr_filter.toLower();
for(BookmarkList::iterator it=_bookmarks.begin();
it!=_bookmarks.end(); ++it) {
BookmarkNode& node = *it;
@@ -2246,11 +2239,9 @@
String lwr_desc = bookmark._description;
String lwr_url = bookmark._url;
-#ifndef __WINE__ ///@todo _tcslwr() for Wine
- _tcslwr((LPTSTR)lwr_name.c_str());
- _tcslwr((LPTSTR)lwr_desc.c_str());
- _tcslwr((LPTSTR)lwr_url.c_str());
-#endif
+ lwr_name.toLower();
+ lwr_desc.toLower();
+ lwr_url.toLower();
if (!_tcsstr(lwr_name,lwr_filter) &&
!_tcsstr(lwr_desc,lwr_filter) && !_tcsstr(lwr_url,lwr_filter))
continue;
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp
2005-11-01 20:30:17 UTC (rev 18937)
@@ -555,7 +555,7 @@
static ResString
sShowIcons(IDS_SHOW_HIDDEN_ICONS);
static ResString sHideIcons(IDS_HIDE_ICONS);
- pdi->lpszText = (LPTSTR)(_show_hidden?
sHideIcons: sShowIcons).c_str();
+ pdi->lpszText = (_show_hidden? sHideIcons:
sShowIcons).str();
} else {
NotifyIconSet::iterator found = IconHitTest(pt);
@@ -565,7 +565,7 @@
// enable multiline tooltips (break at
CR/LF and for very long one-line strings)
SendMessage(pnmh->hwndFrom,
TTM_SETMAXTIPWIDTH, 0, 400);
- pdi->lpszText =
(LPTSTR)entry._tipText.c_str();
+ pdi->lpszText = entry._tipText.str();
}
}
}
@@ -974,24 +974,24 @@
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
ResString str_cur(IDS_ITEMS_CUR);
- tv.pszText = (LPTSTR)str_cur.c_str();
+ tv.pszText = str_cur.str();
tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
_hitemCurrent = TreeView_InsertItem(_tree_ctrl, &tvi);
ResString str_conf(IDS_ITEMS_CONFIGURED);
- tv.pszText = (LPTSTR)str_conf.c_str();
+ tv.pszText = str_conf.str();
tv.iSelectedImage = tv.iImage = 2; // IDI_DOT_RED
_hitemConfig = TreeView_InsertItem(_tree_ctrl, &tvi);
tvi.hParent = _hitemCurrent;
ResString str_visible(IDS_ITEMS_VISIBLE);
- tv.pszText = (LPTSTR)str_visible.c_str();
+ tv.pszText = str_visible.str();
tv.iSelectedImage = tv.iImage = 0; // IDI_DOT
_hitemCurrent_visible = TreeView_InsertItem(_tree_ctrl, &tvi);
ResString str_hidden(IDS_ITEMS_HIDDEN);
- tv.pszText = (LPTSTR)str_hidden.c_str();
+ tv.pszText = str_hidden.str();
tv.iSelectedImage = tv.iImage = 1; // IDI_DOT_TRANS
_hitemCurrent_hidden = TreeView_InsertItem(_tree_ctrl, &tvi);
@@ -1075,7 +1075,7 @@
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tv.lParam = (LPARAM)idx;
- tv.pszText = (LPTSTR)txt.c_str();
+ tv.pszText = txt.str();
tv.iSelectedImage = tv.iImage = ImageList_AddAlphaIcon(_himl,
hicon, GetStockBrush(WHITE_BRUSH), hdc);
(void)TreeView_InsertItem(_tree_ctrl, &tvi);
}
_____
Modified: trunk/reactos/subsys/system/explorer/utility/utility.h
--- trunk/reactos/subsys/system/explorer/utility/utility.h
2005-11-01 18:53:37 UTC (rev 18936)
+++ trunk/reactos/subsys/system/explorer/utility/utility.h
2005-11-01 20:30:17 UTC (rev 18937)
@@ -798,6 +798,8 @@
operator wstring() const {WCHAR b[BUFFER_LEN]; return wstring(b,
MultiByteToWideChar(CP_ACP, 0, c_str(), -1, b, BUFFER_LEN)-1);}
#endif
+ LPTSTR str() {return (LPTSTR)data();} /// return modifyable
character string pointer
+
String& printf(LPCTSTR fmt, ...)
{
va_list l;
@@ -839,6 +841,12 @@
return *this;
}
+
+ void toLower()
+ {
+ if (!empty())
+ CharLower(str());
+ }
};
#define _STRING_DEFINED