diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-26 22:32:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-27 12:34:24 +0100 |
commit | fcd9b06ac744b1c709ab754a123bad64405dabc9 (patch) | |
tree | a35163b9d7bbcc46609ac56d00131b4862381dff /lingucomponent/source/languageguessing/simpleguesser.cxx | |
parent | dd32608012fdd017ab8ad303cca2453f2f8dcbd7 (diff) |
constify some of this
Diffstat (limited to 'lingucomponent/source/languageguessing/simpleguesser.cxx')
-rw-r--r-- | lingucomponent/source/languageguessing/simpleguesser.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx index eab9f2ae16a6..0b8e59f7783c 100644 --- a/lingucomponent/source/languageguessing/simpleguesser.cxx +++ b/lingucomponent/source/languageguessing/simpleguesser.cxx @@ -112,7 +112,7 @@ SimpleGuesser::~SimpleGuesser() /*! \fn SimpleGuesser::GuessLanguage(char* text) */ -vector<Guess> SimpleGuesser::GuessLanguage(char* text) +vector<Guess> SimpleGuesser::GuessLanguage(const char* text) { vector<Guess> guesses; @@ -125,7 +125,7 @@ vector<Guess> SimpleGuesser::GuessLanguage(char* text) if (len > MAX_STRING_LENGTH_TO_ANALYSE) len = MAX_STRING_LENGTH_TO_ANALYSE; - char *guess_list = textcat_Classify(h, text, len); + const char *guess_list = textcat_Classify(h, text, len); if (strcmp(guess_list, _TEXTCAT_RESULT_SHORT) == 0) return guesses; @@ -134,11 +134,11 @@ vector<Guess> SimpleGuesser::GuessLanguage(char* text) for(int i = 0; guess_list[current_pointer] != '\0'; i++) { - while(guess_list[current_pointer] != GUESS_SEPARATOR_OPEN && guess_list[current_pointer] != '\0') + while (guess_list[current_pointer] != GUESS_SEPARATOR_OPEN && guess_list[current_pointer] != '\0') current_pointer++; if(guess_list[current_pointer] != '\0') { - Guess g((char*)(guess_list + current_pointer)); + Guess g(guess_list + current_pointer); guesses.push_back(g); @@ -152,15 +152,12 @@ vector<Guess> SimpleGuesser::GuessLanguage(char* text) /*! \fn SimpleGuesser::GuessPrimaryLanguage(char* text) */ -Guess SimpleGuesser::GuessPrimaryLanguage(char* text) +Guess SimpleGuesser::GuessPrimaryLanguage(const char* text) { vector<Guess> ret = GuessLanguage(text); - if(!ret.empty()){ + if (!ret.empty()) return GuessLanguage(text)[0]; - } - else{ - return Guess(); - } + return Guess(); } /** * Is used to know wich language is available, unavailable or both |