diff options
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/cfglex.l | 6 | ||||
-rw-r--r-- | l10ntools/source/cfgmerge.cxx | 51 | ||||
-rw-r--r-- | l10ntools/source/directory.cxx | 6 | ||||
-rw-r--r-- | l10ntools/source/export.cxx | 382 | ||||
-rw-r--r-- | l10ntools/source/export2.cxx | 142 | ||||
-rw-r--r-- | l10ntools/source/file.cxx | 5 | ||||
-rw-r--r-- | l10ntools/source/gsicheck.cxx | 27 | ||||
-rw-r--r-- | l10ntools/source/help/HelpCompiler.cxx | 4 | ||||
-rw-r--r-- | l10ntools/source/help/HelpCompiler.hxx | 7 | ||||
-rw-r--r-- | l10ntools/source/help/HelpLinker.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 101 | ||||
-rw-r--r-- | l10ntools/source/lngmerge.cxx | 9 | ||||
-rw-r--r-- | l10ntools/source/localize.cxx | 259 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 20 | ||||
-rw-r--r-- | l10ntools/source/tagtest.cxx | 14 | ||||
-rw-r--r-- | l10ntools/source/xrmlex.l | 6 | ||||
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 17 |
17 files changed, 315 insertions, 749 deletions
diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l index a6f6b366a8d5..feb2882632d8 100644 --- a/l10ntools/source/cfglex.l +++ b/l10ntools/source/cfglex.l @@ -137,7 +137,7 @@ int yywrap(void) } /*****************************************************************************/ -void YYWarning( char *s ) +void YYWarning( const char *s ) /*****************************************************************************/ { /* write warning to stderr */ @@ -147,9 +147,9 @@ void YYWarning( char *s ) /*****************************************************************************/ #ifdef GCC -void yyerror ( char *s, ... ) +void yyerror ( const char *s, ... ) #else -void yyerror ( char *s ) +void yyerror ( const char *s ) #endif /*****************************************************************************/ { diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index c4f24edeb487..55aed2c4210c 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -394,13 +394,6 @@ void CfgParser::AddText( pStackData->sText[ rIsoLang ] = rText; } - -/*****************************************************************************/ -void CfgParser::WorkOnRessourceEnd() -/*****************************************************************************/ -{ -} - /*****************************************************************************/ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) /*****************************************************************************/ @@ -651,13 +644,13 @@ void CfgExport::WorkOnRessourceEnd() /*****************************************************************************/ { if ( pOutputStream && bLocalize ) { - if (( pStackData->sText[ ByteString("en-US") ].Len() + if (( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() ) || ( bForce && - ( pStackData->sText[ ByteString("de") ].Len() || - pStackData->sText[ ByteString("en-US") ].Len() ))) + ( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("de"))].getLength() || + pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() ))) { - ByteString sFallback = pStackData->sText[ ByteString("en-US") ]; + ByteString sFallback = pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))]; ByteString sLocalId = pStackData->sIdentifier; ByteString sGroupId; if ( aStack.size() == 1 ) { @@ -670,29 +663,29 @@ void CfgExport::WorkOnRessourceEnd() ByteString sTimeStamp( Export::GetTimeStamp()); - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ - sCur = aLanguages[ n ]; + for (size_t n = 0; n < aLanguages.size(); n++) + { + ByteString sCur = aLanguages[ n ]; - ByteString sText = pStackData->sText[ sCur ]; - if ( !sText.Len()) - sText = sFallback; + ByteString sText = pStackData->sText[ sCur ]; + if ( !sText.Len()) + sText = sFallback; - Export::UnquotHTML( sText ); + Export::UnquotHTML( sText ); - ByteString sOutput( sPrj ); sOutput += "\t"; - sOutput += sPath; - sOutput += "\t0\t"; - sOutput += pStackData->sResTyp; sOutput += "\t"; - sOutput += sGroupId; sOutput += "\t"; - sOutput += sLocalId; sOutput += "\t\t\t0\t"; - sOutput += sCur; - sOutput += "\t"; + ByteString sOutput( sPrj ); sOutput += "\t"; + sOutput += sPath; + sOutput += "\t0\t"; + sOutput += pStackData->sResTyp; sOutput += "\t"; + sOutput += sGroupId; sOutput += "\t"; + sOutput += sLocalId; sOutput += "\t\t\t0\t"; + sOutput += sCur; + sOutput += "\t"; - sOutput += sText; sOutput += "\t\t\t\t"; - sOutput += sTimeStamp; + sOutput += sText; sOutput += "\t\t\t\t"; + sOutput += sTimeStamp; - pOutputStream->WriteLine( sOutput ); + pOutputStream->WriteLine( sOutput ); } } } diff --git a/l10ntools/source/directory.cxx b/l10ntools/source/directory.cxx index 97be7c2332fb..a7cba91f526b 100644 --- a/l10ntools/source/directory.cxx +++ b/l10ntools/source/directory.cxx @@ -54,12 +54,6 @@ Directory::Directory( const rtl::OUString sFullPath , const rtl::OUString sEntry sDirectoryName = sEntry; } - -Directory::Directory( const ByteString sFullPath ) : bSkipLinks( false ) -{ - sDirectoryName = rtl::OUString( sFullPath.GetBuffer() , RTL_TEXTENCODING_UTF8 , sFullPath.Len() ); -} - bool Directory::lessDir ( const Directory& rKey1, const Directory& rKey2 ) { rtl::OUString sName1( ( static_cast< Directory >( rKey1 ) ).getDirectoryName() ); diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index 69f1e967b13c..94f1650ef4b0 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -35,9 +35,10 @@ #include "tokens.h" #include <iostream> #include <vector> +#include <rtl/strbuf.hxx> -extern "C" { int yyerror( char * ); } -extern "C" { int YYWarning( char * ); } +extern "C" { int yyerror( const char * ); } +extern "C" { int YYWarning( const char * ); } Export *pExport = 0L; @@ -363,11 +364,14 @@ bool ResData::getFallbackData( ByteString& sId_in , ByteString& sText_inout ){ return sText_inout.Len() > 0; } -void ResData::addMergedLanguage( ByteString& sLang ){ - aMergedLanguages[ sLang ]=ByteString("1"); +void ResData::addMergedLanguage(rtl::OString& rLang) +{ + aMergedLanguages[rLang] = rtl::OString(RTL_CONSTASCII_STRINGPARAM("1")); } -bool ResData::isMerged( ByteString& sLang ){ - return aMergedLanguages[ sLang ].Equals("1"); + +bool ResData::isMerged(rtl::OString& rLang) +{ + return aMergedLanguages[rLang].equalsL(RTL_CONSTASCII_STRINGPARAM("1")); } /*****************************************************************************/ @@ -379,10 +383,10 @@ sal_Bool ResData::SetId( const ByteString &rId, sal_uInt16 nLevel ) nIdLevel = nLevel; sId = rId; - if ( bChild && bChildWithText ) { - ByteString sError( "ResId after child definition" ); - yyerror( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( bChild && bChildWithText ) + { + rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("ResId after child definition")); + yyerror(sError.getStr()); SetError(); } @@ -500,7 +504,7 @@ void Export::Init() bNextMustBeDefineEOL = sal_False; nLevel = 0; nList = LIST_NON; - nListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US ); + m_sListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US ); nListIndex = 0; for ( size_t i = 0, n = aResStack.size(); i < n; ++i ) delete aResStack[ i ]; @@ -789,21 +793,21 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "STRINGLIST" ) { pResData->bList = sal_True; nList = LIST_STRING; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "FILTERLIST" ) { pResData->bList = sal_True; nList = LIST_FILTER; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "UIENTRIES" ) { pResData->bList = sal_True; nList = LIST_UIENTRIES; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -830,14 +834,14 @@ int Export::Execute( int nToken, const char * pToken ) if ( sKey.ToUpperAscii() == "STRINGLIST" ) { pResData->bList = sal_True; nList = LIST_STRING; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "FILTERLIST" ) { pResData->bList = sal_True; nList = LIST_FILTER; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -845,7 +849,7 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "PAIREDLIST" ) { pResData->bList = sal_True; nList = LIST_PAIRED; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -853,14 +857,14 @@ int Export::Execute( int nToken, const char * pToken ) else if ( sKey == "ITEMLIST" ) { pResData->bList = sal_True; nList = LIST_ITEM; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } else if ( sKey == "UIENTRIES" ) { pResData->bList = sal_True; nList = LIST_UIENTRIES; - nListLang = SOURCE_LANGUAGE; + m_sListLang = SOURCE_LANGUAGE; nListIndex = 0; nListLevel = 0; } @@ -883,7 +887,7 @@ int Export::Execute( int nToken, const char * pToken ) if ( nList ) { ByteString sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' ); CleanValue( sLang ); - nListLang = sLang; + m_sListLang = sLang; nListIndex = 0; nListLevel = 0; } @@ -902,8 +906,9 @@ int Export::Execute( int nToken, const char * pToken ) if ( sEntry == "\\\"" ) sEntry = "\""; InsertListEntry( sEntry, sOrig ); - if ( bMergeMode && ( sEntry != "\"" )) { - PrepareTextToMerge( sOrig, nList, nListLang, pResData ); + if ( bMergeMode && ( sEntry != "\"" )) + { + PrepareTextToMerge( sOrig, nList, m_sListLang, pResData ); } } } @@ -926,7 +931,7 @@ int Export::Execute( int nToken, const char * pToken ) sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' ); CleanValue( sLang ); } - ByteString nLangIndex = sLang; + rtl::OString sLangIndex = sLang; ByteString sOrigKey = sKey; if ( sText.Len() && sLang.Len() ) { if (( sKey.ToUpperAscii() == "TEXT" ) || @@ -936,69 +941,82 @@ int Export::Execute( int nToken, const char * pToken ) ( sKey == "UINAME" )) { SetChildWithText(); - if ( Export::isSourceLanguage( nLangIndex ) ) + if ( Export::isSourceLanguage( sLangIndex ) ) pResData->SetId( sText, ID_LEVEL_TEXT ); pResData->bText = sal_True; pResData->sTextTyp = sOrigKey; if ( bMergeMode ) { - PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData ); + PrepareTextToMerge( sOrig, STRING_TYP_TEXT, sLangIndex, pResData ); } - else { - if ( pResData->sText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + else + { + if (pResData->sText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM("defined twice")); + yyerror(sError.getStr()); } - pResData->sText[ nLangIndex ] = sText; + pResData->sText[ sLangIndex ] = sText; } } else if ( sKey == "HELPTEXT" ) { SetChildWithText(); pResData->bHelpText = sal_True; - if ( bBreakWhenHelpText ) { - ByteString sError( "\"HelpText\" found in source\n" ); - YYWarning( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( bBreakWhenHelpText ) + { + rtl::OString sError( + RTL_CONSTASCII_STRINGPARAM("\"HelpText\" found in source\n")); + YYWarning(sError.getStr()); SetError(); } if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, nLangIndex, pResData ); - else { - if ( pResData->sHelpText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, sLangIndex, pResData ); + else + { + if (pResData->sHelpText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(" defined twice"); + YYWarning(sError.getStr()); } - pResData->sHelpText[ nLangIndex ] = sText; + pResData->sHelpText[ sLangIndex ] = sText; } } else if ( sKey == "QUICKHELPTEXT" ) { SetChildWithText(); pResData->bQuickHelpText = sal_True; if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData ); - else { - if ( pResData->sQuickHelpText[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, sLangIndex, pResData ); + else + { + if (pResData->sQuickHelpText[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice")); + YYWarning(sError.getStr()); } - pResData->sQuickHelpText[ nLangIndex ] = sText; + pResData->sQuickHelpText[ sLangIndex ] = sText; } } else if ( sKey == "TITLE" ) { SetChildWithText(); pResData->bTitle = sal_True; if ( bMergeMode ) - PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData ); - else { - if ( pResData->sTitle[ nLangIndex ].Len()) { - ByteString sError( "Language " ); - sError += nLangIndex; - sError += " defined twice"; + PrepareTextToMerge( sOrig, STRING_TYP_TITLE, sLangIndex, pResData ); + else + { + if ( pResData->sTitle[ sLangIndex ].getLength()) + { + rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language ")); + sError.append(sLangIndex); + sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice")); + YYWarning(sError.getStr()); } - pResData->sTitle[ nLangIndex ] = sText; + pResData->sTitle[ sLangIndex ] = sText; } } else if ( sKey == "ACCESSPATH" ) { @@ -1155,31 +1173,6 @@ void Export::CutComment( ByteString &rText ) } } -void Export::UnmergeUTF8( ByteString& sOrig ){ - sal_uInt16 nPos1 = sOrig.Search('\"'); - sal_uInt16 nPos2 = sOrig.SearchBackward('\"'); - if( nPos1 > 0 && nPos2 > 0 && nPos1 < nPos2){ - ByteString sPart = sOrig.Copy(nPos1+1 , nPos2-1); - ByteString sPartUTF8 = sPart; - sPartUTF8.Convert( RTL_TEXTENCODING_MS_1252 , RTL_TEXTENCODING_UTF8 ); - sOrig.SearchAndReplace( sPart , sPartUTF8 ); - } -} - -/*****************************************************************************/ -sal_Bool Export::ListExists( ResData *pResData, sal_uInt16 nLst ) -/*****************************************************************************/ -{ - switch ( nLst ) { - case LIST_STRING: return pResData->pStringList != NULL; - case LIST_FILTER: return pResData->pFilterList != NULL; - case LIST_ITEM: return pResData->pItemList != NULL; - case LIST_PAIRED: return pResData->pPairedList != NULL; - case LIST_UIENTRIES: return pResData->pUIEntries != NULL; - } - return sal_False; -} - /*****************************************************************************/ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) /*****************************************************************************/ @@ -1194,13 +1187,13 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) // mandatory to export: en-US - if (( pResData->sText[ SOURCE_LANGUAGE ].Len()) + if (( pResData->sText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len()) + ( pResData->sHelpText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len()) + ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].getLength()) || - ( pResData->sTitle[ SOURCE_LANGUAGE ].Len())) + ( pResData->sTitle[ SOURCE_LANGUAGE ].getLength())) { FillInFallbacks( pResData ); @@ -1223,35 +1216,35 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) for( unsigned int n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; if ( !sCur.EqualsIgnoreCaseAscii("x-comment") ){ - if ( pResData->sText[ sCur ].Len()) + if (pResData->sText[ sCur ].getLength()) sXText = pResData->sText[ sCur ]; else { sXText = pResData->sText[ SOURCE_LANGUAGE ]; } - if ( pResData->sHelpText[ sCur ].Len()) + if (pResData->sHelpText[ sCur ].getLength()) sXHText = pResData->sHelpText[ sCur ]; else { sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ]; } - if ( pResData->sQuickHelpText[ sCur ].Len()) + if (pResData->sQuickHelpText[ sCur ].getLength()) sXQHText = pResData->sQuickHelpText[ sCur ]; else { sXQHText = pResData->sQuickHelpText[ SOURCE_LANGUAGE ]; } - if ( pResData->sTitle[ sCur ].Len()) + if (pResData->sTitle[ sCur ].getLength()) sXTitle = pResData->sTitle[ sCur ]; - else { + else sXTitle = pResData->sTitle[ SOURCE_LANGUAGE ]; - } if ( !sXText.Len()) sXText = "-"; - if ( !sXHText.Len()) { - if ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len()) + if ( !sXHText.Len()) + { + if (pResData->sHelpText[ SOURCE_LANGUAGE ].getLength()) sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ]; } } @@ -1268,7 +1261,7 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) sOutput += sLID; sOutput += "\t"; sOutput += pResData->sHelpId; sOutput += "\t"; sOutput += pResData->sPForm; sOutput += "\t"; - sOutput += ByteString::CreateFromInt64( pResData->nWidth ); sOutput += "\t"; + sOutput += ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(pResData->nWidth))); sOutput += "\t"; sOutput += sCur; sOutput += "\t"; @@ -1369,45 +1362,48 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList, // ByteString a("Export::WriteExportList::pEntry"); // Export::DumpMap( a, *pEntry ); - ByteString sLID( ByteString::CreateFromInt64( i + 1 )); - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + ByteString sLID(rtl::OString::valueOf(static_cast<sal_Int64>(i + 1))); + for (unsigned int n = 0; n < aLanguages.size(); ++n) + { sCur = aLanguages[ n ]; - if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() ) + if ((*pEntry)[ SOURCE_LANGUAGE ].getLength()) + { + if ( bEnableExport ) { - if ( bEnableExport ) + ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] ); + + // Strip PairList Line String + if( rTyp.EqualsIgnoreCaseAscii("pairedlist") ) { - ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] ); - - // Strip PairList Line String - if( rTyp.EqualsIgnoreCaseAscii("pairedlist") ){ - sLID = GetPairedListID( sText ); - if ((*pEntry)[ sCur ].Len()) - sText = (*pEntry)[ sCur ]; - sText = GetPairedListString( sText ); - } - else{ - sText = StripList( (*pEntry)[ sCur ] ); - if( sText == "\\\"" ) - sText = "\""; - } + sLID = GetPairedListID( sText ); + if ((*pEntry)[ sCur ].getLength()) + sText = (*pEntry)[ sCur ]; + sText = GetPairedListString( sText ); + } + else + { + sText = StripList( (*pEntry)[ sCur ] ); + if( sText == "\\\"" ) + sText = "\""; + } - ByteString sOutput( sProject ); sOutput += "\t"; - if ( sRoot.Len()) - sOutput += sActFileName; - sOutput += "\t0\t"; - sOutput += rTyp; sOutput += "\t"; - sOutput += sGID; sOutput += "\t"; - sOutput += sLID; sOutput += "\t\t"; - sOutput += pResData->sPForm; sOutput += "\t0\t"; - sOutput += sCur; sOutput += "\t"; + ByteString sOutput( sProject ); sOutput += "\t"; + if ( sRoot.Len()) + sOutput += sActFileName; + sOutput += "\t0\t"; + sOutput += rTyp; sOutput += "\t"; + sOutput += sGID; sOutput += "\t"; + sOutput += sLID; sOutput += "\t\t"; + sOutput += pResData->sPForm; sOutput += "\t0\t"; + sOutput += sCur; sOutput += "\t"; - sOutput += sText; sOutput += "\t\t\t\t"; - sOutput += sTimeStamp; + sOutput += sText; sOutput += "\t\t\t\t"; + sOutput += sTimeStamp; - aOutput.WriteLine( sOutput ); + aOutput.WriteLine( sOutput ); - } } + } } if ( bCreateNew ) delete [] pEntry; @@ -1433,11 +1429,11 @@ ByteString Export::FullId() } } } - if ( sFull.Len() > 255 ) { - ByteString sError( "GroupId > 255 chars" ); - printf("GroupID = %s\n",sFull.GetBuffer()); - yyerror( sError.GetBufferAccess()); - sError.ReleaseBufferAccess(); + if ( sFull.Len() > 255 ) + { + rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("GroupId > 255 chars")); + printf("GroupID = %s\n", sFull.GetBuffer()); + yyerror(sError.getStr()); } return sFull; @@ -1493,21 +1489,22 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) else return; - if ( nListIndex + 1 > pList->size()) { + if ( nListIndex + 1 > pList->size()) + { ExportListEntry *pNew = new ExportListEntry(); - (*pNew)[ LIST_REFID ] = ByteString::CreateFromInt32( REFID_NONE ); - pList->push_back( pNew ); + (*pNew)[LIST_REFID] = rtl::OString::valueOf(static_cast<sal_Int32>(REFID_NONE)); + pList->push_back(pNew); } ExportListEntry *pCurEntry = (*pList)[ nListIndex ]; // For paired list use the line to set proper lid if( nList == LIST_PAIRED ){ - (*pCurEntry)[ nListLang ] = rLine; + (*pCurEntry)[ m_sListLang ] = rLine; }else - (*pCurEntry)[ nListLang ] = rText; + (*pCurEntry)[ m_sListLang ] = rText; // Remember en-US fallback string, so each list has the same amount of elements - if ( Export::isSourceLanguage( nListLang ) ) { + if ( Export::isSourceLanguage( m_sListLang ) ) { if( nList == LIST_PAIRED ){ const ByteString sPlist("pairedlist"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sId , GetPairedListID( rLine ) , sFilename ); @@ -1520,14 +1517,14 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) a.Append( "." ); a.Append( pResData->sId ); sal_Int64 x = nListIndex+1; - ByteString b( ByteString::CreateFromInt64( x ) ); + ByteString b(rtl::OString::valueOf(x)); ByteString sKey = MergeDataFile::CreateKey( sPlist , a , b , sFilename ); pResData->addFallbackData( sKey , rText ); } // new fallback } - if ( Export::isSourceLanguage( nListLang ) ) { + if ( Export::isSourceLanguage( m_sListLang ) ) { if( nList == LIST_PAIRED ){ (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine; } @@ -1537,7 +1534,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) pList->NewSourceLanguageListEntry(); } - //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ nListLang ].GetBuffer()); + //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ m_sListLang ].GetBuffer()); nListIndex++; } @@ -1752,10 +1749,8 @@ void Export::ConvertMergeContent( ByteString &rText ) rText += "\""; } -/*****************************************************************************/ -sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, - ByteString &nLangIndex, ResData *pResData ) -/*****************************************************************************/ +sal_Bool Export::PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp, + rtl::OString &rLangIndex, ResData *pResData) { // position to merge in: sal_uInt16 nStart = 0; @@ -1805,13 +1800,14 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, break; } - if ( pList ) { + if (pList) + { ExportListEntry *pCurEntry = (*pList)[ nListIndex - 1 ]; - if ( pCurEntry ) { + if ( pCurEntry ) + { rText = (*pCurEntry)[ SOURCE_LANGUAGE ]; - if( nTyp == LIST_PAIRED ){ - pResData->addMergedLanguage( nLangIndex ); - } + if( nTyp == LIST_PAIRED ) + pResData->addMergedLanguage(rLangIndex); } } @@ -1843,7 +1839,7 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, if ( pResData->sResTyp.EqualsIgnoreCaseAscii( "pairedlist" ) ){ pResData->sId = GetPairedListID( sLastListLine ); } - else pResData->sId = ByteString::CreateFromInt32( nListIndex ); + else pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(nListIndex)); if ( pResData->sGId.Len()) pResData->sGId += "."; @@ -1918,15 +1914,15 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp, } ByteString sContent; - pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex ); - if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) { + pEntrys->GetTransex3Text(sContent, nTyp, rLangIndex); + if (!sContent.Len() && (!Export::isSourceLanguage(rLangIndex))) + { rText = sOrigText; return sal_False; // no data found } - if ( Export::isSourceLanguage( nLangIndex ) ) { + if (Export::isSourceLanguage(rLangIndex)) return sal_False; - } ByteString sPostFix( rText.Copy( ++nEnd )); rText.Erase( nStart ); @@ -2128,8 +2124,9 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) case LIST_ITEM : pResData->sResTyp = "itemlist"; pList = pResData->pItemList; bPairedList = false; break; case LIST_PAIRED : pResData->sResTyp = "pairedlist"; pList = pResData->pPairedList; bPairedList = true; break; } - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + rtl::OString sCur; + for( unsigned int n = 0; n < aLanguages.size(); n++ ) + { sCur = aLanguages[ n ]; sal_uInt16 nIdx = 1; @@ -2155,46 +2152,65 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , sal_False ); // Use fallback, if data is missing in sdf file - if( !bText && bPairedList ){ - if( pResData->isMerged( sCur ) ) break; + if( !bText && bPairedList ) + { + if( pResData->isMerged( sCur ) ) + break; const ByteString sPlist("pairedlist"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename ); bText = pResData->getFallbackData( sKey , sText ); - }else if ( !bText ){// new fallback + } + else if ( !bText ) // new fallback + { if( pResData->isMerged( sCur ) ) break; const ByteString sPlist("list"); ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename ); bText = pResData->getFallbackData( sKey , sText ); } // new fallback - if ( bText && sText.Len()) { - if ( nIdx == 1 ) { - ByteString sHead; + if ( bText && sText.Len()) + { + if ( nIdx == 1 ) + { + rtl::OStringBuffer sHead; if ( bNextMustBeDefineEOL ) - sHead = "\\\n\t"; - sHead += sSpace; - switch ( nT ) { - case LIST_STRING : sHead += "StringList "; break; - case LIST_FILTER : sHead += "FilterList "; break; - case LIST_ITEM : sHead += "ItemList "; break; - case LIST_PAIRED : sHead += "PairedList "; break; - case LIST_UIENTRIES : sHead += "UIEntries "; break; + sHead.append(RTL_CONSTASCII_STRINGPARAM("\\\n\t")); + sHead.append(sSpace); + switch ( nT ) + { + case LIST_STRING: + sHead.append(RTL_CONSTASCII_STRINGPARAM("StringList ")); + break; + case LIST_FILTER: + sHead.append(RTL_CONSTASCII_STRINGPARAM("FilterList ")); + break; + case LIST_ITEM: + sHead.append(RTL_CONSTASCII_STRINGPARAM("ItemList ")); + break; + case LIST_PAIRED: + sHead.append(RTL_CONSTASCII_STRINGPARAM("PairedList ")); + break; + case LIST_UIENTRIES: + sHead.append(RTL_CONSTASCII_STRINGPARAM("UIEntries ")); + break; } - sHead += "[ "; - sHead += sCur; - sHead += " ] "; + sHead.append(RTL_CONSTASCII_STRINGPARAM("[ ")); + sHead.append(sCur); + sHead.append(RTL_CONSTASCII_STRINGPARAM(" ] ")); //} - if ( bDefine || bNextMustBeDefineEOL ) { - sHead += "= \\\n"; - sHead += sSpace; - sHead += "\t{\\\n\t"; + if ( bDefine || bNextMustBeDefineEOL ) + { + sHead.append(RTL_CONSTASCII_STRINGPARAM("= \\\n")); + sHead.append(sSpace); + sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\\\n\t")); } - else { - sHead += "= \n"; - sHead += sSpace; - sHead += "\t{\n\t"; + else + { + sHead.append(RTL_CONSTASCII_STRINGPARAM("= \n")); + sHead.append(sSpace); + sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\n\t")); } - WriteToMerged( sHead , true); + WriteToMerged(sHead.makeStringAndClear() , true); } ByteString sLine; if ( pList && (*pList)[ nLIndex ] ) @@ -2254,7 +2270,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) } } else - pResData->sId = ByteString::CreateFromInt32( ++nIdx ); + pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(++nIdx)); } else break; @@ -2316,7 +2332,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode ) } } - while( PrepareTextToMerge( sLine, nList, nListLang, pResData ) && ( nListIndex <= nMaxIndex )) { + while( PrepareTextToMerge( sLine, nList, m_sListLang, pResData ) && ( nListIndex <= nMaxIndex )) { ByteString sText( "\t" ); sText += sLine; sText += " ;"; diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 0b7fb44d8a95..d7d39a453511 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -140,75 +140,6 @@ std::vector<ByteString> Export::GetForcedLanguages(){ std::vector<ByteString> Export::aLanguages = std::vector<ByteString>(); std::vector<ByteString> Export::aForcedLanguages = std::vector<ByteString>(); - -/*****************************************************************************/ -void Export::QuotHTMLXRM( ByteString &rString ) -/*****************************************************************************/ -{ - ByteString sReturn; - for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) { - ByteString sTemp = rString.Copy( i ); - if ( sTemp.Search( "<Arg n=" ) == 0 ) { - while ( i < rString.Len() && rString.GetChar( i ) != '>' ) { - sReturn += rString.GetChar( i ); - i++; - } - if ( rString.GetChar( i ) == '>' ) { - sReturn += ">"; - i++; - } - } - - if ( i < rString.Len()) { - switch ( rString.GetChar( i )) { - case '<': - if( i+2 < rString.Len() && - (rString.GetChar( i+1 ) == 'b' || rString.GetChar( i+1 ) == 'B') && - rString.GetChar( i+2 ) == '>' ) - { - sReturn +="<b>"; - i += 2; - } - else if( i+3 < rString.Len() && - rString.GetChar( i+1 ) == '/' && - (rString.GetChar( i+2 ) == 'b' || rString.GetChar( i+2 ) == 'B') && - rString.GetChar( i+3 ) == '>' ) - { - sReturn +="</b>"; - i += 3; - } - else - sReturn += "<"; - break; - - case '>': - sReturn += ">"; - break; - - case '\"': - sReturn += """; - break; - - case '\'': - sReturn += "'"; - break; - - case '&': - if ((( i + 4 ) < rString.Len()) && - ( rString.Copy( i, 5 ) == "&" )) - sReturn += rString.GetChar( i ); - else - sReturn += "&"; - break; - - default: - sReturn += rString.GetChar( i ); - break; - } - } - } - rString = sReturn; -} /*****************************************************************************/ void Export::QuotHTML( ByteString &rString ) /*****************************************************************************/ @@ -402,12 +333,6 @@ bool Export::isSourceLanguage( const ByteString &sLanguage ) bool Export::isAllowed( const ByteString &sLanguage ){ return ! ( sLanguage.EqualsIgnoreCaseAscii("en-US") ); } -/*****************************************************************************/ -bool Export::LanguageAllowed( const ByteString &nLanguage ) -/*****************************************************************************/ -{ - return std::find( aLanguages.begin() , aLanguages.end() , nLanguage ) != aLanguages.end(); -} bool Export::isInitialized = false; @@ -452,52 +377,31 @@ ByteString Export::GetFallbackLanguage( const ByteString nLanguage ) return sFallback; } -void Export::replaceEncoding( ByteString& rString ) -{ -// ™ -> \u2122 - - for( xub_StrLen idx = 0; idx <= rString.Len()-8 ; idx++ ) - { - if( rString.GetChar( idx ) == '&' && - rString.GetChar( idx+1 ) == '#' && - rString.GetChar( idx+2 ) == 'x' && - rString.GetChar( idx+7 ) == ';' ) - { - ByteString sTmp = rString.Copy( 0 , idx ); - sTmp.Append( "\\u" ); - sTmp.Append( rString.GetChar( idx+3 ) ); - sTmp.Append( rString.GetChar( idx+4 ) ); - sTmp.Append( rString.GetChar( idx+5 ) ); - sTmp.Append( rString.GetChar( idx+6 ) ); - sTmp.Append( rString.Copy( idx+8 , rString.Len() ) ); - rString = sTmp; - } - } -} - /*****************************************************************************/ void Export::FillInFallbacks( ResData *pResData ) /*****************************************************************************/ { - ByteString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ - sCur = aLanguages[ n ]; - if( isAllowed( sCur ) ){ + for (size_t n = 0; n < aLanguages.size(); ++n) + { + ByteString sCur = aLanguages[ n ]; + if (isAllowed(sCur)) + { ByteString nFallbackIndex = GetFallbackLanguage( sCur ); - if( nFallbackIndex.Len() ){ - if ( !pResData->sText[ sCur ].Len()) + if( nFallbackIndex.Len() ) + { + if (pResData->sText[ sCur ].isEmpty()) pResData->sText[ sCur ] = pResData->sText[ nFallbackIndex ]; - if ( !pResData->sHelpText[ sCur ].Len()) + if (pResData->sHelpText[ sCur ].isEmpty()) pResData->sHelpText[ sCur ] = pResData->sHelpText[ nFallbackIndex ]; - if ( !pResData->sQuickHelpText[ sCur ].Len()) + if (pResData->sQuickHelpText[ sCur ].isEmpty()) pResData->sQuickHelpText[ sCur ] = pResData->sQuickHelpText[ nFallbackIndex ]; - if ( !pResData->sTitle[ sCur ].Len()) + if (!pResData->sTitle[ sCur ].isEmpty()) pResData->sTitle[ sCur ] = pResData->sTitle[ nFallbackIndex ]; @@ -530,11 +434,12 @@ void Export::FillInListFallbacks( ExportList *pList, const ByteString &nSource, const ByteString &nFallback ) /*****************************************************************************/ { - - for ( size_t i = 0; i < pList->size(); i++ ) { + for (size_t i = 0; i < pList->size(); ++i) + { ExportListEntry *pEntry = (*pList)[ i ]; - if ( !( *pEntry )[ nSource ].Len()){ - ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ]; + if ( (*pEntry )[nSource].isEmpty() ) + { + ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ]; ByteString x = ( *pEntry )[ nSource ]; ByteString y = ( *pEntry )[ nFallback ]; } @@ -611,15 +516,6 @@ const char* Export::GetEnv( const char *pVar ) return pRet; } - -int Export::getCurrentDirectory( rtl::OUString& base_fqurl_out, rtl::OUString& base_out ) -{ - DirEntry aDir("."); - aDir.ToAbs(); - base_out = rtl::OUString( aDir.GetFull() ); - return osl::File::getFileURLFromSystemPath( base_out , base_fqurl_out ); -} - void Export::getCurrentDir( string& dir ) { char buffer[64000]; @@ -667,12 +563,6 @@ void Export::getRandomName( const ByteString& sPrefix , ByteString& sRandStr , c sRandStr.Append( sPostfix ); } -void Export::getRandomName( ByteString& sRandStr ) -{ - const ByteString sEmpty; - getRandomName( sEmpty , sRandStr , sEmpty ); -} - /*****************************************************************************/ DirEntry Export::GetTempFile() /*****************************************************************************/ diff --git a/l10ntools/source/file.cxx b/l10ntools/source/file.cxx index d57c20d92c04..f87c24f59598 100644 --- a/l10ntools/source/file.cxx +++ b/l10ntools/source/file.cxx @@ -34,11 +34,6 @@ namespace transex { -File::File( const rtl::OUString sFile ) -{ - sFileName = sFile; -} - File::File( const rtl::OUString sFullPath , const rtl::OUString sFile ) { sFileName = sFile; diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 89fb66775d54..2fd8b8b540b1 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -32,7 +32,8 @@ #include <tools/fsys.hxx> #include <tools/stream.hxx> -// local includes +#include <rtl/strbuf.hxx> + #include "tagtest.hxx" #include "gsicheck.hxx" @@ -165,7 +166,10 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine ) // limit GID and LID to MAX_GID_LID_LEN chars each for database conformity, see #137575# if ( rLine.GetToken( 4, '\t' ).Len() > MAX_GID_LID_LEN || rLine.GetToken( 5, '\t' ).Len() > MAX_GID_LID_LEN ) { - PrintError( ByteString("GID and LID may only be ").Append( ByteString::CreateFromInt32(MAX_GID_LID_LEN) ).Append( " chars long each!" ), "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId() ); + PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("GID and LID may only be ")) + .append(static_cast<sal_Int32>(MAX_GID_LID_LEN)) + .append(RTL_CONSTASCII_STRINGPARAM(" chars long each!" )).getStr(), + "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId()); NotOK(); } } @@ -521,7 +525,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetText().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in Text at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Text at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -532,7 +538,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetQuickHelpText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetQuickHelpText().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in QuickHelpText at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in QuickHelpText at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -543,7 +551,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags ) if ( !IsUTF8( pTestee->GetTitle(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) ) { ByteString aContext( pTestee->GetTitle().Copy( nErrorPos, 20 ) ); - PrintError( aErrorMsg.Append(" in Title at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Title at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); bError = sal_True; if ( bHasBeenFixed ) { @@ -568,7 +578,9 @@ sal_Bool GSIBlock::HasSuspiciousChars( GSILine* pTestee, GSILine* pSource ) String aUTF8Tester = String( pTestee->GetText(), 0, nPos, RTL_TEXTENCODING_UTF8 ); sal_uInt16 nErrorPos = aUTF8Tester.Len(); ByteString aContext( pTestee->GetText().Copy( nPos, 20 ) ); - PrintError( ByteString("Found double questionmark in translation only. Looks like an encoding problem at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() ); + PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Found double questionmark in translation only. Looks like an encoding problem at Position ")) + .append(static_cast<sal_Int32>(nErrorPos)).getStr(), + "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId()); pTestee->NotOK(); return sal_True; } @@ -747,7 +759,8 @@ 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", ByteString::CreateFromInt32(MAX_GID_LID_LEN).GetBuffer() ); + fprintf( stdout, " checks for *new* KeyIDs and 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" ); fprintf( stdout, " [ -wcf CorrectFilename ] [ -s | -t ] [ -l LanguageID ]\n" ); diff --git a/l10ntools/source/help/HelpCompiler.cxx b/l10ntools/source/help/HelpCompiler.cxx index df2093931126..a3f2cd193a19 100644 --- a/l10ntools/source/help/HelpCompiler.cxx +++ b/l10ntools/source/help/HelpCompiler.cxx @@ -351,7 +351,7 @@ void myparser::traverse( xmlNodePtr parentNode ) embedded = std::string((const char*)embeddedxml); xmlFree (embeddedxml); std::transform (embedded.begin(), embedded.end(), - embedded.begin(), tolower); + embedded.begin(), tocharlower); } bool isEmbedded = !embedded.empty() && embedded.compare("true") == 0; @@ -437,7 +437,7 @@ bool HelpCompiler::compile( void ) throw( HelpProcessingException ) if (modulename[0] == 'S') { modulename = modulename.substr(1); - std::transform(modulename.begin(), modulename.end(), modulename.begin(), tolower); + std::transform(modulename.begin(), modulename.end(), modulename.begin(), tocharlower); } if (modulename != "DEFAULT" && modulename != module) continue; diff --git a/l10ntools/source/help/HelpCompiler.hxx b/l10ntools/source/help/HelpCompiler.hxx index 016f7eefb8bc..6642d571c67b 100644 --- a/l10ntools/source/help/HelpCompiler.hxx +++ b/l10ntools/source/help/HelpCompiler.hxx @@ -108,7 +108,7 @@ namespace fs { ::rtl::OUString ustrSystemPath; osl::File::getSystemPathFromFileURL(data, ustrSystemPath); - return ustrSystemPath.getStr(); + return (wchar_t const *) ustrSystemPath.getStr(); } #endif std::string native_directory_string() const { return native_file_string(); } @@ -322,6 +322,11 @@ private: bool bExtensionMode; }; +inline char tocharlower(char c) +{ + return static_cast<char>(tolower(c)); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 81a96ce37899..b1d7c1c2e849 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -351,7 +351,7 @@ void HelpLinker::addBookmark( DB* dbBase, FILE* pFile_DBHelp, std::string thishi size_t i = 0; dataB[i++] = static_cast<unsigned char>(fileLen); for (size_t j = 0; j < fileB.length(); ++j) - dataB[i++] = fileB[j]; + dataB[i++] = static_cast<unsigned char>(fileB[j]); if (!anchorB.empty()) { dataB[i++] = '#'; @@ -386,7 +386,7 @@ void HelpLinker::initIndexerPreProcessor() if( m_pIndexerPreProcessor ) delete m_pIndexerPreProcessor; std::string mod = module; - std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + std::transform (mod.begin(), mod.end(), mod.begin(), tocharlower); m_pIndexerPreProcessor = new IndexerPreProcessor( mod, indexDirParentName, idxCaptionStylesheet, idxContentStylesheet ); } @@ -413,7 +413,7 @@ void HelpLinker::link() throw( HelpProcessingException ) #endif std::string mod = module; - std::transform (mod.begin(), mod.end(), mod.begin(), tolower); + std::transform (mod.begin(), mod.end(), mod.begin(), tocharlower); // do the work here // continue with introduction of the overall process thing into the @@ -666,7 +666,7 @@ void HelpLinker::link() throw( HelpProcessingException ) if (document) { std::string temp = module; - std::transform (temp.begin(), temp.end(), temp.begin(), tolower); + std::transform (temp.begin(), temp.end(), temp.begin(), tocharlower); m_pIndexerPreProcessor->processDocument(document, URLEncoder::encode(documentPath) ); } } diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index 9203fd94b5e7..ccb45e47105f 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -88,26 +88,29 @@ void HelpParser::FillInFallbacks( LangHashMap& rElem_out, ByteString sLangIdx_in } } -/*****************************************************************************/ -void HelpParser::Dump(XMLHashMap* rElem_in) { -/*****************************************************************************/ - for(XMLHashMap::iterator pos = rElem_in->begin();pos != rElem_in->end(); ++pos){ +#if OSL_DEBUG_LEVEL > 2 +void HelpParser::Dump(XMLHashMap* rElem_in) +{ + for(XMLHashMap::iterator pos = rElem_in->begin();pos != rElem_in->end(); ++pos) + { Dump(pos->second,pos->first); } } -/*****************************************************************************/ -void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in) { -/*****************************************************************************/ + +void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in) +{ ByteString x; OString y; fprintf(stdout,"+------------%s-----------+\n",sKey_in.GetBuffer() ); - for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn){ + for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn) + { x=posn->first; y=posn->second->ToOString(); fprintf(stdout,"key=%s value=%s\n",x.GetBuffer(),y.getStr()); } fprintf(stdout,"+--------------------------+\n"); } +#endif HelpParser::HelpParser( const ByteString &rHelpFile, bool rUTF8 , bool rHasInputList ) : sHelpFile( rHelpFile ), @@ -436,9 +439,11 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile { aLangHM = pos->second; - //printf("*********************DUMPING HASHMAP***************************************"); - //Dump( aXMLStrHM ); - //printf("DBG: sHelpFile = %s\n",sHelpFile.GetBuffer() ); +#if OSL_DEBUG_LEVEL > 2 + printf("*********************DUMPING HASHMAP***************************************"); + Dump(aXMLStrHM); + printf("DBG: sHelpFile = %s\n",sHelpFile.GetBuffer() ); +#endif pResData.sGId = pos->first; pResData.sFilename = sHelpFile; @@ -454,7 +459,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile static const ByteString INPATH = Export::GetEnv( "INPATH" ); Export::getRandomName( sPath , sTempFile , INPATH ); - Export::getRandomName( sPath , sTempFileCopy , INPATH ); + Export::getRandomName( sPath , sTempFileCopy , INPATH ); // Write in the temp file bool hasNoError = file->Write ( sTempFile ); if( !hasNoError ) @@ -628,77 +633,5 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re } } -/* Process() Method merges */ -void HelpParser::Process( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ){ - - XMLElement* pXMLElement = NULL; - PFormEntrys *pEntrys = NULL; - XMLData *data = NULL; - XMLParentNode *parent = NULL; - XMLDefault *xmldefault = NULL; - - short curLang = 0; - String sNewdata; - bool isFallback = false; - ByteString sLId; - ByteString sGId; - - pEntrys = NULL; - -#ifdef MERGE_SOURCE_LANGUAGES - if( true ){ // Merge en-US! -#else - if( !sCur.EqualsIgnoreCaseAscii("en-US") ){ -#endif - pXMLElement = (*aLangHM)[ sCur ]; - if( pXMLElement == NULL ) - { - FillInFallbacks( *aLangHM , sCur ); - pXMLElement = ( *aLangHM )[ sCur ]; - isFallback = true; - } - if( pXMLElement != NULL ) - { - parent = pXMLElement->GetParent(); - sLId = pXMLElement->GetOldref(); - pResData->sId = sLId; - - pEntrys = aMergeDataFile.GetPFormEntrys( pResData ); - if( pEntrys != NULL) - { - ByteString sNewText; - pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur , true ); - sNewdata = String( sNewText , RTL_TEXTENCODING_UTF8 ); - if ( sNewdata.Len()) - { - printf("Entries found\n"); - if( pXMLElement != NULL ) - { - data = new XMLData( sNewdata , NULL , true ); // Add new one - if( pXMLElement->ToOUString().compareTo( OUString(data->GetData()) ) != 0 ) - { - pXMLElement->RemoveAndDeleteAllChilds(); - pXMLElement->AddChild( data ); - } - if( isFallback ) - { - xmldefault = new XMLDefault( String::CreateFromAscii("\n") , NULL ); - int pos = parent->GetPosition( pXMLElement->GetId() ); - if( pos != -1 ){ - parent->AddChild(xmldefault , pos+1 ); - parent->AddChild(pXMLElement , pos+2 ); - } - else fprintf(stdout,"ERROR: Can't find reference Element of id %s language %d\n",pXMLElement->GetId().GetBuffer(),curLang); - } - - aLangHM->erase( sCur ); - } - } - delete pResData; - }else if( pResData == NULL ){fprintf(stdout,"Can't find GID=%s LID=%s TYP=%s\n",pResData->sGId.GetBuffer(),pResData->sId.GetBuffer(),pResData->sResTyp.GetBuffer());} - } - - } -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index e89640015773..7af3293775f7 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -316,10 +316,13 @@ sal_Bool LngParser::Merge( nPos++; } ByteString sCur; - if ( nLastLangPos ) { - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + if ( nLastLangPos ) + { + for(size_t n = 0; n < aLanguages.size(); ++n) + { sCur = aLanguages[ n ]; - if( !sCur.EqualsIgnoreCaseAscii("en-US") && !Text[ sCur ].Len() && pEntrys ) { + if( !sCur.EqualsIgnoreCaseAscii("en-US") && Text[sCur].isEmpty() && pEntrys ) + { ByteString sNewText; pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True ); diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index a0c3775b9ee7..9cacee6bebd6 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -204,13 +204,6 @@ private: const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); - sal_Bool ExecuteMerge(); - 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(); @@ -221,7 +214,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 ); }; @@ -563,257 +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; -} -/*****************************************************************************/ -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<int>(aErr)); - } - } - return bReturn; - -} - -/*****************************************************************************/ -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; diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 35a61211bdbb..12ce24323cb9 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -155,14 +155,6 @@ PFormEntrys* MergeData::GetPFObject( const ByteString& rPFO ){ return NULL; } - -PFormEntrys *MergeData::InsertEntry( const ByteString &rPForm ) -{ - PFormEntrys* pFEntrys = new PFormEntrys( rPForm ); - aMap.insert( PFormEntrysHashMap::value_type( rPForm , pFEntrys ) ); - return pFEntrys; -} - sal_Bool MergeData::operator==( ResData *pData ) { ByteString sResTyp_upper( pData->sResTyp ); @@ -269,18 +261,6 @@ ByteString MergeDataFile::Dump(){ return sRet; } -void MergeDataFile::WriteError( const ByteString &rLine ) -{ - if ( bErrorLog ) - { - if ( !aErrLog.IsOpen()) - aErrLog.Open( String( sErrorLog, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC ); - aErrLog.WriteLine( rLine ); - } - else - fprintf( stderr, "%s\n", rLine.GetBuffer()); -} - std::vector<ByteString> MergeDataFile::GetLanguages(){ return std::vector<ByteString>(aLanguageSet.begin(),aLanguageSet.end()); } diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx index c3706aa4cd30..1389cfec4749 100644 --- a/l10ntools/source/tagtest.cxx +++ b/l10ntools/source/tagtest.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_l10ntools.hxx" #include <tools/string.hxx> +#include <rtl/strbuf.hxx> #include "tagtest.hxx" #if OSL_DEBUG_LEVEL > 1 @@ -1342,20 +1343,21 @@ void TokenParser::ParseError( sal_uInt16 nErrNr, ByteString aErrMsg, const Token ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag ) : nErrorNr( PnErrorNr ) - , aErrorText( PaErrorText ) , nTagBegin( 0 ) , nTagLength( 0 ) { String aLexem( SimpleParser::GetLexem( rTag ) ); - aErrorText.Append(": "); - aErrorText += ByteString( aLexem, RTL_TEXTENCODING_UTF8 ); + rtl::OStringBuffer aErrorBuffer(PaErrorText); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(": ")); + aErrorBuffer.append(rtl::OUStringToOString(aLexem, RTL_TEXTENCODING_UTF8)); if ( rTag.nId == TAG_NOMORETAGS ) - aErrorText.Append(" at end of line "); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at end of line ")); else if ( rTag.nPos != TOK_INVALIDPOS ) { - aErrorText.Append(" at Position "); - aErrorText.Append( ByteString::CreateFromInt32( rTag.nPos ) ); + aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at Position ")); + aErrorBuffer.append(static_cast<sal_Int32>(rTag.nPos)); } + aErrorText = aErrorBuffer.makeStringAndClear(); nTagBegin = rTag.nPos; nTagLength = aLexem.Len(); } diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l index 6229525d7e84..034812cf61f5 100644 --- a/l10ntools/source/xrmlex.l +++ b/l10ntools/source/xrmlex.l @@ -144,7 +144,7 @@ int yywrap(void) } /*****************************************************************************/ -void YYWarning( char *s ) +void YYWarning( const char *s ) /*****************************************************************************/ { /* write warning to stderr */ @@ -154,9 +154,9 @@ void YYWarning( char *s ) /*****************************************************************************/ #ifdef GCC -void yyerror ( char *s, ... ) +void yyerror ( const char *s, ... ) #else -void yyerror ( char *s ) +void yyerror ( const char *s ) #endif /*****************************************************************************/ { diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 875fd457cf93..064d908ae04f 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -526,14 +526,16 @@ void XRMResExport::WorkOnText( { ByteString sLang( GetAttribute( rOpenTag, "xml:lang" )); - if ( !pResData ) { - ByteString sPlatform( "" ); - pResData = new ResData( sPlatform, GetGID() ); - pResData->sId = GetLID(); - } + if ( !pResData ) + { + ByteString sPlatform( "" ); + pResData = new ResData( sPlatform, GetGID() ); + pResData->sId = GetLID(); + } - pResData->sText[ sLang ] = rText; - ConvertStringToDBFormat( pResData->sText[ sLang ] ); + ByteString sText(rText); + ConvertStringToDBFormat(sText); + pResData->sText[sLang] = sText; } /*****************************************************************************/ @@ -648,7 +650,6 @@ void XRMResMerge::WorkOnText( { rText = sContent; ConvertStringToXMLFormat( rText ); - //Export::QuotHTMLXRM( rText ); } } } |