diff options
| author | Johannes Schickel | 2012-03-29 02:05:45 +0200 | 
|---|---|---|
| committer | Johannes Schickel | 2012-03-29 02:05:45 +0200 | 
| commit | 7414544121bacef05eb6c4e9a1cf63f225db84be (patch) | |
| tree | 1292eb0f82fbacabcb1e60da4c73faef6b9fc344 | |
| parent | 988c3fd6c5d77b711c449a79693ba9981289e721 (diff) | |
| download | scummvm-rg350-7414544121bacef05eb6c4e9a1cf63f225db84be.tar.gz scummvm-rg350-7414544121bacef05eb6c4e9a1cf63f225db84be.tar.bz2 scummvm-rg350-7414544121bacef05eb6c4e9a1cf63f225db84be.zip  | |
GUI: Constify some parameters/methods in PredictiveDialog.
| -rw-r--r-- | gui/predictivedialog.cpp | 12 | ||||
| -rw-r--r-- | gui/predictivedialog.h | 8 | 
2 files changed, 10 insertions, 10 deletions
diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index 6f52f0a1d4..7d5181c9e2 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -579,9 +579,9 @@ void PredictiveDialog::mergeDicts() {  	}  } -uint8 PredictiveDialog::countWordsInString(char *str) { +uint8 PredictiveDialog::countWordsInString(const char *const str) {  	// Count the number of (space separated) words in the given string. -	char *ptr; +	const char *ptr;  	if (!str)  		return 0; @@ -630,7 +630,7 @@ void PredictiveDialog::bringWordtoTop(char *str, int wordnum) {  	memcpy(str, tmp.c_str(), strlen(str));  } -int PredictiveDialog::binarySearch(char **dictLine, const Common::String &code, int dictLineCount) { +int PredictiveDialog::binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount) {  	int hi = dictLineCount - 1;  	int lo = 0;  	int line = 0; @@ -691,11 +691,11 @@ bool PredictiveDialog::matchWord() {  	}  } -bool PredictiveDialog::searchWord(char *where, const Common::String &whatCode) { -	char *ptr = where; +bool PredictiveDialog::searchWord(const char *const where, const Common::String &whatCode) { +	const char *ptr = where;  	ptr += whatCode.size(); -	char *newPtr; +	const char *newPtr;  	bool is = false;  	while ((newPtr = strchr(ptr, ' '))) {  		if (0 == strncmp(ptr, _currentWord.c_str(), newPtr - ptr)) { diff --git a/gui/predictivedialog.h b/gui/predictivedialog.h index 792e744ab6..32de36d5f2 100644 --- a/gui/predictivedialog.h +++ b/gui/predictivedialog.h @@ -71,7 +71,7 @@ public:  	virtual void handleKeyDown(Common::KeyState state);  	virtual void handleTickle(); -	char *getResult() { return _predictiveResult; } +	const char *getResult() const { return _predictiveResult; }  private:  	struct Dict {  		char **dictLine; @@ -83,14 +83,14 @@ private:  		Common::String fnameDict;  	}; -	uint8 countWordsInString(char *str); +	uint8 countWordsInString(const char *const str);  	void bringWordtoTop(char *str, int wordnum);  	void loadDictionary(Common::SeekableReadStream *in, Dict &dict);  	void loadAllDictionary(Dict &dict);  	void addWordToDict();  	void addWord(Dict &dict, const Common::String &word, const Common::String &code); -	bool searchWord(char *where, const Common::String &whatCode); -	int binarySearch(char **dictLine, const Common::String &code, int dictLineCount); +	bool searchWord(const char *const where, const Common::String &whatCode); +	int binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount);  	bool matchWord();  	void processBtnActive(ButtonId active);  	void pressEditText();  | 
