Skip to content

Commit eaeea0b

Browse files
committed
Merge branch 'lint-fix-pass-1'
Conflicts: PythonScript/src/PythonHandler.cpp PythonScript/src/PythonScript.cpp Conflicts occurred due to Unicode paths changes in master branch that have not been linted.
2 parents fc8573e + a64304c commit eaeea0b

42 files changed

Lines changed: 1064 additions & 1202 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PythonScript/src/AboutDialog.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ class AboutDialog : public StaticDialog
1313
AboutDialog(void);
1414
~AboutDialog(void);
1515

16-
void init(HINSTANCE hInst, NppData& nppData);
16+
void initDialog(HINSTANCE hInst, NppData& nppData);
1717

1818
void doDialog();
19-
BOOL CALLBACK AboutDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
19+
20+
protected:
21+
BOOL CALLBACK run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
2022

2123
private:
2224
HBRUSH m_hbrBackground;
2325
};
2426

25-
#endif // _ABOUTDIALOG_H
27+
#endif // _ABOUTDIALOG_H

PythonScript/src/AboutDialog2.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ AboutDialog::AboutDialog(void)
1111

1212
AboutDialog::~AboutDialog(void)
1313
{
14+
if (m_hbrBackground)
15+
{
16+
DeleteObject(m_hbrBackground);
17+
m_hbrBackground = NULL;
18+
}
1419
}
1520

1621
void AboutDialog::doDialog()
@@ -59,7 +64,7 @@ BOOL CALLBACK AboutDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, L
5964
{
6065
case IDOK :
6166
case IDCANCEL :
62-
display(FALSE);
67+
display(false);
6368
return TRUE;
6469

6570
default :
@@ -74,7 +79,7 @@ BOOL CALLBACK AboutDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, L
7479

7580
}
7681

77-
void AboutDialog::init( HINSTANCE hInst, NppData& nppData )
82+
void AboutDialog::initDialog( HINSTANCE hInst, NppData& nppData )
7883
{
7984
Window::init(hInst, nppData._nppHandle);
8085
}

PythonScript/src/ConfigFile.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include "resource.h"
55
#include "WcharMbcsConverter.h"
66

7-
using namespace std;
8-
97
ConfigFile* ConfigFile::s_instance;
108

119
ConfigFile* ConfigFile::create(const TCHAR *configDir, const TCHAR *pluginDir, HINSTANCE hInst)
@@ -34,6 +32,7 @@ ConfigFile::ConfigFile(const TCHAR *configDir, const TCHAR *pluginDir, HINSTANCE
3432

3533
ConfigFile::~ConfigFile()
3634
{
35+
m_hInst = NULL;
3736
// TODO: Clean up
3837
// DeleteImage
3938
//
@@ -43,7 +42,7 @@ ConfigFile::~ConfigFile()
4342

4443
void ConfigFile::readConfig()
4544
{
46-
basic_ifstream<TCHAR> startupFile(m_configFilename.c_str());
45+
std::basic_ifstream<TCHAR> startupFile(m_configFilename.c_str());
4746

4847
TCHAR buffer[500];
4948

@@ -63,7 +62,7 @@ void ConfigFile::readConfig()
6362
{
6463
element = _tcstok_s(NULL, _T("/"), &context);
6564
m_menuItems.push_back(tstring(element));
66-
m_menuScripts.push_back(string(WcharMbcsConverter::tchar2char(element).get()));
65+
m_menuScripts.push_back(std::string(WcharMbcsConverter::tchar2char(element).get()));
6766
}
6867

6968
// Toolbar item
@@ -82,13 +81,13 @@ void ConfigFile::readConfig()
8281
}
8382

8483

85-
m_toolbarItems.push_back(pair<tstring, pair<HBITMAP, tstring> >(tstring(element), pair<HBITMAP, tstring>(hIcon, iconPath ? tstring(iconPath) : tstring())));
84+
m_toolbarItems.push_back(std::pair<tstring, std::pair<HBITMAP, tstring> >(tstring(element), std::pair<HBITMAP, tstring>(hIcon, iconPath ? tstring(iconPath) : tstring())));
8685
}
8786
else if (0 == _tcscmp(element, _T("SETTING")))
8887
{
8988
element = _tcstok_s(NULL, _T("/"), &context);
9089
TCHAR *settingValue = _tcstok_s(NULL, _T("/"), &context);
91-
m_settings.insert(pair<tstring, tstring>(tstring(element), tstring(settingValue)));
90+
m_settings.insert(std::pair<tstring, tstring>(tstring(element), tstring(settingValue)));
9291
}
9392
}
9493

@@ -105,7 +104,7 @@ void ConfigFile::clearItems()
105104

