Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make VS2010 happy #165

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BagOValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BagOValues
{
wstring lowered;
lowered.resize(query.size());
transform(std::cbegin(query), std::cend(query), std::begin(lowered), ::tolower);
transform(std::begin(query), std::end(query), std::begin(lowered), ::tolower);

vector<TValue> results;
TValue val = TValue();
Expand Down
8 changes: 4 additions & 4 deletions src/treectl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2117,16 +2117,16 @@ TreeControlWndProc(
#define fDontSelChange HIWORD(wParam)
#define szDir (LPTSTR)lParam // NULL -> default == window text.

RECT rc;
DWORD i;
PDNODE pNode;

//
// Don't do anything while the tree is being built.
//
if (GetWindowLongPtr(hwnd, GWL_READLEVEL))
break;

RECT rc;
DWORD i;
PDNODE pNode;

// do the same as TC_SETDIRECTORY above for the simple case
if (FindItemFromPath(hwndLB, (LPTSTR)lParam, 0, &i, &pNode))
{
Expand Down
9 changes: 6 additions & 3 deletions src/wfcomman.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,12 @@ CreateDirWindow(
// Are we replacing the contents of the currently active child?
//
if (bReplaceOpen) {
INT i = 0;
DRIVE drive;
CharUpperBuff(szPath, 1); // make sure

DRIVE drive = DRIVEID(szPath);
for (INT i = 0; i<cDrives; i++)
drive = DRIVEID(szPath);
for (i = 0; i<cDrives; i++)
{
if (drive == rgiDrive[i])
{
Expand Down Expand Up @@ -792,6 +794,7 @@ FmifsLoaded()
BOOL
GetPowershellExePath(LPTSTR szPSPath)
{
int ikey = 0;
HKEY hkey;
if (ERROR_SUCCESS != RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\PowerShell"), &hkey))
{
Expand All @@ -800,7 +803,7 @@ GetPowershellExePath(LPTSTR szPSPath)

szPSPath[0] = TEXT('\0');

for (int ikey = 0; ikey < 5; ikey++)
for (ikey = 0; ikey < 5; ikey++)
{
TCHAR szSub[10]; // just the "1" or "3"

Expand Down
7 changes: 4 additions & 3 deletions src/wfdlgs.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,15 +705,16 @@ ConfirmDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)

INT_PTR CALLBACK PrefDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
OPENFILENAME ofn;
HWND hLangComboBox;

/* Editor prefrence variables*/
TCHAR szTempEditPath[MAX_PATH];
TCHAR szPath[MAX_PATH];
TCHAR szFilter[MAX_PATH] = { 0 };

LoadString(hAppInstance, IDS_EDITFILTER, szFilter, MAX_PATH);

OPENFILENAME ofn;

ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
Expand All @@ -728,7 +729,7 @@ INT_PTR CALLBACK PrefDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

/* Language prefrence variables */
HWND hLangComboBox = GetDlgItem(hDlg, IDC_LANGCB);
hLangComboBox = GetDlgItem(hDlg, IDC_LANGCB);

switch (wMsg)
{
Expand Down
35 changes: 25 additions & 10 deletions src/wfgoto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool CompareNodes(const PDNODE& a, const PDNODE& b)
vector<PDNODE> FilterBySubtree(vector<PDNODE> const& parents, vector<PDNODE> const& children)
{
vector<PDNODE> results;

#if 0
// for each child, if parent in parents, return
std::copy_if(std::cbegin(children),
std::cend(children),
Expand All @@ -109,7 +109,15 @@ vector<PDNODE> FilterBySubtree(vector<PDNODE> const& parents, vector<PDNODE> co
PDNODE parent = child->pParent;
return (find(std::cbegin(parents), std::cend(parents), parent) != std::end(parents));
});

#else
vector<PDNODE>::const_iterator it;
for(it=children.begin(); it!=children.end(); it++) {
PDNODE parent = (*it)->pParent;
if (find(std::begin(parents), std::end(parents), parent) != std::end(parents)) {
results.push_back(parent);
}
}
#endif
return results;
}

Expand All @@ -121,12 +129,14 @@ vector<PDNODE> TreeIntersection(vector<vector<PDNODE>>& trees)
return result;

// If any tree is empty, return empty
if (std::any_of(std::cbegin(trees), std::cend(trees), [](auto& tree) { return tree.size() == 0; }))
if (std::any_of(std::begin(trees), std::end(trees), [](vector<PDNODE>& tree) { return tree.size() == 0; }))
return result;

size_t maxOutput = 0;
for (auto& tree : trees)
vector<vector<PDNODE> >::iterator it;
for (it=trees.begin(); it!=trees.end(); it++) // (auto& tree : trees)
{
vector<PDNODE>& tree = *it;
sort(tree.begin(), tree.end(), CompareNodes);
if (tree.size() > maxOutput)
maxOutput = tree.size();
Expand Down Expand Up @@ -282,8 +292,10 @@ vector<wstring> SplitIntoWords(LPCTSTR szText)
void FreeDirectoryBagOValues(BagOValues<PDNODE> *pbov, vector<PDNODE> *pNodes)
{
// free all PDNODE in BagOValues
for (PDNODE p : *pNodes)
vector<PDNODE>::iterator it;
for (it=(*pNodes).begin(); it!=(*pNodes).end(); it++) // (PDNODE p : *pNodes)
{
PDNODE p = *it;
LocalFree(p);
}

Expand Down Expand Up @@ -361,9 +373,10 @@ BOOL BuildDirectoryBagOValues(BagOValues<PDNODE> *pbov, vector<PDNODE> *pNodes,

// if spaces, each word individually (and not whole thing)
vector<wstring> words = SplitIntoWords(lfndta.fd.cFileName);

for (auto word : words)
vector<wstring>::iterator it;
for (it=words.begin(); it!=words.end(); it++) // (auto word : words)
{
wstring &word = *it;
// TODO: how to mark which word is primary to avoid double free?
pbov->Add(word, pNodeChild);
}
Expand Down Expand Up @@ -399,14 +412,16 @@ BOOL BuildDirectoryBagOValues(BagOValues<PDNODE> *pbov, vector<PDNODE> *pNodes,
vector<PDNODE> GetDirectoryOptionsFromText(LPCTSTR szText, BOOL *pbLimited)
{
if (g_pBagOCDrive == nullptr)
return vector<PDNODE>{};
return vector<PDNODE>();

vector<wstring> words = SplitIntoWords(szText);

vector<vector<PDNODE>> options_per_word;

for (auto word : words)
vector<wstring>::iterator it;
for (it=words.begin(); it!=words.end(); it++) // (auto word : words)
{
wstring &word = *it;
vector<PDNODE> options;
size_t pos = word.find_first_of(L'\\');
if (pos == word.size() - 1)
Expand Down Expand Up @@ -697,4 +712,4 @@ StartBuildingDirectoryTrie()
CloseHandle(hThreadCopy);

return 0;
}
}
3 changes: 2 additions & 1 deletion src/wfloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ LPCTSTR szLCIDs[] = {

VOID InitLangList(HWND hCBox)
{
UINT i = 0;
// Propogate the list
for (UINT i = 0; i <= (COUNTOF(szLCIDs) - 1); i++)
for (i = 0; i <= (COUNTOF(szLCIDs) - 1); i++)
{
TCHAR szLangName[MAX_PATH] = { 0 };
LCID lcidTemp = LocaleNameToLCID(szLCIDs[i], 0);
Expand Down
3 changes: 2 additions & 1 deletion src/wfsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,10 @@ SearchWndProc(
return 0L;

if (wParam == CD_SEARCHUPDATE) {
int msg;
LoadString(hAppInstance, IDS_SEARCHTITLE, szTitle, COUNTOF(szTitle));
LoadString(hAppInstance, IDS_SEARCHREFRESH, szMessage, COUNTOF(szMessage));
int msg = MessageBox(hwnd, szMessage, szTitle, MB_ABORTRETRYIGNORE | MB_ICONQUESTION);
msg = MessageBox(hwnd, szMessage, szTitle, MB_ABORTRETRYIGNORE | MB_ICONQUESTION);

if (msg == IDABORT)
{
Expand Down
3 changes: 2 additions & 1 deletion src/wfutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ HistoryDir rghistoryDir[MAXHISTORY];
VOID
SaveHistoryDir(HWND hwnd, LPWSTR szDir)
{
DWORD historyT;
if (rghistoryDir[historyCur].hwnd == hwnd && lstrcmpi(rghistoryDir[historyCur].szDir, szDir) == 0)
return;

Expand All @@ -37,7 +38,7 @@ SaveHistoryDir(HWND hwnd, LPWSTR szDir)
lstrcpy(rghistoryDir[historyCur].szDir, szDir);

// always leave one NULL entry after current
DWORD historyT = (historyCur + 1) % MAXHISTORY;
historyT = (historyCur + 1) % MAXHISTORY;
rghistoryDir[historyT].hwnd = NULL;
rghistoryDir[historyT].szDir[0] = '\0';
}
Expand Down