Skip to content

Commit 8989f81

Browse files
authored
Merge pull request #66 from csware/warnings
Increase warning level and fix warnings
2 parents 063287e + 6714f2c commit 8989f81

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
@@ -216,10 +216,10 @@ void insertFinalNewline(bool insert)
216216
return;
217217

218218
// Get the last line number
219-
int lastLine = SendMessage(curScintilla, SCI_GETLINECOUNT, 0, 0) - 1;
219+
intptr_t lastLine = ::SendMessage(curScintilla, SCI_GETLINECOUNT, 0, 0) - 1;
220220

221221
// Get the length of that last line
222-
int length = SendMessage(curScintilla, SCI_LINELENGTH, lastLine, 0);
222+
intptr_t length = ::SendMessage(curScintilla, SCI_LINELENGTH, lastLine, 0);
223223

224224
// Do we need to insert a final newline?
225225
if (insert)
@@ -231,7 +231,7 @@ void insertFinalNewline(bool insert)
231231
// What type of EOL must be inserted?
232232
char eolBuf[10];
233233
eolBuf[0] = 0;
234-
int eolMode = SendMessage(curScintilla, SCI_GETEOLMODE, 0, 0);
234+
int eolMode = static_cast<int>(::SendMessage(curScintilla, SCI_GETEOLMODE, 0, 0));
235235
switch (eolMode)
236236
{
237237
case SC_EOL_CRLF:
@@ -259,7 +259,7 @@ void insertFinalNewline(bool insert)
259259

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

@@ -353,7 +353,7 @@ void onBeforeSave(HWND hWnd, uptr_t idFrom)
353353
// Save the folding behavior and set it to 0 to keep folds from opening
354354
// when modifying the file.
355355
HWND curScintilla = getCurrentScintilla();
356-
int automatic_fold = SendMessage(curScintilla, SCI_GETAUTOMATICFOLD, 0, 0);
356+
int automatic_fold = static_cast<int>(::SendMessage(curScintilla, SCI_GETAUTOMATICFOLD, 0, 0));
357357
SendMessage(curScintilla, SCI_SETAUTOMATICFOLD, 0, 0);
358358

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

0 commit comments

Comments
 (0)