GUI: Constify some parameters/methods in PredictiveDialog.

This commit is contained in:
Johannes Schickel 2012-03-29 02:05:45 +02:00
parent 988c3fd6c5
commit 7414544121
2 changed files with 10 additions and 10 deletions

View File

@ -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)) {

View File

@ -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();