diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-17 16:51:49 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-17 16:51:49 +0300 |
commit | 63bb7d10c06fd8747412e76572647577e74a4bb5 (patch) | |
tree | 57587a87cc0ef69d8769d9eb25014da5abf7f942 | |
parent | db6b5a4bfa73b7fa4bc1a99f14d569b6f45c8275 (diff) |
neglection of const might easily cause problems
-rw-r--r-- | libs/hunspell/src/affentry.hxx | 4 | ||||
-rw-r--r-- | plugins/SpellChecker/src/utils.cpp | 22 | ||||
-rw-r--r-- | plugins/SpellChecker/src/version.h | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/libs/hunspell/src/affentry.hxx b/libs/hunspell/src/affentry.hxx index 4bafc043f4..535a96bc42 100644 --- a/libs/hunspell/src/affentry.hxx +++ b/libs/hunspell/src/affentry.hxx @@ -118,7 +118,7 @@ class PfxEntry : public AffEntry { const char* getKey() { return appnd.c_str(); } std::string add(const char* word, size_t len); - inline short getKeyLen() { return appnd.size(); } + inline short getKeyLen() { return (short)appnd.size(); } inline const char* getMorph() { return morphcode; } @@ -199,7 +199,7 @@ class SfxEntry : public AffEntry { inline short getContLen() { return contclasslen; } inline const char* getAffix() { return appnd.c_str(); } - inline short getKeyLen() { return appnd.size(); } + inline short getKeyLen() { return (short)appnd.size(); } inline SfxEntry* getNext() { return next; } inline SfxEntry* getNextNE() { return nextne; } diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index e87ab53616..dcb004a245 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-typedef void(*FoundWrongWordCallback)(wchar_t *word, CHARRANGE pos, void *param);
+typedef void(*FoundWrongWordCallback)(const wchar_t *word, CHARRANGE pos, void *param);
typedef map<HWND, Dialog *> DialogMapType;
DialogMapType dialogs;
@@ -276,7 +276,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, int errors = 0;
wchar_t text[1024];
dlg->re->GetLine(line, text, _countof(text));
- int len = mir_wstrlen(text);
+ int len = (int)mir_wstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
// Now lets get the words
@@ -365,7 +365,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, if (dif != 0) {
// Read line again
dlg->re->GetLine(line, text, _countof(text));
- len = mir_wstrlen(text);
+ len = (int)mir_wstrlen(text);
int old_first_char = first_char;
first_char = dlg->re->GetFirstCharOfLine(line);
@@ -1021,15 +1021,15 @@ wchar_t* GetWordUnderPoint(Dialog *dlg, POINT pt, CHARRANGE &sel) return mir_wstrdup(&text[sel.cpMin - first_char]);
}
-void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, wchar_t *name)
+void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, const wchar_t *name)
{
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU | MIIM_TYPE;
mii.fType = MFT_STRING;
mii.hSubMenu = hSubMenu;
- mii.dwTypeData = name;
- mii.cch = mir_wstrlen(name);
+ mii.dwTypeData = (LPWSTR)name;
+ mii.cch = (int)mir_wstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1047,7 +1047,7 @@ void AppendMenuItem(HMENU hMenu, int id, wchar_t *name, HICON hIcon, BOOL checke mii.hbmpChecked = iconInfo.hbmColor;
mii.hbmpUnchecked = iconInfo.hbmColor;
mii.dwTypeData = name;
- mii.cch = mir_wstrlen(name);
+ mii.cch = (int)mir_wstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1055,7 +1055,7 @@ void AppendMenuItem(HMENU hMenu, int id, wchar_t *name, HICON hIcon, BOOL checke #define WORD_MENU_ID_BASE 100
#define AUTOREPLACE_MENU_ID_BASE 50
-void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOOL in_submenu, UINT base)
+void AddMenuForWord(Dialog *dlg, const wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOOL in_submenu, UINT base)
{
if (dlg->wrong_words == nullptr)
dlg->wrong_words = new vector<WrongWordPopupMenuData>(1);
@@ -1066,7 +1066,7 @@ void AddMenuForWord(Dialog *dlg, wchar_t *word, CHARRANGE &pos, HMENU hMenu, BOO memset(&data, 0, sizeof(WrongWordPopupMenuData));
// Get suggestions
- data.word = word;
+ data.word = _wcsdup(word);
data.pos = pos;
data.suggestions = dlg->lang->suggest(word);
@@ -1122,7 +1122,7 @@ struct FoundWrongWordParam int count;
};
-void FoundWrongWord(wchar_t *word, CHARRANGE pos, void *param)
+void FoundWrongWord(const wchar_t *word, CHARRANGE pos, void *param)
{
FoundWrongWordParam *p = (FoundWrongWordParam*)param;
@@ -1542,7 +1542,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) wchar_t* lstrtrim(wchar_t *str)
{
- int len = mir_wstrlen(str);
+ int len = (int)mir_wstrlen(str);
int i;
for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i);
diff --git a/plugins/SpellChecker/src/version.h b/plugins/SpellChecker/src/version.h index 3aa2f41b06..dd807a953e 100644 --- a/plugins/SpellChecker/src/version.h +++ b/plugins/SpellChecker/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 6 -#define __BUILD_NUM 4 +#define __BUILD_NUM 5 #include <stdver.h> |