106105
void ConfigFile::save()
107106
{
108-
basic_ofstream<TCHAR> startupFile(m_configFilename.c_str(), ios_base::out | ios_base::trunc);
107+
std::basic_ofstream<TCHAR> startupFile(m_configFilename.c_str(), std::ios_base::out | std::ios_base::trunc);
109108
for(MenuItemsTD::iterator it = m_menuItems.begin(); it != m_menuItems.end(); ++it)
110109
{
111110
startupFile << "ITEM/" << (*it) << "\n";
@@ -129,13 +128,13 @@ void ConfigFile::save()
129128
void ConfigFile::addMenuItem(const tstring scriptPath)
130129
{
131130
m_menuItems.push_back(scriptPath);
132-
m_menuScripts.push_back(string(WcharMbcsConverter::tchar2char(scriptPath.c_str()).get()));
131+
m_menuScripts.push_back(std::string(WcharMbcsConverter::tchar2char(scriptPath.c_str()).get()));
133132
}
134133

135134
void ConfigFile::addToolbarItem(const tstring scriptPath, const tstring iconPath)
136135
{
137136
HBITMAP hIcon = static_cast<HBITMAP>(LoadImage(m_hInst, iconPath.c_str(), IMAGE_BITMAP, 16, 16, LR_LOADMAP3DCOLORS));
138-
m_toolbarItems.push_back(pair<tstring, pair<HBITMAP, tstring> >(scriptPath, pair<HBITMAP, tstring>(hIcon, iconPath)));
137+
m_toolbarItems.push_back(std::pair<tstring, std::pair<HBITMAP, tstring> >(scriptPath, std::pair<HBITMAP, tstring>(hIcon, iconPath)));
139138
}
140139

141140
void ConfigFile::setSetting(const tstring& settingName, const tstring settingValue)

PythonScript/src/ConfigFile.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ class ConfigFile
3737
const tstring& getConfigDir() { return m_configDir; };
3838

3939
protected:
40-
explicit ConfigFile(const TCHAR *configDir);
4140
void readConfig();
4241

4342
private:
43+
ConfigFile(); // default constructor disabled
44+
4445
HINSTANCE m_hInst;
4546
static ConfigFile* s_instance;
4647

@@ -65,4 +66,4 @@ class ConfigFile
6566

6667
};
6768

68-
#endif
69+
#endif

PythonScript/src/ConsoleDialog.cpp

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include "PluginInterface.h"
99
#include "Docking.h"
1010

11-
using namespace std;
12-
1311
ConsoleDialog::ConsoleDialog()
1412
: DockingDlgInterface(IDD_CONSOLE),
1513
m_data(new tTbData),
@@ -41,7 +39,7 @@ ConsoleDialog::~ConsoleDialog()
4139
}
4240

4341

44-
void ConsoleDialog::init(HINSTANCE hInst, NppData& nppData, ConsoleInterface* console)
42+
void ConsoleDialog::initDialog(HINSTANCE hInst, NppData& nppData, ConsoleInterface* console)
4543
{
4644
DockingDlgInterface::init(hInst, nppData._nppHandle);
4745

@@ -69,7 +67,7 @@ void ConsoleDialog::init(HINSTANCE hInst, NppData& nppData, ConsoleInterface* co
6967

7068
}
7169

72-
BOOL ConsoleDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
70+
BOOL CALLBACK ConsoleDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
7371
{
7472
switch(message)
7573
{
@@ -134,7 +132,6 @@ BOOL ConsoleDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
134132
default:
135133
break;
136134
}
137-
break;
138135
}
139136
break;
140137
case WM_COMMAND:
@@ -146,7 +143,11 @@ BOOL ConsoleDialog::run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
146143
}
147144
else
148145
{
149-
m_console->stopStatement();
146+
assert(m_console != NULL);
147+
if (m_console)
148+
{
149+
m_console->stopStatement();
150+
}
150151
}
151152
//MessageBox(NULL, _T("Command") , _T("Python Command"), 0);
152153
return FALSE;
@@ -196,11 +197,11 @@ void ConsoleDialog::historyPrevious()
196197
{
197198
if (m_changes.find(m_currentHistory) == m_changes.end())
198199
{
199-
m_changes.insert(pair<int, string>(m_currentHistory, string(buffer)));
200+
m_changes.insert(std::pair<int, std::string>(m_currentHistory, std::string(buffer)));
200201
}
201202
else
202203
{
203-
m_changes[m_currentHistory] = string(buffer);
204+
m_changes[m_currentHistory] = std::string(buffer);
204205
}
205206
}
206207

