[Libreoffice-commits] .: 3 commits - l10ntools/inc l10ntools/source
Andras Timar
timar at kemper.freedesktop.org
Wed Feb 1 09:46:05 PST 2012
l10ntools/inc/gsicheck.hxx | 5 -
l10ntools/source/gsicheck.cxx | 178 +-----------------------------------------
2 files changed, 9 insertions(+), 174 deletions(-)
New commits:
commit d9adc4342cf275498e7d2e27a674116ceb2ac13f
Author: Andras Timar <atimar at suse.com>
Date: Wed Feb 1 18:45:27 2012 +0100
tweak help text of gsicheck tool
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 42dc4fc..8d5544f 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -602,10 +602,7 @@ void Help()
/*****************************************************************************/
{
fprintf( stdout, "\n" );
- fprintf( stdout, "gsicheck Version 1.9.0 (c)1999 - 2006 by SUN Microsystems\n" );
- fprintf( stdout, "=========================================================\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files and SDF-Files\n" );
+ fprintf( stdout, "gsicheck checks the syntax of tags in SDF-Files\n" );
fprintf( stdout, " checks for inconsistencies and malicious UTF8 encoding\n" );
fprintf( stdout, " checks tags in Online Help\n" );
fprintf( stdout, " relax GID/LID length to %s\n",
@@ -627,7 +624,7 @@ void Help()
fprintf( stdout, "-t Check only Translation language(s). Should be used before merging.\n" );
fprintf( stdout, "-e disable encoding checks. E.g.: double questionmark \'??\' which may be the\n" );
fprintf( stdout, " result of false conversions\n" );
- fprintf( stdout, "-l ISO Languagecode or numerical 2 digits Identifier of the source language.\n" );
+ fprintf( stdout, "-l ISO language code of the source language.\n" );
fprintf( stdout, " Default is en-US. Use \"\" (empty string) or 'none'\n" );
fprintf( stdout, " to disable source language dependent checks\n" );
fprintf( stdout, "-r Reference filename to check that source language entries\n" );
commit 7dfd1c4023db374bec747dff551ba1bcdafc6508
Author: Andras Timar <atimar at suse.com>
Date: Wed Feb 1 17:46:13 2012 +0100
remove this KeyID check from gsicheck, unused
diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx
index 7764e78..2915c69 100644
--- a/l10ntools/inc/gsicheck.hxx
+++ b/l10ntools/inc/gsicheck.hxx
@@ -104,7 +104,6 @@ private:
sal_Bool bCheckSourceLang;
sal_Bool bCheckTranslationLang;
sal_Bool bReference;
- sal_Bool bAllowKeyIDs;
sal_Bool bAllowSuspicious;
sal_Bool bHasBlockError;
@@ -114,7 +113,7 @@ private:
sal_Bool HasSuspiciousChars( GSILine* pTestee, GSILine* pSource );
public:
- GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowKID, sal_Bool bAllowSusp );
+ GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowSusp );
~GSIBlock();
void PrintMessage( ByteString aType, ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index a49b1d6..42dc4fc 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -226,7 +226,7 @@ void GSILine::ReassembleLine()
// class GSIBlock
//
/*****************************************************************************/
-GSIBlock::GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowKID, sal_Bool bAllowSusp )
+GSIBlock::GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowSusp )
/*****************************************************************************/
: pSourceLine( NULL )
, pReferenceLine( NULL )
@@ -234,7 +234,6 @@ GSIBlock::GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans,
, bCheckSourceLang( bSource )
, bCheckTranslationLang( bTrans )
, bReference( bRef )
- , bAllowKeyIDs( bAllowKID )
, bAllowSuspicious( bAllowSusp )
, bHasBlockError( sal_False )
{
@@ -360,93 +359,6 @@ sal_Bool GSIBlock::IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uIn
aFixed.Erase();
}
- if ( !bAllowKeyIDs )
- {
- sal_Bool bIsKeyID = sal_False;
- sal_Bool bNewId = sal_False;
- ByteString aID( aTestee );
- sal_uInt16 nAfterID = 0;
-
- if ( aTestee.Equals( "{&", 0, 2 ) )
- { // check for strings from instset_native like "{&Tahoma8}335795.Installation Wiza ..."
- sal_uInt16 nTagEnd = aTestee.Search( '}' );
- if ( nTagEnd != STRING_NOTFOUND )
- {
- if ( bFixTags )
- aFixed = aTestee.Copy( 0, nTagEnd+1 );
- nErrorPos = nTagEnd+1;
- aID = aTestee.Copy( nTagEnd+1 );
- nAfterID = nTagEnd+1;
- }
- }
-
- rtl::OString aDelimiter(rtl::OUStringToOString(String( sal_Unicode(0x2016) ), RTL_TEXTENCODING_UTF8));
-
- if ( aID.Equals( aDelimiter, 6, aDelimiter.getLength() ) )
- { // New KeyId 6 Letters, digits and spechial chars followed by delimiter
- bNewId = sal_True;
- nErrorPos = 1;
- aID = aID.Copy( 0, 6 );
- nAfterID += 6;
- nAfterID = nAfterID + aDelimiter.getLength();
- }
- else if ( ( aID.GetChar(6) == '*' ) && aID.Equals( aDelimiter, 7, aDelimiter.getLength() ) )
- { // New KeyId 6 Letters, digits and spechial chars followed by '*delimiter' to indicate translation in progress
- bNewId = sal_True;
- nErrorPos = 1;
- aID = aID.Copy( 0, 6 );
- nAfterID += 7;
- nAfterID = nAfterID + aDelimiter.getLength();
- }
- else if ( getTokenCount(aID, '.') > 1 )
- { // test for old KeyIDs 5 to 6 digits followed by a dot '44373.'
- bNewId = sal_False;
- nErrorPos = 1;
- aID = getToken(aID, 0, '.');
- nAfterID = nAfterID + aID.Len();
- }
- else
- {
- aID.Erase();
- }
-
- if ( bNewId )
- {
- if ( aID.Len() == 6 )
- {
- bIsKeyID = sal_True;
- ByteString aDigits("0123456789abcdefghijklmnopqrstuvwxyz+-<=>");
- for ( sal_uInt16 i=0 ; i < aID.Len() ;i++ )
- {
- if ( aDigits.Search( aID.GetChar(i) ) == STRING_NOTFOUND )
- bIsKeyID = sal_False;
- }
- }
- }
- else
- {
- if ( aID.Len() > 0 && aID.GetChar(aID.Len()-1) == '*' )
- aID.Erase( aID.Len()-1 );
-
- if (comphelper::string::isdigitAsciiString(aID) && aID.Len() >= 5)
- bIsKeyID = sal_True;
- }
-
- if ( bIsKeyID )
- {
- aErrorMsg = ByteString( "String contains KeyID" );
- if ( bFixTags )
- {
- aFixed += aTestee.Copy( nAfterID );
- bHasBeenFixed = sal_True;
- aErrorMsg = ByteString( "FIXED String containing KeyID" );
- }
- else
- aErrorMsg = ByteString( "String contains KeyID" );
- return sal_False;
- }
- }
-
return sal_True;
}
@@ -696,7 +608,7 @@ void Help()
fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files and SDF-Files\n" );
fprintf( stdout, " checks for inconsistencies and malicious UTF8 encoding\n" );
fprintf( stdout, " checks tags in Online Help\n" );
- fprintf( stdout, " checks for *new* KeyIDs and relax GID/LID length to %s\n",
+ fprintf( stdout, " relax GID/LID length to %s\n",
rtl::OString::valueOf(static_cast<sal_Int32>(MAX_GID_LID_LEN)).getStr() );
fprintf( stdout, "\n" );
fprintf( stdout, "Syntax: gsicheck [ -c ] [-f] [ -we ] [ -wef ErrorFilename ] [ -wc ]\n" );
@@ -713,7 +625,6 @@ void Help()
fprintf( stdout, "-wcf Same as above but give own filename\n" );
fprintf( stdout, "-s Check only source language. Should be used before handing out to vendor.\n" );
fprintf( stdout, "-t Check only Translation language(s). Should be used before merging.\n" );
- fprintf( stdout, "-k Allow KeyIDs to be present in strings\n" );
fprintf( stdout, "-e disable encoding checks. E.g.: double questionmark \'??\' which may be the\n" );
fprintf( stdout, " result of false conversions\n" );
fprintf( stdout, "-l ISO Languagecode or numerical 2 digits Identifier of the source language.\n" );
@@ -741,7 +652,6 @@ int _cdecl main( int argc, char *argv[] )
sal_Bool bWriteCorrect = sal_False;
sal_Bool bWriteFixed = sal_False;
sal_Bool bFixTags = sal_False;
- sal_Bool bAllowKID = sal_False;
sal_Bool bAllowSuspicious = sal_False;
String aErrorFilename;
String aCorrectFilename;
@@ -859,11 +769,6 @@ int _cdecl main( int argc, char *argv[] )
bFixTags = sal_True;
}
break;
- case 'k':
- {
- bAllowKID = sal_True;
- }
- break;
case 'e':
{
bAllowSuspicious = sal_True;
@@ -1036,7 +941,7 @@ int _cdecl main( int argc, char *argv[] )
delete pBlock;
}
- pBlock = new GSIBlock( bPrintContext, bCheckSourceLang, bCheckTranslationLang, bReferenceFile, bAllowKID, bAllowSuspicious );
+ pBlock = new GSIBlock( bPrintContext, bCheckSourceLang, bCheckTranslationLang, bReferenceFile, bAllowSuspicious );
aOldId = aId;
commit 20bb21fc428d8c8f423289a365658fdcae5a887a
Author: Andras Timar <atimar at suse.com>
Date: Wed Feb 1 16:43:58 2012 +0100
remove support of obsolete ($$) delimited GSI file format
diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx
index fff822f..7764e78 100644
--- a/l10ntools/inc/gsicheck.hxx
+++ b/l10ntools/inc/gsicheck.hxx
@@ -35,7 +35,7 @@
//
// class GSILine
//
-enum LineFormat { FORMAT_GSI, FORMAT_SDF, FORMAT_UNKNOWN };
+enum LineFormat { FORMAT_SDF, FORMAT_UNKNOWN };
class GSILine : public ByteString
{
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index a33e8ea..a49b1d6 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -178,44 +178,10 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine )
NotOK();
}
}
- else // allow tabs in gsi files
+ else
{
- aFormat = FORMAT_GSI;
- ByteString sTmp( rLine );
- sal_uInt16 nPos = sTmp.Search( "($$)" );
- sal_uInt16 nStart = 0;
- if ( nPos != STRING_NOTFOUND )
- {
- aUniqId = sTmp.Copy( nStart, nPos - nStart );
- nStart = nPos + 4; // + length of the delemiter
- nPos = sTmp.Search( "($$)", nStart );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- aLineType = sTmp.Copy( nStart, nPos - nStart );
- nStart = nPos + 4; // + length of the delemiter
- nPos = sTmp.Search( "($$)", nStart );
- aUniqId.Append( "/" );
- aUniqId.Append( aLineType );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- aLangId = sTmp.Copy( nStart, nPos - nStart );
- nStart = nPos + 4; // + length of the delemiter
- nPos = sTmp.Search( "($$)", nStart );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- nStart = nPos + 4; // + length of the delemiter
- }
- if ( nPos != STRING_NOTFOUND )
- aText = sTmp.Copy( nStart );
- else
- aFormat = FORMAT_UNKNOWN;
- }
-
- if ( FORMAT_UNKNOWN == GetLineFormat() )
NotOK();
+ }
}
/*****************************************************************************/
@@ -252,38 +218,6 @@ void GSILine::ReassembleLine()
}
*(ByteString*)this = aReassemble;
}
- else if ( GetLineFormat() == FORMAT_GSI )
- {
- sal_uInt16 nPos = Search( "($$)" );
- sal_uInt16 nStart = 0;
- if ( nPos != STRING_NOTFOUND )
- {
- nStart = nPos + 4; // + length of the delemiter
- nPos = Search( "($$)", nStart );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- nStart = nPos + 4; // + length of the delemiter
- nPos = Search( "($$)", nStart );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- nStart = nPos + 4; // + length of the delemiter
- nPos = Search( "($$)", nStart );
- }
- if ( nPos != STRING_NOTFOUND )
- {
- nStart = nPos + 4; // + length of the delemiter
- }
- if ( nPos != STRING_NOTFOUND )
- {
- aReassemble = Copy( 0, nStart );
- aReassemble += aText;
- *(ByteString*)this = aReassemble;
- }
- else
- PrintError( "Cannot reassemble GSI line (internal Error).", "Line format", "", sal_False, GetLineNumber(), GetUniqId() );
- }
else
PrintError( "Cannot reassemble line of unknown type (internal Error).", "Line format", "", sal_False, GetLineNumber(), GetUniqId() );
}
More information about the Libreoffice-commits
mailing list