Skip to content

Commit 6714f2c

Browse files
committed
Increase warning level and fix warnings
Signed-off-by: Sven Strickroth <[email protected]>
1 parent 5a6b134 commit 6714f2c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ if(MSVC)
3131
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
3232
endif(MSVC)
3333

34+
# enable all warnings
35+
if(MSVC)
36+
add_compile_options(/W4)
37+
endif(MSVC)
38+
3439
## section: source files
3540
set(NppEditorConfig_SOURCE_FILES
3641
./DlgAbout.cpp

src/NppPluginEditorConfig.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern FuncItem funcItem[nbFunc];
2424

2525
BOOL APIENTRY DllMain(HANDLE hModule,
2626
DWORD reasonForCall,
27-
LPVOID lpReserved)
27+
LPVOID)
2828
{
2929
switch (reasonForCall)
3030
{
@@ -84,8 +84,7 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
8484
// Please let me know if you need to access to some messages :
8585
// http://sourceforge.net/forum/forum.php?forum_id=482781
8686
//
87-
extern "C" __declspec(dllexport) LRESULT messageProc(UINT message,
88-
WPARAM wParam, LPARAM lParam)
87+
extern "C" __declspec(dllexport) LRESULT messageProc(UINT, WPARAM, LPARAM)
8988
{
9089
return TRUE;
9190
}

src/PluginDefinition.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ void insertFinalNewline(bool insert)
215215
return;
216216

217217
// Get the last line number
218-
int lastLine = SendMessage(curScintilla, SCI_GETLINECOUNT, 0, 0) - 1;
218+
intptr_t lastLine = ::SendMessage(curScintilla, SCI_GETLINECOUNT, 0, 0) - 1;
219219

220220
// Get the length of that last line
221-
int length = SendMessage(curScintilla, SCI_LINELENGTH, lastLine, 0);
221+
intptr_t length = ::SendMessage(curScintilla, SCI_LINELENGTH, lastLine, 0);
222222

223223
// Do we need to insert a final newline?
224224
if (insert)
@@ -230,7 +230,7 @@ void insertFinalNewline(bool insert)
230230
// What type of EOL must be inserted?
231231
char eolBuf[10];
232232
eolBuf[0] = 0;
233-
int eolMode = SendMessage(curScintilla, SCI_GETEOLMODE, 0, 0);
233+
int eolMode = static_cast<int>(::SendMessage(curScintilla, SCI_GETEOLMODE, 0, 0));
234234
switch (eolMode)
235235
{
236236
case SC_EOL_CRLF:
@@ -258,7 +258,7 @@ void insertFinalNewline(bool insert)
258258

259259
// Find the last non-newline character
260260
length = SendMessage(curScintilla, SCI_GETTEXTLENGTH, 0, 0);
261-
int pos = length;
261+
intptr_t pos = length;
262262
while (pos > 0 && isNewline((char) SendMessage(curScintilla, SCI_GETCHARAT, pos - 1, 0)))
263263
pos--;
264264

@@ -340,7 +340,7 @@ void onBeforeSave(HWND hWnd)
340340
// Save the folding behavior and set it to 0 to keep folds from opening
341341
// when modifying the file.
342342
HWND curScintilla = getCurrentScintilla();
343-
int automatic_fold = SendMessage(curScintilla, SCI_GETAUTOMATICFOLD, 0, 0);
343+
int automatic_fold = static_cast<int>(::SendMessage(curScintilla, SCI_GETAUTOMATICFOLD, 0, 0));
344344
SendMessage(curScintilla, SCI_SETAUTOMATICFOLD, 0, 0);
345345

346346
// Trailing whitespace needs to be trimmed before 'insert_final_newline' is

0 commit comments

Comments
 (0)