summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorThomas Lange <tl@openoffice.org>2002-09-24 12:59:39 +0000
committerThomas Lange <tl@openoffice.org>2002-09-24 12:59:39 +0000
commit9d99bc95c446232234c6156dc056656bc1891096 (patch)
tree12aa3ac591fa0066efae5940ace50f1ecf10e4f0 /linguistic
parenta93427b480a25a2013f728a8f33e6069b05c0dbd (diff)
#102758# checking of arguments nMaxLeading and nIndex for hayphenate and queryAlternativeSpelling
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/hyphdsp.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index d4f91e4f8542..a3f0ebbf873a 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: hyphdsp.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: tl $ $Date: 2002-09-19 11:56:48 $
+ * last change: $Author: tl $ $Date: 2002-09-24 13:59:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -301,24 +301,26 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
+ INT32 nWordLen = rWord.getLength();
INT16 nLanguage = LocaleToLanguage( rLocale );
- if (nLanguage == LANGUAGE_NONE || !rWord.getLength())
+ if (nLanguage == LANGUAGE_NONE || !nWordLen ||
+ nMaxLeading == 0 || nMaxLeading == nWordLen)
return xRes;
// search for entry with that language
LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
BOOL bWordModified = FALSE;
- if (!pEntry)
+ if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen))
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
+#else
+ return NULL;
#endif
}
else
{
- DBG_ASSERT( nMaxLeading < rWord.getLength(), "illegal argument combination" );
-
OUString aChkWord( rWord );
bWordModified |= RemoveHyphens( aChkWord );
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
@@ -420,24 +422,25 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
+ INT32 nWordLen = rWord.getLength();
INT16 nLanguage = LocaleToLanguage( rLocale );
- if (nLanguage == LANGUAGE_NONE || !rWord.getLength())
+ if (nLanguage == LANGUAGE_NONE || !nWordLen)
return xRes;
// search for entry with that language
LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage );
BOOL bWordModified = FALSE;
- if (!pEntry)
+ if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2))
{
#ifdef LINGU_EXCEPTIONS
throw IllegalArgumentException();
+#else
+ return NULL;
#endif
}
else
{
- DBG_ASSERT( nIndex < rWord.getLength(), "illegal argument combination" );
-
OUString aChkWord( rWord );
bWordModified |= RemoveHyphens( aChkWord );
if (IsIgnoreControlChars( rProperties, GetPropSet() ))