reactos/dll/win32/shell32/folders/CFontsFolder.cpp
Joachim Henze f2aa852a77 [0.4.11][SHELL32] Backport format+logging-trivia, ARRAYSIZE/_countof
Picks various trivial improvements from newer branches, does not fix specific JIRA-tickets and also doesn't
*entirely* cover a specific PR, therefore none of those are mentioned here.
Main motivation is to reduce large scale white-noise diff between the branches, to make
future commits diffs (with some fixes that actually matter) smaller in size and therefore easier to review.

Specifically:
- large-scale formatting & logging improvements, including but not limited to 0.4.15-dev-7653-g 6f91b6c0fe
- strip trailing whitespace
- also typos like 'unkown', missing \n as it was
  part of 0.4.15-dev-6323-g 3854a5d8e9 and
  0.4.15-dev-4492-g 03422451b3
  (I left out the MOUSE_MOVE-one from that, because I consider the missing \n there intentional)
- ports back many usages of ARRAYSIZE/_countof as it was added as part of some commits from Hermes, e.g.:
  *partial* pick of 0.4.13-dev-622-g 8a30801516 and
  *partial* pick of 0.4.15-dev-3642-g 83be315abf (I left out the literals here for now, ...
    I *might* pick them later on their own, but not now. I first want to verify their isolated impact on all compilers generated file-sizes.
    Some of those changes would even increase the binary size, especially those where the same literal is used multiple times,
    because string-pooling is currently not enabled for all toolchains and configurations.)
- COpenWithMenu.cpp: strip double-semicolon
- COpenWithMenu.cpp && folder_options.cpp: add \n to some dbg-prints without increasing their length
- CFSDropTarget.cpp: add \n to some dbg-prints, strip some good-path-traces that are no longer present in master in return to avoid size increase, fix indentation
- CShellLink.cpp: add \n to some dbg-prints without increasing their length
- iconcache.cpp: fix wrong indentation

binary size of shell32.dll has tendency to shrink slightly, which is caused solely by the logging changes:

master          RosBEWin2.2.2 GCC8.4.0 dbg x86               10.538.496 (0.4.15-dev-7640-gbdcfc6b)
releases/0.4.14 RosBEWin2.2.2 GCC8.4.0 dbg x86  9.317.888 ->  9.316.684
releases/0.4.14 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.345.024 ->  9.345.024
releases/0.4.13 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.201.152 ->  9.200.640
releases/0.4.12 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.146.880 ->  9.146.880
releases/0.4.11 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.077.760 ->  9.077.248
releases/0.4.10 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.074.176 ->  9.072.128
releases/0.4. 9 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.825.856 ->  8.824.832
releases/0.4. 8 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.740.864 ->  8.738.816
releases/0.4. 7 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.668.160 ->  8.666.624
2024-02-25 01:44:57 +01:00

191 lines
5.8 KiB
C++

/*
* Fonts folder
*
* Copyright 2008 Johannes Anderwald <johannes.anderwald@reactos.org>
* Copyright 2009 Andrew Hill
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <precomp.h>
WINE_DEFAULT_DEBUG_CHANNEL (shell);
CFontsFolder::CFontsFolder()
{
m_pidlInner = NULL;
}
CFontsFolder::~CFontsFolder()
{
if(m_pidlInner)
SHFree(m_pidlInner);
}
HRESULT WINAPI CFontsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
{
return m_pisfInner->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl, pdwAttributes);
}
HRESULT WINAPI CFontsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
{
return m_pisfInner->EnumObjects(hwndOwner, dwFlags, ppEnumIDList);
}
HRESULT WINAPI CFontsFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
{
return m_pisfInner->BindToObject(pidl, pbcReserved, riid, ppvOut);
}
HRESULT WINAPI CFontsFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
{
return m_pisfInner->BindToStorage(pidl, pbcReserved, riid, ppvOut);
}
HRESULT WINAPI CFontsFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
{
return m_pisfInner->CompareIDs(lParam, pidl1, pidl2);
}
HRESULT WINAPI CFontsFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
{
return m_pisfInner->CreateViewObject(hwndOwner, riid, ppvOut);
}
HRESULT WINAPI CFontsFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
{
static const DWORD dwFontsAttributes =
SFGAO_STORAGE | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR |
SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
if(cidl)
return m_pisfInner->GetAttributesOf(cidl, apidl, rgfInOut);
if (!rgfInOut || !apidl)
return E_INVALIDARG;
if (*rgfInOut == 0)
*rgfInOut = ~0;
*rgfInOut &= dwFontsAttributes;
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
return S_OK;
}
HRESULT WINAPI CFontsFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
{
return m_pisfInner->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut);
}
HRESULT WINAPI CFontsFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
{
if (!strRet || !pidl)
return E_INVALIDARG;
/* If we got an fs item just forward to the fs folder */
if (!_ILIsSpecialFolder(pidl))
return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
/* The caller wants our path. Let fs folder handle it */
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
(GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
{
/* Give an empty pidl to the fs folder to tell us its path */
if (pidl->mkid.cb)
pidl = ILGetNext(pidl);
return m_pisfInner->GetDisplayNameOf(pidl, dwFlags, strRet);
}
ERR("Got empty pidl without SHGDN_FORPARSING\n");
return E_INVALIDARG;
}
HRESULT WINAPI CFontsFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /* simple pidl */
LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
{
return m_pisfInner->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
}
HRESULT WINAPI CFontsFolder::GetDefaultSearchGUID(GUID *pguid)
{
return m_pisfInner->GetDefaultSearchGUID(pguid);
}
HRESULT WINAPI CFontsFolder::EnumSearches(IEnumExtraSearch ** ppenum)
{
return m_pisfInner->EnumSearches(ppenum);
}
HRESULT WINAPI CFontsFolder::GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
{
return m_pisfInner->GetDefaultColumn(dwRes, pSort, pDisplay);
}
HRESULT WINAPI CFontsFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
{
return m_pisfInner->GetDefaultColumnState(iColumn, pcsFlags);
}
HRESULT WINAPI CFontsFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
{
return m_pisfInner->GetDetailsEx(pidl, pscid, pv);
}
HRESULT WINAPI CFontsFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
{
return m_pisfInner->GetDetailsOf(pidl, iColumn, psd);
}
HRESULT WINAPI CFontsFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
{
return m_pisfInner->MapColumnToSCID(column, pscid);
}
HRESULT WINAPI CFontsFolder::GetClassID(CLSID *lpClassId)
{
if (!lpClassId)
return E_POINTER;
*lpClassId = CLSID_FontsFolderShortcut;
return S_OK;
}
HRESULT WINAPI CFontsFolder::Initialize(LPCITEMIDLIST pidl)
{
m_pidlInner = ILClone(pidl);
if (!m_pidlInner)
return E_OUTOFMEMORY;
return SHELL32_CoCreateInitSF(m_pidlInner,
&CLSID_ShellFSFolder,
CSIDL_FONTS,
IID_PPV_ARG(IShellFolder2, &m_pisfInner));
}
HRESULT WINAPI CFontsFolder::GetCurFolder(LPITEMIDLIST *pidl)
{
if (!pidl)
return E_POINTER;
*pidl = ILClone(m_pidlInner);
return S_OK;
}