@@ -236,11 +237,11 @@ void ConsoleDialog::historyNext()
236237
{
237238
if (m_changes.find(m_currentHistory) == m_changes.end())
238239
{
239-
m_changes.insert(pair<int, string>(m_currentHistory, string(buffer)));
240+
m_changes.insert(std::pair<int, std::string>(m_currentHistory, std::string(buffer)));
240241
}
241242
else
242243
{
243-
m_changes[m_currentHistory] = string(buffer);
244+
m_changes[m_currentHistory] = std::string(buffer);
244245
}
245246
}
246247

@@ -276,7 +277,7 @@ void ConsoleDialog::historyAdd(const char *line)
276277
{
277278
if (line && line[0])
278279
{
279-
m_history.push_back(string(line));
280+
m_history.push_back(std::string(line));
280281
m_currentHistory = m_history.size();
281282
}
282283

@@ -314,11 +315,9 @@ LRESULT ConsoleDialog::run_inputWndProc(HWND hWnd, UINT message, WPARAM wParam,
314315
historyNext();
315316
return FALSE;
316317

317-
318318
default:
319319
return CallWindowProc(m_originalInputWndProc, hWnd, message, wParam, lParam);
320320
}
321-
break;
322321

323322
case WM_KEYUP:
324323
switch(wParam)
@@ -334,31 +333,36 @@ LRESULT ConsoleDialog::run_inputWndProc(HWND hWnd, UINT message, WPARAM wParam,
334333
default:
335334
return CallWindowProc(m_originalInputWndProc, hWnd, message, wParam, lParam);
336335
}
337-
break;
338336

339337
default:
340338
return CallWindowProc(m_originalInputWndProc, hWnd, message, wParam, lParam);
341339
}
342-
343340
}
344341

345342
void ConsoleDialog::runStatement()
346343
{
347-
char buffer[1000];
348-
GetWindowTextA(::GetDlgItem(_hSelf, IDC_INPUT), buffer, 1000);
349-
historyAdd(buffer);
350-
writeText(m_prompt.size(), m_prompt.c_str());
351-
writeText(strlen(buffer), buffer);
352-
writeText(1, "\n");
353-
SetWindowTextA(::GetDlgItem(_hSelf, IDC_INPUT), "");
354-
m_console->runStatement(buffer);
355-
344+
assert(m_console != NULL);
345+
if (m_console)
346+
{
347+
char buffer[1000];
348+
GetWindowTextA(::GetDlgItem(_hSelf, IDC_INPUT), buffer, 1000);
349+
historyAdd(buffer);
350+
writeText(m_prompt.size(), m_prompt.c_str());
351+
writeText(strlen(buffer), buffer);
352+
writeText(1, "\n");
353+
SetWindowTextA(::GetDlgItem(_hSelf, IDC_INPUT), "");
354+
m_console->runStatement(buffer);
355+
}
356356
}
357357

358358

359359
void ConsoleDialog::stopStatement()
360360
{
361-
m_console->stopStatement();
361+
assert(m_console != NULL);
362+
if (m_console)
363+
{
364+
m_console->stopStatement();
365+
}
362366
}
363367

364368

@@ -489,7 +493,7 @@ void ConsoleDialog::writeError(int length, const char *text)
489493

490494
void ConsoleDialog::doDialog()
491495
{
492-
if (!isCreated())
496+
if (!isCreated())
493497
{
494498
create(m_data);
495499

@@ -519,7 +523,7 @@ void ConsoleDialog::doDialog()
519523
callScintilla(SCI_COLOURISE, 0, -1);
520524
}
521525

522-
display(true);
526+
display(true);
523527
}
524528

525529
void ConsoleDialog::hide()

PythonScript/src/ConsoleDialog.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ class ConsoleDialog : public DockingDlgInterface
1919
~ConsoleDialog();
2020

2121

22-
void init(HINSTANCE hInst, NppData& nppData, ConsoleInterface *console);
22+
void initDialog(HINSTANCE hInst, NppData& nppData, ConsoleInterface *console);
2323

2424
void doDialog();
2525
void hide();
2626

27-
BOOL CALLBACK run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
28-
2927
void writeText(int length, const char *text);
3028
void writeError(int length, const char *text);
3129
void clearText();
@@ -34,6 +32,8 @@ class ConsoleDialog : public DockingDlgInterface
3432

3533
void runEnabled(bool enabled);
3634

35+
protected:
36+
BOOL CALLBACK run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
3737

3838
private:
3939
void createOutputWindow(HWND hParentWindow);
@@ -100,4 +100,4 @@ struct LineDetails
100100
ErrorLevel errorLevel;
101101
};
102102

103-
#endif
103+
#endif

PythonScript/src/ConsoleInterface.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ class ConsoleInterface
1111
virtual void openFile(const char *filename, int lineNumber) = 0;
1212
};
1313

14-
15-
#endif
14+
#endif

0 commit comments

Comments
 (0)