[Libreoffice-commits] .: lingucomponent/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Dec 29 04:38:59 PST 2012
lingucomponent/source/languageguessing/simpleguesser.cxx | 7 ++++++-
lingucomponent/source/languageguessing/simpleguesser.hxx | 6 +++---
2 files changed, 9 insertions(+), 4 deletions(-)
New commits:
commit cf068828d334fcb0998755118e262d16c9db5b3a
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Dec 29 13:36:43 2012 +0100
Fix SimpleGuesser::operator=' should return 'SimpleGuesser &
Change-Id: I29205bc8db7569cf123a52dd248a9165ebaef3a3
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 1162884..b6d52cd 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 eed1af9..acf3ae3 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
More information about the Libreoffice-commits
mailing list