From a0864219a12fa09e46e4193003913ac2945fff76 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 Jul 2011 21:12:51 +0100 Subject: callcatcher: remove unused Merge ByteString --- l10ntools/source/localize.cxx | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'l10ntools/source/localize.cxx') diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index a0c3775b9ee7..8b9f473e300f 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -221,7 +221,6 @@ public: { sLanguageRestriction = rRestrictions; } int getFileCnt(); sal_Bool Extract( const ByteString &rDestinationFile ); - sal_Bool Merge( const ByteString &rSourceFile , const ByteString &rOutput ); int GetFileCnt(); virtual void OnExecuteDirectory( const rtl::OUString &rDirectory ); }; @@ -796,24 +795,6 @@ sal_Bool SourceTreeLocalizer::ExecuteMerge( ) } -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteString &rOutput ) -/*****************************************************************************/ -{ - sOutputFile = rOutput; - nMode = LOCALIZE_MERGE; - aSDF.Open( String( rSourceFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_STD_READ ); - - sal_Bool bReturn = aSDF.IsOpen(); - if ( bReturn ) { - bReturn = ExecuteMerge(); - } - aSDF.Close(); - nMode = LOCALIZE_NONE; - return bReturn; -} - } using namespace transex3; -- cgit From 0eeba1cdf66c124cf600a8611555e897aa268327 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 12 Jul 2011 21:09:13 +0100 Subject: callcatcher: strip l10ntools down by more unused methods --- l10ntools/source/localize.cxx | 96 ------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'l10ntools/source/localize.cxx') diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 8b9f473e300f..5af7bfcb5c18 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -204,7 +204,6 @@ private: const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); - sal_Bool ExecuteMerge(); sal_Bool MergeSingleFile( const ByteString &rPrj, const ByteString &rFile, @@ -699,101 +698,6 @@ sal_Bool SourceTreeLocalizer::MergeSingleFile( } return sal_True; } -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::ExecuteMerge( ) -/*****************************************************************************/ -{ - DirEntry aEntry( Export::GetTempFile()); - sal_Bool bReturn = sal_True; - bool bMerged = false; - - ByteString sFileName; - ByteString sCurFile; - ByteString sLine; - ByteString sFileKey; - - SvFileStream aFile; - - ByteString sOutputFileName = sOutputFile; - ByteString sInpath("."); - sInpath += Export::GetEnv("INPATH"); - ByteString sBlank(""); - - sOutputFileName.SearchAndReplaceAll( sInpath , sBlank ); - - String sDel = DirEntry::GetAccessDelimiter(); - ByteString sBDel( sDel.GetBuffer() , sDel.Len() , RTL_TEXTENCODING_UTF8 ); - if( bLocal ){ - xub_StrLen nPos = sOutputFileName.SearchBackward( sBDel.GetChar(0) ); - sOutputFileName = sOutputFileName.Copy( nPos+1 , sOutputFileName.Len()-nPos-1 ); - } - ByteStringBoolHashMap aFileHM; - // Read all possible files - while ( !aSDF.IsEof()) { - aSDF.ReadLine( sLine ); - sFileName = sLine.GetToken( 0, '\t' ); - sFileName += "#"; - sFileName += sLine.GetToken( 1, '\t' ); - aFileHM[sFileName]=true; - } - - for( ByteStringBoolHashMap::iterator iter = aFileHM.begin(); iter != aFileHM.end(); ++iter ){ - sFileKey = iter->first; - aSDF.Seek( 0 ); - aFile.Open( aEntry.GetFull(), STREAM_STD_WRITE |STREAM_TRUNC ); - - while ( !aSDF.IsEof()) { - aSDF.ReadLine( sLine ); - sFileName = sLine.GetToken( 0, '\t' ); - sFileName += "#"; - sFileName += sLine.GetToken( 1, '\t' ); - if( sFileName.Len() && ( sFileName.CompareTo(sFileKey) == COMPARE_EQUAL ) ){ - if ( aFile.IsOpen() && sLine.Len()) - aFile.WriteLine( sLine ); - } - } - if ( aFile.IsOpen()) - aFile.Close(); - - ByteString sPrj( sFileKey.GetToken( 0, '#' )); - ByteString sFile( sFileKey.GetToken( 1, '#' )); - ByteString sSDFFile( aFile.GetFileName(), RTL_TEXTENCODING_ASCII_US ); - - //printf("localize test sPrj = %s , sFile = %s , sSDFFile = %s sOutputFileName = %s\n",sPrj.GetBuffer(), sFile.GetBuffer() , sSDFFile.GetBuffer() , sOutputFileName.GetBuffer() ); - - // Test - bLocal = true; - // Test - - if( bLocal ){ - sal_uInt16 nPos = sFile.SearchBackward( '\\' ); - ByteString sTmp = sFile.Copy( nPos+1 , sFile.Len()-nPos-1 ); - //printf("'%s'='%s'\n",sTmp.GetBuffer(), sOutputFileName.GetBuffer()); - if( sTmp.CompareTo(sOutputFileName) == COMPARE_EQUAL ){ - bMerged = true; - if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) - bReturn = sal_False; - }else{ - bMerged = true; - //printf("MergeSingleFile('%s','%s','%s')\n",sPrj.GetBuffer(),sFile.GetBuffer(),sSDFFile.GetBuffer()); - if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) - bReturn = sal_False; - } - } - } - aEntry.Kill(); - // If Outputfile not included in the SDF file copy it without merge - - if( bLocal && !bMerged ){ - DirEntry aSourceFile( sOutputFileName.GetBuffer() ); - FSysError aErr = aSourceFile.CopyTo( DirEntry ( sOutputFile.GetBuffer() ) , FSYS_ACTION_COPYFILE ); - if( aErr != FSYS_ERR_OK ){ - printf("ERROR: Can't copy file '%s' to '%s' %d\n",sOutputFileName.GetBuffer(),sOutputFile.GetBuffer(),sal::static_int_cast(aErr)); - } - } - return bReturn; - -} } using namespace transex3; -- cgit From c2a850fcfa25229514daaa294cc06c67300f49a8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 14 Jul 2011 22:06:47 +0100 Subject: callcatcher: remove unused methods --- l10ntools/source/localize.cxx | 144 ------------------------------------------ 1 file changed, 144 deletions(-) (limited to 'l10ntools/source/localize.cxx') diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 5af7bfcb5c18..9cacee6bebd6 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -204,12 +204,6 @@ private: const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); - sal_Bool MergeSingleFile( - const ByteString &rPrj, - const ByteString &rFile, - const ByteString &rSDFFile - ); - public: SourceTreeLocalizer( const ByteString &rRoot, const ByteString &rVersion , bool bLocal , bool skip_links ); ~SourceTreeLocalizer(); @@ -561,144 +555,6 @@ sal_Bool SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) return bReturn; } -/*****************************************************************************/ -sal_Bool SourceTreeLocalizer::MergeSingleFile( - const ByteString &rPrj, - const ByteString &rFile, - const ByteString &rSDFFile -) -/*****************************************************************************/ -{ - //printf("MergeSingleFile(%s,%s,%s)",rPrj.GetBuffer(),rFile.GetBuffer(),rSDFFile.GetBuffer()); - if ( !rFile.Len()) - return sal_True; - - ByteString sRoot( Export::GetEnv( "SRC_ROOT" )); - DirEntry aEntry( String( sRoot, RTL_TEXTENCODING_ASCII_US )); - aEntry += DirEntry( String( rPrj, RTL_TEXTENCODING_ASCII_US )); - - ByteString sDelimiter( - DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); - - ByteString sCur( rFile ); - sCur.SearchAndReplaceAll( "\\", sDelimiter ); - sCur.SearchAndReplaceAll( "/", sDelimiter ); - - aEntry += DirEntry( String( sCur, RTL_TEXTENCODING_ASCII_US )); - ByteString sFile( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - - ByteString sBCur( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - - sal_uLong nIndex = 0; - ByteString sExtension( aEntry.GetExtension(), RTL_TEXTENCODING_ASCII_US ); - ByteString sCandidate( ExeTable[ nIndex ][ 0 ] ); - - while( !sCandidate.Equals ("NULL") && !sCandidate.Equals(sExtension) ) - sCandidate = ExeTable[ ++nIndex ][ 0 ]; - - if ( !sCandidate.Equals( "NULL" ) ) { - if( !aEntry.Exists()) { - DirEntryKind theDir=FSYS_KIND_FILE; - Dir myDir( aEntry.GetPath(), theDir); - DirEntry current; - sal_Bool found=sal_False; - for( sal_uInt16 x=0; x < myDir.Count() && !found;){ - current=myDir[x++]; - StringCompare result=current.GetName().CompareIgnoreCaseToAscii( aEntry.GetName() ); - if( result==COMPARE_EQUAL ){ - fprintf(stderr,"WARNING: %s not found\n", ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US).GetBuffer() ); - fprintf(stderr,"but use %s instead \n" , ByteString(current.GetFull(), RTL_TEXTENCODING_ASCII_US).GetBuffer() ); - aEntry=current; - found=sal_True; - } - } - if(!found) return sal_True; - - } - - DirEntry aOut( Export::GetTempFile() ); - ByteString sOutput; - if( sOutputFile.Len() == 0 ) - sOutput = ByteString ( aOut.GetFull(), RTL_TEXTENCODING_ASCII_US ); - else - sOutput = sOutputFile; - ByteString sCommand( ExeTable[ nIndex ][ 1 ] ); - sCommand += " -i "; - sCommand += ByteString( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US ); - sCommand += " -m "; - sCommand += rSDFFile; - sCommand += " -o "; - sCommand += sOutput; - sCommand += " "; - sCommand += ByteString( ExeTable[ nIndex ][ 2 ] ); - if ( sLanguageRestriction.Len()) { - sCommand += " -l "; - sCommand += sLanguageRestriction; - } - - DirEntry aPath( aEntry.GetPath()); - DirEntry aOldCWD; - aPath.SetCWD(); - - if (system(sCommand.GetBuffer()) == -1) - fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); - nFileCnt++; - printf("."); - SvFileStream aInStream( aOut.GetFull(), STREAM_READ ); - if ( !aInStream.IsOpen()) { - fprintf( stderr, - "ERROR: Unable to open file %s for reading!\n", - sOutput.GetBuffer()); - } - else { - FileStat::SetReadOnlyFlag( aEntry, sal_False ); - String myStr2(aEntry.GetFull()); - String aTemp22 = String::CreateFromAscii("_tmp"); - myStr2.Append(aTemp22); - - ByteString test(myStr2,RTL_TEXTENCODING_ASCII_US); - SvFileStream aOutStream( myStr2, STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aOutStream.IsOpen()) { - ByteString test2(myStr2,RTL_TEXTENCODING_ASCII_US); - fprintf( stderr,"ERROR: Unable to open file %s for modification!\n", test2.GetBuffer()); - aInStream.Close(); - } - - else { - ByteString sLine; - aOutStream.SetLineDelimiter( LINEEND_LF ); - - aInStream.ReadLine( sLine ); - while ( !aInStream.IsEof()) { - aOutStream.WriteLine( sLine ); - aInStream.ReadLine( sLine ); - } - aInStream.Close(); - aOutStream.Close(); - - - DirEntry myTempFile(ByteString(myStr2,RTL_TEXTENCODING_ASCII_US)); // xxx_tmp -> - DirEntry myFile(ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US));// xxx - - DirEntry oldFile(ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US)); - - if(oldFile.Kill()==ERRCODE_NONE){ - if(myTempFile.MoveTo(myFile)!=ERRCODE_NONE){ - fprintf( stderr, "ERROR: Can't rename file %s\n",ByteString(myStr2,RTL_TEXTENCODING_ASCII_US).GetBuffer()); - } - } - else{ - fprintf( stderr, "ERROR: Can't remove file %s\n",ByteString(aEntry.GetFull(),RTL_TEXTENCODING_ASCII_US).GetBuffer()); - } - } // else - - aOldCWD.SetCWD(); - aOut.Kill(); - } // else - } - return sal_True; -} - } using namespace transex3; -- cgit