Le 15/07/2015 22:50, Stephan Witt a écrit :
Hi,

there is a ticket 9496 for the LFUN thesaurus-entry.
I'd like to apply the attached patch to improve the check
to solve the reported issue. Would this be acceptable?

+       
+Language const * Text::getLanguage(Cursor const & cur, FuncRequest const & cmd, int cmdpos) const {
+       string lang = cmd.getArg(cmdpos);
+       if (lang.empty()) {
+               return const_cast<Language *>(cur.getFont().language());
+       }
+       return const_cast<Language *>(languages.getLanguage(lang));
+}
+

Replace this Text method by a static function, it does not access Text. Lose the const_cast. The gain of passing the language as a lfun and an argument number is dubious.

The result would be like:

=====================
namespace {

Language const * getLanguage(Cursor const & cur, string const & lang) {
return lang.empty() ? cur.getFont().language() : languages.getLanguage(lang);
}

}
======================

I do not have any comment on the remainder of the patch.

JMarc

Reply via email to