summaryrefslogtreecommitdiff
path: root/lingucomponent/source/languageguessing
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 09:54:22 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-11-01 09:54:22 +0000
commit837afbe61ad74180025ce4c74cc1d8b4c0934f51 (patch)
tree9c0fddbd4cfe97ca4340dfc0382df70f4840cb85 /lingucomponent/source/languageguessing
parent7b38eebc639cd23ec6a8f8f93fa96ce2e4d4495a (diff)
INTEGRATION: CWS tl48_SRC680 (1.4.36); FILE MERGED
2007/10/22 11:07:01 tl 1.4.36.3: warning fixed 2007/10/22 11:05:15 tl 1.4.36.2: warning fixed 2007/10/17 15:05:18 tl 1.4.36.1: #i81311# fix warning with non-pro build and a possible crash
Diffstat (limited to 'lingucomponent/source/languageguessing')
-rw-r--r--lingucomponent/source/languageguessing/altstrfunc.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/lingucomponent/source/languageguessing/altstrfunc.cxx b/lingucomponent/source/languageguessing/altstrfunc.cxx
index 2b56f5336bfd..5a9685741ab7 100644
--- a/lingucomponent/source/languageguessing/altstrfunc.cxx
+++ b/lingucomponent/source/languageguessing/altstrfunc.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: altstrfunc.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: rt $ $Date: 2007-06-22 08:32:42 $
+ * last change: $Author: hr $ $Date: 2007-11-01 10:54:22 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -50,11 +50,15 @@ std::string upperCase(const std::string &s) {
}
-int start(const std::string &s1, const std::string &s2){
- int i;
+int start( const std::string &s1, const std::string &s2 ){
+ size_t i;
int ret = 0;
- for(i = 0; s2[i] && s1[i] && !ret; i++){
+ size_t min = s1.length();
+ if (min > s2.length())
+ min = s2.length();
+
+ for(i = 0; i < min && s2[i] && s1[i] && !ret; i++){
ret = toupper(s1[i]) - toupper(s2[i]);
if(s1[i] == '.' || s2[i] == '.'){ret = 0;}//. is a neutral character
}