summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2012-12-29 13:36:43 +0100
committerJulien Nabet <serval2412@yahoo.fr>2012-12-29 13:37:25 +0100
commitcf068828d334fcb0998755118e262d16c9db5b3a (patch)
treeca63d7c1e2b7099e7b038d8305a1b76800ceafe1 /lingucomponent
parent6306926e038fd7ad49c0089ebce8be0f0f8da3c7 (diff)
Fix SimpleGuesser::operator=' should return 'SimpleGuesser &
Change-Id: I29205bc8db7569cf123a52dd248a9165ebaef3a3
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/languageguessing/simpleguesser.cxx7
-rw-r--r--lingucomponent/source/languageguessing/simpleguesser.hxx6
2 files changed, 9 insertions, 4 deletions
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 1162884ef45a..b6d52cdba4be 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -95,9 +95,14 @@ SimpleGuesser::SimpleGuesser()
h = NULL;
}
-void SimpleGuesser::operator=(SimpleGuesser& sg){
+SimpleGuesser& SimpleGuesser::operator=(const SimpleGuesser& sg){
+ // Check for self-assignment!
+ if (this == &sg) // Same object?
+ return *this; // Yes, so skip assignment, and just return *this.
+
if(h){textcat_Done(h);}
h = sg.h;
+ return *this;
}
SimpleGuesser::~SimpleGuesser()
diff --git a/lingucomponent/source/languageguessing/simpleguesser.hxx b/lingucomponent/source/languageguessing/simpleguesser.hxx
index eed1af930f27..acf3ae30a550 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.hxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.hxx
@@ -37,10 +37,10 @@ public:
/**inits the object with conf file "./conf.txt"*/
SimpleGuesser();
- /** Compares the current Simpleguesser with an other
- * @param SimpleGuesser& sg the other guesser to compare
+ /**
+ * @param SimpleGuesser& sg the other guesser
*/
- void operator=(SimpleGuesser& sg);
+ SimpleGuesser& operator=(const SimpleGuesser& sg);
/**
* destroy the object