some small improvements

svn path=/trunk/; revision=7489
This commit is contained in:
Martin Fuchs 2004-01-06 21:27:28 +00:00
parent 769315c915
commit 38883fca0b
5 changed files with 23 additions and 28 deletions

View file

@ -172,12 +172,8 @@ void IconCache::init()
}
const Icon& IconCache::extract(String path)
const Icon& IconCache::extract(const String& path)
{
#ifndef __WINE__ ///@todo
_tcslwr((LPTSTR)path.c_str());
#endif
PathMap::iterator found = _pathMap.find(path);
if (found != _pathMap.end())

View file

@ -44,7 +44,7 @@ enum ICON_TYPE {
IT_STATIC,
IT_CACHED,
IT_DYNAMIC,
IT_SYSCACHE
IT_SYSCACHE ///@todo
};
enum ICON_ID {
@ -85,7 +85,7 @@ struct Icon {
struct IconCache {
void init();
const Icon& extract(String path);
const Icon& extract(const String& path);
const Icon& extract(LPCTSTR path, int idx);
const Icon& extract(IExtractIcon* pExtract, LPCTSTR path, int idx);

View file

@ -61,11 +61,13 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
if (SUCCEEDED(hr)) {
LPCTSTR path = (LPCTSTR)GlobalLock(medium.UNION_MEMBER(hGlobal));
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
// fill with drive names "C:", ...
assert(_tcslen(path) < GlobalSize(medium.UNION_MEMBER(hGlobal)));
_tcscpy(pw32fdata->cFileName, path);
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
if (GetFileAttributesEx(path, GetFileExInfoStandard, &fad)) {
pw32fdata->dwFileAttributes = fad.dwFileAttributes;
pw32fdata->ftCreationTime = fad.ftCreationTime;
@ -115,14 +117,13 @@ ShellPath ShellEntry::create_absolute_pidl() const
CONTEXT("ShellEntry::create_absolute_pidl()");
if (_up)
if (_up->_etype==ET_SHELL) {
if (_up->_etype == ET_SHELL) {
ShellDirectory* dir = static_cast<ShellDirectory*>(_up);
if (dir->_pidl->mkid.cb) // Caching of absolute PIDLs could enhance performance.
return _pidl.create_absolute_pidl(dir->create_absolute_pidl());
} else {
} else
return _pidl.create_absolute_pidl(_up->create_absolute_pidl());
}
return _pidl;
}
@ -138,13 +139,13 @@ bool ShellEntry::get_path(PTSTR path) const
return false;
*/
FileSysShellPath fs_path(create_absolute_pidl());
LPCTSTR ret = fs_path;
if (!(LPCTSTR)fs_path)
if (ret) {
_tcscpy(path, ret);
return true;
} else
return false;
_tcscpy(path, fs_path);
return true;
}

View file

@ -130,6 +130,8 @@ CommonDesktop::~CommonDesktop()
HRESULT path_from_pidlA(IShellFolder* folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
{
CONTEXT("path_from_pidlA()");
StrRetA str;
HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);

View file

@ -545,10 +545,9 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
{
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)");
if (path) {
ULONG l;
CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0));
} else
if (path)
CHECKERROR(folder->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0));
else
_p = NULL;
}
@ -556,10 +555,9 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
{
OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);
if (path) {
ULONG l;
CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, &l, &_p, 0));
} else
if (path)
CHECKERROR(Desktop()->ParseDisplayName(0, 0, (LPOLESTR)path, NULL, &_p, 0));
else
_p = NULL;
}
@ -567,12 +565,11 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
{
CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)");
ULONG l;
WCHAR b[MAX_PATH];
if (path) {
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH);
CHECKERROR(folder->ParseDisplayName(0, 0, b, &l, &_p, 0));
CHECKERROR(folder->ParseDisplayName(0, 0, b, NULL, &_p, 0));
} else
_p = NULL;
}
@ -581,12 +578,11 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
{
CONTEXT("ShellPath::ShellPath(LPCSTR)");
ULONG l;
WCHAR b[MAX_PATH];
if (path) {
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH);
CHECKERROR(Desktop()->ParseDisplayName(0, 0, b, &l, &_p, 0));
CHECKERROR(Desktop()->ParseDisplayName(0, 0, b, NULL, &_p, 0));
} else
_p = NULL;
}