summaryrefslogtreecommitdiffstats
path: root/i18npool/source/search
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-06 12:54:16 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-06 12:54:16 +0000
commit4e1fd2fa161708049f1c3b6039659d0bf4f4539e (patch)
tree860f7ec49a96dbb04a3161d44dd1598ce26da2a4 /i18npool/source/search
parentCWS-TOOLING: integrate CWS ooxml02 (diff)
downloadcore-4e1fd2fa161708049f1c3b6039659d0bf4f4539e.tar.gz
core-4e1fd2fa161708049f1c3b6039659d0bf4f4539e.zip
CWS-TOOLING: integrate CWS locales31
2008-12-10 14:56:44 +0100 er r265193 : calling convention mismatch 2008-12-08 12:04:56 +0100 er r264984 : #i96840# classify some extra languages as CTL 2008-12-05 19:54:02 +0100 erack r264916 : ImpSvNumberformatScan::ScanType: do not miscategorize as automtic currency if currency symbol in General string, such as R in Standard 2008-12-04 12:07:05 +0100 erack r264831 : CWS-TOOLING: rebase CWS locales31 to trunk@264807 (milestone: DEV300:m37) 2008-12-03 16:14:17 +0100 erack r264797 : #i93694# update script+language -> unicode digit mapping; patch from <hdu> 2008-11-25 02:01:18 +0100 erack r264270 : #i83349# apply remaining parts of the patch, now that we use ICU 4.0; contributed by <kstribley> 2008-11-25 01:38:20 +0100 erack r264269 : #i93694# test the bit, not the constant ... 2008-11-24 10:34:58 +0100 erack r264211 : #i93694# LANGUAGE_ARABIC is gone 2008-11-24 01:39:25 +0100 erack r264192 : #i94435# LANGUAGE_SPANISH now is an alias of LANGUAGE_SPANISH_MODERN, need LANGUAGE_SPANISH_DATED in switch case if both are to be used 2008-11-23 22:54:17 +0100 erack r264190 : CWS-TOOLING: rebase CWS locales31 to trunk@263288 (milestone: DEV300:m35) 2008-11-23 20:23:28 +0100 erack r264189 : migrate CWS locales31 to SVN
Diffstat (limited to 'i18npool/source/search')
-rw-r--r--i18npool/source/search/levdis.cxx76
-rw-r--r--i18npool/source/search/levdis.hxx14
2 files changed, 37 insertions, 53 deletions
diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx
index 9e4b0b091b3c..187693269041 100644
--- a/i18npool/source/search/levdis.cxx
+++ b/i18npool/source/search/levdis.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: levdis.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.24.1 $
*
* This file is part of OpenOffice.org.
*
@@ -121,7 +121,7 @@
} \
}
-sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr )
+static sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr )
{
const sal_Unicode* pTempStr = pStr;
while( *pTempStr )
@@ -131,7 +131,7 @@ sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr )
#ifdef erTESTMAT
#define erTESTMATMAX 180
-static int far npMatrix[erTESTMATMAX][erTESTMATMAX]; // nearly 64K
+static int npMatrix[erTESTMATMAX][erTESTMATMAX]; // nearly 64K
#endif
// Distanz von String zu Pattern
@@ -366,19 +366,6 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
}
-int WLevDistance::WLD( const ::rtl::OUString& rString )
-{
- return( WLD( rString.getStr(), rString.getLength() ));
-}
-
-
-
-int WLevDistance::WLD( const sal_Unicode* cString )
-{
- return( WLD( cString, Impl_WLD_StringLen(cString) ));
-}
-
-
// Berechnung von nLimit, nReplP0, nInsQ0, nDelR0, bSplitCount
// aus Userwerten nOtherX, nShorterY, nLongerZ, bRelaxed
@@ -511,8 +498,10 @@ void WLevDistance::InitData( const sal_Unicode* cPattern )
// CTor
-WLevDistance::WLevDistance( const sal_Unicode* cPattern ) :
- nPatternLen( Impl_WLD_StringLen(cPattern) ),
+#ifdef erTEST
+
+WLevDistance::WLevDistance( const ::rtl::OUString& rPattern ) :
+ nPatternLen( rPattern.getLength() ),
aPatMem( nPatternLen + 1 ),
nArrayLen( nPatternLen + 1 ),
aDisMem( nArrayLen ),
@@ -522,9 +511,10 @@ WLevDistance::WLevDistance( const sal_Unicode* cPattern ) :
nDelR0( LEVDISDEFAULT_R0 ),
bSplitCount( false )
{
- InitData( cPattern );
+ InitData( rPattern.getStr() );
}
+#endif // erTEST
WLevDistance::WLevDistance( const sal_Unicode* cPattern,
@@ -540,21 +530,6 @@ WLevDistance::WLevDistance( const sal_Unicode* cPattern,
}
-WLevDistance::WLevDistance( const ::rtl::OUString& rPattern ) :
- nPatternLen( rPattern.getLength() ),
- aPatMem( nPatternLen + 1 ),
- nArrayLen( nPatternLen + 1 ),
- aDisMem( nArrayLen ),
- nLimit( LEVDISDEFAULTLIMIT ),
- nRepP0( LEVDISDEFAULT_P0 ),
- nInsQ0( LEVDISDEFAULT_Q0 ),
- nDelR0( LEVDISDEFAULT_R0 ),
- bSplitCount( false )
-{
- InitData( rPattern.getStr() );
-}
-
-
// CopyCTor
WLevDistance::WLevDistance( const WLevDistance& rWLD ) :
nPatternLen( rWLD.nPatternLen ),
@@ -597,17 +572,19 @@ typedef char MAXSTRING [LINESIZE+1];
#ifdef erTESTMAT
-void WLevDistance::ShowMatrix( const char* cString )
+void WLevDistance::ShowMatrix( const sal_Unicode* cString )
{
- sal_Int32 r, c, l = strlen(cString);
+ sal_Int32 r, c, l = Impl_WLD_StringLen(cString);
printf(" | ");
for ( c=0; c<nPatternLen; c++ )
+#error Error: conversion from sal_Unicode to char needed!
printf( " %c ", cpPattern[c] );
printf("\n---+---");
for ( c=0; c<nPatternLen; c++ )
printf( "---" );
for ( r=0; r<=l && r < erTESTMATMAX; r++ )
{
+#error Error: conversion from sal_Unicode to char needed!
printf( "\n %c |", ( r==0 ? ' ' : cString[r-1] ) );
for ( c=0; c<=nPatternLen && c < erTESTMATMAX; c++ )
printf( "%2d ", npMatrix[r][c] );
@@ -623,18 +600,20 @@ MAXSTRING cDelim = "\t, ;(){}[]<>&=+-/%!|.\\'\"~";
void WLevDistance::ShowTest()
{
printf(" \n");
+#error Error: conversion from sal_Unicode to char needed!
printf(" a *cpPattern . . . . : %s\n", cpPattern);
printf(" b *bpPatIsWild . . . : ");
for ( sal_Int32 i=0; i<nPatternLen; i++ )
printf("%d", bpPatIsWild[i]);
printf("\n");
- printf(" c nPatternLen . . . : %d\n", nPatternLen);
+ printf(" c nPatternLen . . . : %d\n", (int)nPatternLen);
printf(" d nStars . . . . . . : %d\n", nStars);
printf(" e nLimit . . . . . . : %d\n", nLimit);
printf(" f nRepP0 (Ersetzen) : %d\n", nRepP0);
printf(" g nInsQ0 (Einfuegen) : %d\n", nInsQ0);
printf(" h nDelR0 (Loeschen) : %d\n", nDelR0);
printf(" i bSplitCount . . . : %d\n", bSplitCount);
+#error Error: conversion from sal_Unicode to char needed!
printf(" j cDelim . . . . . . : '%s'\n", cDelim);
printf(" ~\n");
}
@@ -650,7 +629,7 @@ inline bool IsDelim( char c )
MAXSTRING cString, cLine, cIgString;
-main( int argc, char **argv )
+int main( int argc, char **argv )
{
int nLim, nP0, nQ0, nR0, nX, nY, nZ;
int args = 0;
@@ -674,7 +653,7 @@ main( int argc, char **argv )
{
IgnoreCase = true;
char* cp = argv[args+1];
- while ( *cp = tolower( *cp ) )
+ while ( (*cp = tolower( *cp )) != 0 )
cp++;
break;
}
@@ -731,6 +710,7 @@ main( int argc, char **argv )
}
if ( Direct )
{
+#error Error: conversion from char to OUString needed!
pTest = new WLevDistance( argv[args+1] );
#ifdef erTESTDEFAULT
pTest->ShowTest();
@@ -742,6 +722,7 @@ main( int argc, char **argv )
}
else
{
+#error Error: conversion from char to sal_Unicode needed!
pTest = new WLevDistance( argv[args+1], nX, nY, nZ, !bStrict );
#ifdef erTESTCCTOR
WLevDistance aTmp( *pTest );
@@ -753,7 +734,7 @@ main( int argc, char **argv )
do
{
char* cp1, *cp2;
- static ULONG nLine = 0;
+ static long unsigned int nLine = 0;
cp1 = cLine;
cin.getline( cLine, LINESIZE ) ;
nLine++;
@@ -772,21 +753,24 @@ main( int argc, char **argv )
int ret;
if ( IgnoreCase )
{
- char* cp1 = cString;
- char* cp2 = cIgString;
- while ( *cp1 )
- *cp2++ = tolower( *cp1++ );
- *cp2 = '\0';
+ char* cpi1 = cString;
+ char* cpi2 = cIgString;
+ while ( *cpi1 )
+ *cpi2++ = tolower( *cpi1++ );
+ *cpi2 = '\0';
+#error Error: conversion from char to OUString / sal_Unicode,length needed!
ret = pTest->WLD( cIgString );
}
else
+#error Error: conversion from char to OUString / sal_Unicode,length needed!
ret = pTest->WLD( cString );
#ifdef erTESTMAT
printf("\n# %3d : %s\n", ret, cString);
+#error Error: conversion from char to sal_Unicode needed!
pTest->ShowMatrix( cString );
#else
if ( ret <= nLim )
- printf("# %3d : %s\t(line %ld)\t%s\n", ret, cString, nLine, cLine);
+ printf("# %3d : %s\t(line %lu)\t%s\n", ret, cString, nLine, cLine);
#endif
}
}
diff --git a/i18npool/source/search/levdis.hxx b/i18npool/source/search/levdis.hxx
index 64663b52bd55..92240444175b 100644
--- a/i18npool/source/search/levdis.hxx
+++ b/i18npool/source/search/levdis.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: levdis.hxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.24.1 $
*
* This file is part of OpenOffice.org.
*
@@ -147,10 +147,12 @@ class WLevDistance
int KGV( int a, int b ); // Kleinstes Gemeinsames Vielfaches
public:
+
+#ifdef erTEST
// CToren fuer direktes Setzen der Gewichtung mit Set...()
// im CTor werden die Defaultwerte fuer Limit/Rep/Ins/Del gesetzt
- WLevDistance( const sal_Unicode* cPattern );
- WLevDistance( const ::rtl::OUString& rPattern );
+ explicit WLevDistance( const ::rtl::OUString& rPattern );
+#endif
// CToren mit Userangaben, danach mit GetLimit() Limit holen
// interner Aufruf von CalcLPQR()
@@ -162,9 +164,7 @@ public:
~WLevDistance();
// Berechnung der Levenshtein-Distanz von String zu Pattern
- int WLD( const sal_Unicode* cString, sal_Int32 nStringLen ); // prefered
- int WLD( const sal_Unicode* cString );
- int WLD( const ::rtl::OUString& rString );
+ int WLD( const sal_Unicode* cString, sal_Int32 nStringLen );
// Berechnung der Gewichtung aus Userangaben, return nLimit
int CalcLPQR( int nOtherX, int nShorterY, int nLongerZ,
@@ -187,7 +187,7 @@ public:
#ifdef erTEST
void ShowTest();
#ifdef erTESTMAT
- void ShowMatrix( const char* cString );
+ void ShowMatrix( const sal_Unicode* cString );
#endif
#endif