summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorOliver Günther <mail@oliverguenther.de>2012-08-11 23:01:00 +0000
committerPhilipp Riemer <ruderphilipp@gmail.com>2012-08-19 21:26:59 +0200
commit9cadf9bdf3c9210d9b79eaaed32282d6b7bf9e12 (patch)
treebf2a2f36a9ba8e57f34d4ad4636819d014c338e2 /tools
parentc55a340a992199c5eb2d8b9cbe2fea539c6f83aa (diff)
fdo#39468: Translated German comments in core/tools/source
Change-Id: I28ec097a70a8d71312d9e8382c3cf71a1eabde88
Diffstat (limited to 'tools')
-rw-r--r--tools/source/datetime/tdate.cxx4
-rw-r--r--tools/source/datetime/ttime.cxx20
-rw-r--r--tools/source/fsys/dirent.cxx177
-rw-r--r--tools/source/fsys/filecopy.cxx14
-rw-r--r--tools/source/fsys/tdir.cxx44
-rw-r--r--tools/source/fsys/unx.cxx17
-rw-r--r--tools/source/fsys/wldcrd.cxx19
-rw-r--r--tools/source/fsys/wntmsc.cxx42
-rw-r--r--tools/source/generic/b3dtrans.cxx54
-rw-r--r--tools/source/generic/bigint.cxx73
-rw-r--r--tools/source/generic/config.cxx109
-rw-r--r--tools/source/generic/fract.cxx128
-rw-r--r--tools/source/generic/gen.cxx10
-rw-r--r--tools/source/generic/poly.cxx49
-rw-r--r--tools/source/generic/poly2.cxx34
-rw-r--r--tools/source/generic/svborder.cxx4
-rw-r--r--tools/source/memtools/multisel.cxx18
-rw-r--r--tools/source/memtools/unqidx.cxx23
-rw-r--r--tools/source/rc/resmgr.cxx41
-rw-r--r--tools/source/ref/errinf.cxx55
-rw-r--r--tools/source/ref/globname.cxx3
-rw-r--r--tools/source/ref/pstm.cxx225
-rw-r--r--tools/source/stream/cachestr.cxx5
-rw-r--r--tools/source/stream/stream.cxx123
-rw-r--r--tools/source/stream/strmunx.cxx18
-rw-r--r--tools/source/stream/strmwnt.cxx30
-rw-r--r--tools/source/string/strascii.cxx82
-rw-r--r--tools/source/string/strimp.cxx102
-rw-r--r--tools/source/string/tustring.cxx122
29 files changed, 732 insertions, 913 deletions
diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
index f49433a1c4ba..2cb3ab048cca 100644
--- a/tools/source/datetime/tdate.cxx
+++ b/tools/source/datetime/tdate.cxx
@@ -238,7 +238,7 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay,
// saturday
else if ( n1WDay == nMinimumNumberOfDaysInWeek + 1 )
{
- // Jahr nach Schaltjahr
+ // Year after leapyear
if ( Date( 1, 1, GetYear()-1 ).IsLeapYear() )
nWeek = 53;
else
@@ -256,7 +256,7 @@ sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay,
nWeek = (nDayOfYear + n1WDay) / 7;
if ( nWeek == 53 )
{
- // next x_Sonntag == first x_Sonntag in the new year
+ // next x_Sunday == first x_Sunday in the new year
// == still the same week!
long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
nTempDays += 6 - (GetDayOfWeek()+(7-(short)eStartDay)) % 7;
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
index 966771862811..b32c09078e40 100644
--- a/tools/source/datetime/ttime.cxx
+++ b/tools/source/datetime/ttime.cxx
@@ -41,7 +41,7 @@ static sal_Int32 TimeToSec100( const Time& rTime )
sal_Int32 nSec = rTime.GetSec();
sal_Int32 n100Sec = rTime.Get100Sec();
-// Wegen Interal Compiler Error bei MSC, etwas komplizierter
+// Due to interal compiler error in MSC a little bit more complicated:
// return (n100Sec + (nSec*100) + (nMin*60*100) + (nHour*60*60*100) * nSign);
sal_Int32 nRet = n100Sec;
@@ -74,7 +74,7 @@ Time::Time( TimeInitSystem )
SYSTEMTIME aDateTime;
GetLocalTime( &aDateTime );
- // Zeit zusammenbauen
+ // construct time
nTime = (((sal_Int32)aDateTime.wHour)*1000000) +
(((sal_Int32)aDateTime.wMinute)*10000) +
(((sal_Int32)aDateTime.wSecond)*100) +
@@ -83,10 +83,10 @@ Time::Time( TimeInitSystem )
time_t nTmpTime;
struct tm aTime;
- // Zeit ermitteln
+ // determine time
nTmpTime = time( 0 );
- // Zeit zusammenbauen
+ // construct time
if ( localtime_r( &nTmpTime, &aTime ) )
{
nTime = (((sal_Int32)aTime.tm_hour)*1000000) +
@@ -105,7 +105,7 @@ Time::Time( const Time& rTime )
Time::Time( sal_uIntPtr nHour, sal_uIntPtr nMin, sal_uIntPtr nSec, sal_uIntPtr n100Sec )
{
- // Zeit normalisieren
+ // normalize time
nSec += n100Sec / 100;
n100Sec = n100Sec % 100;
nMin += nSec / 60;
@@ -113,7 +113,7 @@ Time::Time( sal_uIntPtr nHour, sal_uIntPtr nMin, sal_uIntPtr nSec, sal_uIntPtr n
nHour += nMin / 60;
nMin = nMin % 60;
- // Zeit zusammenbauen
+ // construct time
nTime = (sal_Int32)(n100Sec + (nSec*100) + (nMin*10000) + (nHour*1000000));
}
@@ -135,7 +135,7 @@ void Time::SetMin( sal_uInt16 nNewMin )
sal_Int32 nSec = GetSec();
sal_Int32 n100Sec = Get100Sec();
- // kein Ueberlauf
+ // no overflow
nNewMin = nNewMin % 60;
nTime = (n100Sec + (nSec*100) + (((sal_Int32)nNewMin)*10000) +
@@ -149,7 +149,7 @@ void Time::SetSec( sal_uInt16 nNewSec )
sal_Int32 nMin = GetMin();
sal_Int32 n100Sec = Get100Sec();
- // kein Ueberlauf
+ // no overflow
nNewSec = nNewSec % 60;
nTime = (n100Sec + (((sal_Int32)nNewSec)*100) + (nMin*10000) +
@@ -163,7 +163,7 @@ void Time::Set100Sec( sal_uInt16 nNew100Sec )
sal_Int32 nMin = GetMin();
sal_Int32 nSec = GetSec();
- // kein Ueberlauf
+ // no overflow
nNew100Sec = nNew100Sec % 100;
nTime = (((sal_Int32)nNew100Sec) + (nSec*100) + (nMin*10000) +
@@ -271,7 +271,7 @@ Time Time::GetUTCOffset()
sal_Int32 nUTC;
short nTempTime;
- // Evt. Wert neu ermitteln
+ // determine value again if needed
if ( (nCacheSecOffset == -1) ||
((nTicks - nCacheTicks) > 360000) ||
( nTicks < nCacheTicks ) // handle overflow
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 8a729cc1a692..919e1c9a978e 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -248,11 +248,11 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
do
{
- // den Namen vor dem ersten "\\" abspalten,
- // falls '\\' am Anfang, ist der Name '\\',
- // der Rest immer ohne die fuehrenden '\\'.
- // ein ":" trennt ebenfalls, gehoert aber zum Namen
- // den ersten '\\', '/' oder ':' suchen
+ // split name before first "\\",
+ // if '\\' is at beginning of string, name is set to '\\'.
+ // ":" also splits the string and belongs to the name.
+
+ // search first occurance of '\\', '/' or ':'
sal_uInt16 nPos;
for ( nPos = 0;
nPos < aPfad.Len() && //?O
@@ -261,7 +261,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
nPos++ )
/* do nothing */;
- // ist der Name ein UNC Pathname?
+ // is the name a UNC pathname?
if ( nPos == 0 && aPfad.Len() > 1 &&
( ( aPfad.GetChar(0) == '\\' && aPfad.GetChar(1) == '\\' ) ||
( aPfad.GetChar(0) == '/' && aPfad.GetChar(1) == '/' ) ) )
@@ -272,37 +272,36 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
aName = rtl::OUStringToOString(aPfad.Copy( 2, nPos-2 ), osl_getThreadTextEncoding());
aStack.Push( new DirEntry( aName, FSYS_FLAG_ABSROOT ) );
}
- // ist der Name die Root des aktuellen Drives?
+ // Is the name the root of the current drive?
else if ( nPos == 0 && aPfad.Len() > 0 &&
( aPfad.GetChar(0) == '\\' || aPfad.GetChar(0) == '/' ) )
{
- // Root-Directory des aktuellen Drives
+ // Push root directory of current drive
aStack.Push( new DirEntry( FSYS_FLAG_ABSROOT ) );
}
else
{
- // ist der Name ein Drive?
+ // Is the name itself a drive?
if ( nPos < aPfad.Len() && aPfad.GetChar(nPos) == ':' )
{
aName = rtl::OUStringToOString(aPfad.Copy( 0, nPos + 1 ), osl_getThreadTextEncoding());
- // ist der Name die Root des Drives
+ // Is the name the root of a drive?
if ( (nPos + 1) < aPfad.Len() &&
( aPfad.GetChar(nPos+1) == '\\' || aPfad.GetChar(nPos+1) == '/' ) )
{
- // schon was auf dem Stack?
- // oder Novell-Format? (not supported wegen URLs)
+ // unsupported if stack not empty or is a Novell format (URL)
if ( !aStack.Empty() || aName.getLength() > 2 )
{
aName = rPfad;
return FSYS_ERR_MISPLACEDCHAR;
}
- // Root-Directory des Drive
+ // Push as root directory of drive
aStack.Push( new DirEntry( aName, FSYS_FLAG_ABSROOT ) );
}
else
{
- // liegt ein anderes Drive auf dem Stack?
+ // clear stack if another drive is currently on it
if ( !aStack.Empty() )
{
rtl::OString aThis(aStack.Bottom()->aName);
@@ -313,48 +312,45 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
aStack.Clear();
}
- // liegt jetzt nichts mehr auf dem Stack?
if ( aStack.Empty() )
aStack.Push( new DirEntry( aName, FSYS_FLAG_RELROOT ) );
}
}
-
- // es ist kein Drive
+ // Name is not a drive
else
{
- // den Namen ohne Trenner abspalten
+ // split the name without seperator
aName = rtl::OUStringToOString(aPfad.Copy( 0, nPos ), osl_getThreadTextEncoding());
- // stellt der Name die aktuelle Directory dar?
+ // Is the name the current directory?
if ( aName == "." )
/* do nothing */;
- // stellt der Name die Parent-Directory dar?
+ // Is the name the parent directory?
else if ( aName == ".." )
{
- // ist nichts, ein Parent oder eine relative Root
- // auf dem Stack?
+ // Is the stack empty, or a parent (or relative root) on it?
if ( ( aStack.Empty() ) ||
( aStack.Top()->eFlag == FSYS_FLAG_PARENT ) ||
( aStack.Top()->eFlag == FSYS_FLAG_RELROOT ) )
- // fuehrende Parents kommen auf den Stack
+ // add leading parent to stack
aStack.Push( new DirEntry( FSYS_FLAG_PARENT ) );
- // ist es eine absolute Root
+ // It's an absolute root path
else if ( aStack.Top()->eFlag == FSYS_FLAG_ABSROOT )
{
- // die hat keine Parent-Directory
+ // Then there is no parent directory
aName = rPfad;
return FSYS_ERR_NOTEXISTS;
}
else
- // sonst hebt der Parent den TOS auf
+ // Otherwise removee parent TOS
delete aStack.Pop();
}
else
{
- // normalen Entries kommen auf den Stack
+ // add ordinary entries to the stack
DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL );
if ( !pNew->IsValid() )
{
@@ -368,7 +364,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
}
}
- // den Restpfad bestimmen
+ // determine remainder of path
aPfad.Erase( 0, nPos + 1 );
while ( aPfad.Len() && ( aPfad.GetChar(0) == '\\' || aPfad.GetChar(0) == '/' ) )
aPfad.Erase( 0, 1 );
@@ -376,7 +372,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
while ( aPfad.Len() );
sal_uIntPtr nErr = ERRCODE_NONE;
- // Haupt-Entry (selbst) zuweisen
+ // Set the main entry itself
if ( aStack.Empty() )
{
eFlag = FSYS_FLAG_CURRENT;
@@ -390,59 +386,59 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
delete aStack.Pop();
}
- // die Parent-Entries vom Stack holen
- DirEntry** pTemp = &pParent; // Zeiger auf den Member pParent setzen
+ // pop parent entry from stack
+ DirEntry** pTemp = &pParent;
while ( !aStack.Empty() )
{
*pTemp = aStack.Pop();
- // Zeiger auf den Member pParent des eigenen Parent setzen
+ // set member pointer to the pParent of the member's own parent
pTemp = &( (*pTemp)->pParent );
}
- // wird damit ein Volume beschrieben?
+ // Does this describe a volume?
if ( !pParent && eFlag == FSYS_FLAG_RELROOT && !aName.isEmpty() )
eFlag = FSYS_FLAG_VOLUME;
- // bei gesetztem ErrorCode den Namen komplett "ubernehmen
+ // use full aName if error code was set
if ( nErr )
aName = rPfad;
return nErr;
#else
DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
- // die einzelnen Namen auf einen Stack packen
+ // Add single names to the stack
DirEntryStack aStack;
rtl::OString aPfad(rPfad);
do
{
- // den Namen vor dem ersten "/" abspalten,
- // falls '/' am Anfang, ist der Name '/',
- // der Rest immer ohne die fuehrenden '/'.
- // den ersten '/' suchen
+ // split names on the first occurance of "/",
+ // if '/' starts the string, it itself becomes the name
+
+ // search first occurance of "/"
sal_uInt16 nPos;
for ( nPos = 0;
nPos < aPfad.getLength() && aPfad[nPos] != '/';
nPos++ )
/* do nothing */;
- // ist der Name die Root des aktuellen Drives?
+ // is the name the root of the current drive?
if ( nPos == 0 && !aPfad.isEmpty() && ( aPfad[0] == '/' ) )
{
- // Root-Directory des aktuellen Drives
+ // push root directory of current drive to stack
aStack.Push( new DirEntry( FSYS_FLAG_ABSROOT ) );
}
else
{
- // den Namen ohne Trenner abspalten
+ // split name without seperator
aName = aPfad.copy(0, nPos);
- // stellt der Name die aktuelle Directory dar?
+ // Is the name the current directory?
if ( aName == "." )
/* do nothing */;
#ifdef UNX
- // stellt der Name das User-Dir dar?
+ // Is the name the user's home directory?
else if ( aName == "~" )
{
DirEntry aHome( String( (const char *) getenv( "HOME" ), osl_getThreadTextEncoding()) );
@@ -450,30 +446,29 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
aStack.Push( new DirEntry( aHome[ (sal_uInt16) n-1 ] ) );
}
#endif
- // stellt der Name die Parent-Directory dar?
+ // Is the name the current parent directory?
else if ( aName == ".." )
{
- // ist nichts, ein Parent oder eine relative Root
- // auf dem Stack?
+ // Is the stack empty, or a parent (or relative root) is on top?
if ( ( aStack.Empty() ) || ( aStack.Top()->eFlag == FSYS_FLAG_PARENT ) )
{
- // fuehrende Parents kommen auf den Stack
+ // push leading parents to stack
aStack.Push( new DirEntry(rtl::OString(), FSYS_FLAG_PARENT) );
}
- // ist es eine absolute Root
+ // Is the name an absolute root?
else if ( aStack.Top()->eFlag == FSYS_FLAG_ABSROOT )
{
- // die hat keine Parent-Directory
+ // they do not have parent directories
return FSYS_ERR_NOTEXISTS;
}
else
- // sonst hebt der Parent den TOS auf
+ // otherwise remove parent TOS from stack
delete aStack.Pop();
}
else
{
DirEntry *pNew = NULL;
- // normalen Entries kommen auf den Stack
+ // push ordinary entries on the stack
pNew = new DirEntry( aName, FSYS_FLAG_NORMAL );
if ( !pNew->IsValid() )
{
@@ -486,7 +481,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
}
}
- // den Restpfad bestimmen
+ // get remainder of path
aPfad = nPos < aPfad.getLength()
? aPfad.copy(nPos + 1) : rtl::OString();
while ( !aPfad.isEmpty() && ( aPfad[0] == '/' ) )
@@ -494,7 +489,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
}
while (!aPfad.isEmpty());
- // Haupt-Entry (selbst) zuweisen
+ // insert main entry itself
if ( aStack.Empty() )
{
eFlag = FSYS_FLAG_CURRENT;
@@ -507,7 +502,7 @@ FSysError DirEntry::ImpParseName( const rtl::OString& rPfad )
delete aStack.Pop();
}
- // die Parent-Entries vom Stack holen
+ // Get parent entries from stack
DirEntry** pTemp = &pParent;
while ( !aStack.Empty() )
{
@@ -530,7 +525,7 @@ static FSysPathStyle GetStyle( FSysPathStyle eStyle )
/** Convert name to match OS norm. */
void DirEntry::ImpTrim()
{
- // Wildcards werden nicht geclipt
+ // Do not trim wildcard characters
if ( ( aName.indexOf( '*' ) != -1 ) ||
( aName.indexOf( '?' ) != -1 ) ||
( aName.indexOf( ';' ) != -1 ) )
@@ -598,7 +593,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
pParent = NULL;
- // schnelle Loesung fuer Leerstring
+ // faster check for empty string
if ( !rInitName.Len())
{
eFlag = FSYS_FLAG_CURRENT;
@@ -652,7 +647,7 @@ DirEntry::DirEntry( const rtl::OString& rInitName, FSysPathStyle eStyle )
pParent = NULL;
- // schnelle Loesung fuer Leerstring
+ // faster check for empty string
if ( rInitName.isEmpty() )
{
eFlag = FSYS_FLAG_CURRENT;
@@ -757,7 +752,7 @@ sal_Bool DirEntry::Exists( FSysAccess nAccess ) const
return sal_False;
#if defined WNT
- // spezielle Filenamen sind vom System da
+ // get special file names from system
if ( aName.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("CLOCK$")) ||
aName.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("CON")) ||
aName.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("AUX")) ||
@@ -853,7 +848,7 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter,
rtl::OString aRet = aBuf.makeStringAndClear();
- //! noch ein Hack
+ // HACK
if ( nMaxChars < STRING_MAXLEN )
aRet = ImplCutPath( aRet, nMaxChars, ACCESSDELIM_C(eStyle) );
@@ -881,7 +876,7 @@ String DirEntry::GetExtension( char cSep ) const
if ( p1 >= p0 )
{
- // es wurde ein cSep an der Position p1 gefunden
+ // found a cSep at position p1
return rtl::OStringToOUString(aName.copy(p1 - p0 + 1),
osl_getThreadTextEncoding());
}
@@ -900,12 +895,12 @@ String DirEntry::GetBase( char cSep ) const
if ( p1 >= p0 )
{
- // es wurde ein cSep an der Position p1 gefunden
+ // found a cSep at position p1
return rtl::OStringToOUString(aName.copy(0, p1 - p0),
osl_getThreadTextEncoding());
}
- // es wurde kein cSep gefunden
+ // did not find a cSep
return rtl::OStringToOUString(aName, osl_getThreadTextEncoding());
}
@@ -1037,7 +1032,7 @@ DirEntry& DirEntry::operator=( const DirEntry& rEntry )
return *this;
}
- // Name und Typ uebernehmen, Refs beibehalten
+ // set name and type, but keep refs
aName = rEntry.aName;
eFlag = rEntry.eFlag;
nError = FSYS_ERR_OK;
@@ -1083,19 +1078,19 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
return rEntry;
}
- // irgendwas + "." (=> pEntryTop == &rEntry)
+ // something + "." (=> pEntryTop == &rEntry)
if (pEntryTop->eFlag == FSYS_FLAG_RELROOT && pEntryTop->aName.isEmpty())
{
DBG_ASSERT( pEntryTop == &rEntry, "DirEntry::op+ buggy" );
return *this;
}
- // root += ".." (=> unmoeglich)
+ // root += ".." (=> impossible)
if ( pEntryTop->eFlag == FSYS_FLAG_PARENT && pThisTop == this &&
( eFlag == FSYS_FLAG_ABSROOT ) )
return DirEntry( FSYS_FLAG_INVALID );
- // irgendwas += abs (=> nur Device uebernehmen falls vorhanden)
+ // something += abs (=> only append device if existant)
if ( pEntryTop->eFlag == FSYS_FLAG_ABSROOT )
{
rtl::OString aDevice;
@@ -1107,7 +1102,7 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
return aRet;
}
- // irgendwas += ".." (=> aufloesen)
+ // something += ".." (=> break apart)
if ( eFlag == FSYS_FLAG_NORMAL && pEntryTop->eFlag == FSYS_FLAG_PARENT )
{
String aConcated( GetFull() );
@@ -1116,7 +1111,7 @@ DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
return DirEntry( aConcated );
}
- // sonst einfach hintereinander haengen
+ // otherwise append consecutively
DirEntry aRet( rEntry );
DirEntry *pTop = aRet.ImpGetTopPtr();
pTop->pParent = new DirEntry( *this );
@@ -1149,14 +1144,14 @@ void DirEntry::SetExtension( const String& rExtension, char cSep )
rtl::OStringBuffer aBuf(aName);
- // cSep im Namen suchen
+ // search cSep within aName
const sal_Char *p0 = aBuf.getStr();
const sal_Char *p1 = p0 + aBuf.getLength() - 1;
while ( p1 >= p0 && *p1 != cSep )
p1--;
if ( p1 >= p0 )
{
- // es wurde ein cSep an der Position p1 gefunden
+ // found a cSep on position p1
sal_Int32 n = static_cast<sal_Int32>(
p1 - p0 + 1 - ( rExtension.Len() ? 0 : 1 ));
@@ -1165,7 +1160,7 @@ void DirEntry::SetExtension( const String& rExtension, char cSep )
}
else if ( rExtension.Len() )
{
- // es wurde kein cSep gefunden
+ // no cSep was found
aBuf.append(cSep);
}
@@ -1265,7 +1260,7 @@ namespace
DirEntry DirEntry::TempName( DirEntryKind eKind ) const
{
- // ggf. Base-Temp-Dir verwenden (macht Remote keinen Sinn => vorher)
+ // use base-temp-dir if necessary
const DirEntry &rEntry = TempNameBase_Impl::get();
if ( !pParent && FSYS_FLAG_CURRENT != rEntry.eFlag && FSYS_FLAG_ABSROOT != eFlag )
{
@@ -1430,7 +1425,7 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const
{
DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
- // Schnellpruefung, ob vorhanden
+ // fast check if exists
if ( FileStat( *this ).IsKind( FSYS_KIND_DIR ) )
return sal_True;
if ( bSloppy && pParent )
@@ -1440,11 +1435,11 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const
const DirEntry *pNewDir = bSloppy ? pParent : this;
if ( pNewDir )
{
- // den Path zum Dir erzeugen
+ // Create path to dir
if ( pNewDir->pParent && !pNewDir->pParent->MakeDir(sal_False) )
return sal_False;
- // das Dir selbst erzeugen
+ // create dir ourselves
if ( pNewDir->eFlag == FSYS_FLAG_ABSROOT ||
pNewDir->eFlag == FSYS_FLAG_VOLUME )
return sal_True;
@@ -1465,7 +1460,6 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const
sal_Bool bResult = (0 == _mkdir(bDirName.getStr()));
if ( !bResult )
{
- // Wer hat diese Methode const gemacht ?
#ifdef WIN32
((DirEntry *)this)->SetError( Sys2SolarError_Impl( GetLastError() ) );
#else
@@ -1487,7 +1481,7 @@ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const
if ( FSYS_ACTION_COPYFILE != (nActions & FSYS_ACTION_COPYFILE) )
#ifdef UNX
{
- // Hardlink anlegen
+ // create hardlink
HACK(redirection missing)
rtl::OString aThis(rtl::OUStringToOString(GetFull(), osl_getThreadTextEncoding()));
rtl::OString aDest(rtl::OUStringToOString(rDest.GetFull(), osl_getThreadTextEncoding()));
@@ -1539,19 +1533,18 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
aFromDevice=aFromDevice.GetDevice();
aToDevice=aToDevice.GetDevice();
- //Quelle und Ziel auf gleichem device?
if (aFromDevice==aToDevice)
{
- // ja, also intra-device-move mit MoveFile
+ // same device, use intra-device-move with MoveFile
MoveFile( bFrom.getStr(), bTo.getStr() );
- // MoveFile ist buggy bei cross-device operationen.
- // Der R?ckgabewert ist auch dann sal_True, wenn nur ein Teil der Operation geklappt hat.
- // Zudem zeigt MoveFile unterschiedliches Verhalten bei unterschiedlichen NT-Versionen.
+ // Note: MoveFile is buggy for cross-device operations.
+ // Return value is TRUE, even if the operation was only partially successful.
+ // MoveFile has varying behavior between differing NT-versions.
return Sys2SolarError_Impl( GetLastError() );
}
else
{
- //nein, also inter-device-move mit copy/delete
+ // Not the same device, use inter-device-move with copy/delete
FSysError nCopyError = CopyTo(rNewName, FSYS_ACTION_COPYFILE);
DirEntry aKill(rtl::OStringToOUString(bTo, osl_getThreadTextEncoding()));
@@ -1589,7 +1582,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
#else
{
if( errno == EXDEV )
-// cross device geht latuernich nicht mit rename
+ // simple rename does not work cross device
{
FILE *fpIN = fopen( bFrom.getStr(), "r" );
FILE *fpOUT = fopen( bTo.getStr(), "w" );
@@ -1601,7 +1594,7 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
while( ( nBytes = fread( pBuf, 1, sizeof(pBuf), fpIN ) ) && ! nErr )
{
nWritten = fwrite( pBuf, 1, nBytes, fpOUT );
- // Fehler im fwrite ?
+ // Error in fwrite ?
if( nWritten < nBytes )
{
nErr = errno;
@@ -1654,7 +1647,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
FSysError eError = FSYS_ERR_OK;
FSysFailOnErrorImpl();
- // Name als doppelt 0-terminierter String
+ // Terminate name string with two '0'
String aTmpName( GetFull() );
rtl::OString bTmpName(rtl::OUStringToOString(aTmpName, osl_getThreadTextEncoding()));
@@ -1662,7 +1655,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
strcpy( pName, bTmpName.getStr() );
pName[bTmpName.getLength()+1] = (char) 0;
- //read-only files sollen auch geloescht werden koennen
+ // delete read-only files as well
sal_Bool isReadOnly = FileStat::GetReadOnlyFlag(*this);
if (isReadOnly)
{
@@ -1672,7 +1665,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
// directory?
if ( FileStat( *this ).IsKind(FSYS_KIND_DIR) )
{
- // Inhalte recursiv loeschen?
+ // Delete recursively?
if ( FSYS_ACTION_RECURSIVE == (nActions & FSYS_ACTION_RECURSIVE) )
{
Dir aDir( *this, FSYS_KIND_DIR|FSYS_KIND_FILE );
@@ -1685,13 +1678,13 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
}
}
- // das Dir selbst loeschen
+ // remove Dir myself
#ifdef WIN32
SetLastError(0);
#endif
if ( eError == FSYS_ERR_OK && 0 != _rmdir( (char*) pName ) )
{
- // falls L"oschen nicht ging, CWD umsetzen
+ // Change CWD if deletion failed
#ifdef WIN32
eError = Sys2SolarError_Impl( GetLastError() );
#else
@@ -1756,7 +1749,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
}
}
- //falls Fehler, originales read-only flag wieder herstellen
+ // restore original read-only flag upon error
if ( isReadOnly && (eError!=ERRCODE_NONE) )
{
FileStat::SetReadOnlyFlag(*this, isReadOnly);
diff --git a/tools/source/fsys/filecopy.cxx b/tools/source/fsys/filecopy.cxx
index 56c6aab5afd4..84b083308c34 100644
--- a/tools/source/fsys/filecopy.cxx
+++ b/tools/source/fsys/filecopy.cxx
@@ -92,12 +92,12 @@ sal_Bool FileCopier::Progress()
ErrCode FileCopier::Error( ErrCode eErr, const DirEntry* pSource, const DirEntry* pTarget )
{
- // kein Fehler oder kein ErrorHandler?
+ // No error or no error handler?
if ( !eErr || !pImp->aErrorLink )
- // => Error beibehalten
+ // => keep error
return eErr;
- // sonst gesetzten ErrorHandler fragen
+ // otherwise request from ErrorHandler
pImp->pErrSource = pSource;
pImp->pErrTarget = pTarget;
pImp->eErr = eErr;
@@ -112,7 +112,7 @@ FSysError FileCopier::DoCopy_Impl( const DirEntry &rSource, const DirEntry &rTar
FSysError eRet = FSYS_ERR_OK;
ErrCode eWarn = FSYS_ERR_OK;
- // Zieldateiname ggf. kuerzen
+ // shorten target name if necessary
DirEntry aTgt;
aTgt = rTarget;
@@ -199,9 +199,9 @@ FSysError FileCopier::DoCopy_Impl( const DirEntry &rSource, const DirEntry &rTar
else
eRet = Error( aTargetStream.GetError(), 0, &aTgt );
- // unvollstaendiges File wieder loeschen
aTargetStream.Close();
+ // remove incomplete file
if ( nBytesCopied != nBytesTotal )
{
aTgt.Kill();
@@ -242,14 +242,14 @@ FSysError FileCopier::DoCopy_Impl( const DirEntry &rSource, const DirEntry &rTar
}
}
#endif
- // bei Move ggf. das File/Dir loeschen
+ // Remove File/Dir upon Move if necessary
if ( FSYS_ERR_OK == ERRCODE_TOERROR(eRet) && ( pImp->nActions & FSYS_ACTION_MOVE ) )
{
ErrCode eKillErr = Error( rSource.Kill() | ERRCODE_WARNING_MASK, &rSource, 0 );
if ( eKillErr != ERRCODE_WARNING_MASK )
{
if ( rSource.Exists() )
- // loeschen ging nicht => dann die Kopie wieder loeschen
+ // Removal failed => remove copy
aTgt.Kill( pImp->nActions );
if ( !eWarn )
eWarn = eKillErr;
diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx
index f96c50272f7f..b33c9cf8e3ef 100644
--- a/tools/source/fsys/tdir.cxx
+++ b/tools/source/fsys/tdir.cxx
@@ -37,7 +37,6 @@ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry,
( ( FSYS_KIND_FILE | FSYS_KIND_DIR | FSYS_KIND_DEV | \
FSYS_KIND_CHAR | FSYS_KIND_BLOCK ) & nKindFlags )
- // einfache Dinge erfordern einfache Loesungen
if ( pLst->empty() )
return sal_True;
@@ -168,7 +167,6 @@ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry,
if ( nSortIndex == ( pSortLst->size() - 1 ) )
return sal_True;
else
- //Rekursion
return ImpInsertPointReached( rNewEntry, rNewStat,
nCurPos, nSortIndex + 1 );
#undef VALUE
@@ -177,7 +175,7 @@ sal_Bool Dir::ImpInsertPointReached( const DirEntry& rNewEntry,
/// Insert as sorted
void Dir::ImpSortedInsert( const DirEntry *pNewEntry, const FileStat *pNewStat )
{
- //Sonderfall, keine Sortierung gewuenscht.
+ // special case: no sorting required
if ( !pSortLst ) {
pLst->push_back( (DirEntry*)pNewEntry );
return;
@@ -231,11 +229,11 @@ void Dir::Construct( DirEntryKind nKindFlags )
void Dir::Reset()
{
- // ggf. alten Reader l"oschen
+ // remove old Reader if necessary
if ( pReader && pReader->bInUse )
DELETEZ(pReader);
- // alle DirEntries aus der Liste entfernen und deren Speicher freigeben
+ // Remove all DirEntries from List and free memory
if ( pLst )
{
for ( size_t i = 0, n = pLst->size(); i < n; ++i ) {
@@ -246,7 +244,7 @@ void Dir::Reset()
else
pLst = new DirEntryList();
- // Alte File-Stat's Loeschen
+ // Remove old File-Stats
if ( pStatLst )
{
for ( size_t i = 0, n = pStatLst->size(); i < n; ++i ) {
@@ -257,7 +255,7 @@ void Dir::Reset()
pStatLst = NULL;
}
- // Verlangen die Sortierkriterien FileStat's?
+ // Does sorting require FileStats?
if ( pSortLst )
{
for ( size_t i = 0, n = pSortLst->size(); i < n; ++i ) {
@@ -272,11 +270,11 @@ void Dir::Reset()
}
}
- // ggf. einen neuen Reader aufsetzen
+ // Create new reader if necessary
if ( !pReader )
pReader = new DirReader_Impl( *this );
- // gibt es das zu oeffnende Verzeichnis ueberhaupt?
+ // Does the directory exist at all?
#if !defined(UNX) //explanation: see DirReader_Impl::Read() in unx.cxx
if( !pReader->pDosDir )
{
@@ -290,30 +288,30 @@ void Dir::Reset()
sal_uInt16 Dir::Scan( sal_uInt16 nCount )
{
- sal_uInt16 nRead = 0; // Anzahl in dieser Runde gelesener Eintr"age
+ sal_uInt16 nRead = 0; // Number of read entries in this round
FSysFailOnErrorImpl();
- // noch nicht fertig gewesen
+ // did not complete
if ( pReader )
{
- // frischer Reader?
+ // is this a new reader?
if ( pLst->empty() )
{
- // dann ggf. Laufwerke scannen
+ // Scan directories
pReader->bInUse = sal_True;
nRead = pReader->Init();
}
- // weiterlesen...
+ // continue reading
while ( nRead <= nCount && !pReader->bReady )
nRead = nRead + pReader->Read();
- // fertig?
+ // done?
if ( pReader && pReader->bReady )
DELETEZ( pReader );
}
- // Anzahl der gelesenen zur"uckgeben
+ // Return read entry count
return nRead;
}
@@ -331,7 +329,7 @@ Dir::~Dir()
{
DBG_DTOR( Dir, NULL );
- // alle DirEntries aus der Liste entfernen und deren Speicher freigeben
+ // Remove all DirEntries and free memory
if ( pLst )
{
for ( size_t i = 0, n = pLst->size(); i < n; ++i ) {
@@ -341,14 +339,14 @@ Dir::~Dir()
delete pLst;
}
- // alle Sorts aus der Liste entfernen und deren Speicher freigeben
+ // Remove all Sorts from list and free memory
if ( pSortLst )
{
pSortLst->clear();
delete pSortLst;
}
- // alle FileStat's aus der Liste entfernen und deren Speicher freigeben
+ // Remove all FileStats from list and free memory
if ( pStatLst )
{
for ( size_t i = 0, n = pStatLst->size(); i < n; ++i ) {
@@ -358,7 +356,6 @@ Dir::~Dir()
delete pStatLst;
}
- // ggf. laufenden Reader freigeben
delete pReader;
}
@@ -372,16 +369,15 @@ DirEntry& Dir::operator[] ( size_t nIndex ) const
Dir& Dir::operator+=( const Dir& rDir )
{
- // ggf. erst den Rest lesen
+ // Read the rest of the directory
if ( pReader )
Scan( USHRT_MAX );
DBG_ASSERT( !rDir.pReader, "Dir::+= with incomplete Dir" );
- // ggf. initiale Liste erzeugen
if ( !pLst )
pLst = new DirEntryList();
- //Verlangen die Sortierkriterien FileStat's?
+ // FileStats required by sorting criteria?
sal_Bool bStat = sal_False;
if ( pSortLst ) {
for ( size_t i = 0, n = pSortLst->size(); i < n && !bStat; ++i ) {
@@ -411,7 +407,7 @@ Dir& Dir::operator+=( const Dir& rDir )
size_t Dir::Count( sal_Bool bUpdated ) const
{
- // ggf. erst den Rest lesen
+ // Read the rest of the directory
if ( bUpdated && pReader )
((Dir*)this)->Scan( USHRT_MAX );
diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx
index 00472a5bcd78..59ca419a63df 100644
--- a/tools/source/fsys/unx.cxx
+++ b/tools/source/fsys/unx.cxx
@@ -151,8 +151,7 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab)
continue;
}
# ifdef LINUX
- /* #61624# File mit setmntent oeffnen und mit fclose schliessen stoesst
- bei der glibc-2.1 auf wenig Gegenliebe */
+ // #61624# Opening file with setmntent and closing with fclose fails for glibc-2.1
endmntent( fp );
# else
fclose (fp);
@@ -165,7 +164,7 @@ static sal_Bool GetMountEntry(dev_t dev, struct mymnttab *mytab)
return sal_True;
}
# ifdef LINUX
- /* #61624# dito */
+ /* #61624# see above */
endmntent( fp );
# else
fclose (fp);
@@ -252,7 +251,7 @@ sal_uInt16 DirReader_Impl::Read()
return 0;
}
- // Directories und Files auflisten?
+ // List directories and dirs
if ( ( pDir->eAttrMask & FSYS_KIND_DIR || pDir->eAttrMask & FSYS_KIND_FILE ) &&
( ( pDosEntry = readdir( pDosDir ) ) != NULL ) )
{
@@ -274,7 +273,7 @@ sal_uInt16 DirReader_Impl::Read()
!( pDir->eAttrMask & FSYS_KIND_VISIBLE &&
pDosEntry->d_name[0] == '.' ) )
{
- if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ if ( pDir->pStatLst ) // Does sorting criteria require status?
pDir->ImpSortedInsert( pTemp, new FileStat( aStat ) );
else
pDir->ImpSortedInsert( pTemp, NULL );
@@ -309,7 +308,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, SAL_UNUSED_PARAMETER sal_B
return sal_False;
}
- // Sonderbehandlung falls es sich um eine Root handelt
+ // Special case if DirEntry is root
if ( rDirEntry.eFlag == FSYS_FLAG_ABSROOT )
{
nKindFlags = FSYS_KIND_DIR;
@@ -327,7 +326,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, SAL_UNUSED_PARAMETER sal_B
// note that this is not a solution, since filenames containing special characters
// are handled badly across the whole Office
- // Sonderbehandlung falls es sich um eine Wildcard handelt
+ // special treatment if name contains wildcards
rtl::OString aTempName(rtl::OUStringToOString(rDirEntry.GetName(), osl_getThreadTextEncoding()));
if ( aTempName.indexOf('?') != -1 ||
aTempName.indexOf('*') != -1 ||
@@ -377,9 +376,9 @@ const char *TempDirImpl( char *pBuf )
if ( pValue )
strcpy( pBuf, pValue );
else
- // auf Solaris und Linux ist P_tmpdir vorgesehen
+ // P_tempdir exists in Solaris and Linux
strcpy( pBuf, P_tmpdir );
- // hart auf "/tmp" sollte wohl nur im Notfall verwendet werden
+ // don't use "/tmp" as hard coded directory
//strcpy( pBuf, "/tmp" );
#endif /* MACOSX */
diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx
index d61bea9d4c7f..303b59cfbc11 100644
--- a/tools/source/fsys/wldcrd.cxx
+++ b/tools/source/fsys/wldcrd.cxx
@@ -19,12 +19,12 @@
#include <tools/wldcrd.hxx>
-/* Diese Methode ueberprueft, ob die Wilde Karte in pWild mit dem String
- * in pStr matscht.
- * Vertragen sich die beiden, so wird 1 zurueckgegeben, sonst 0.
+/** Tests, whether a wildcard in pWild will match for pStr.
*
- * ein '*' in pWild bedeutet n beliebige Zeichen, mit n>=0
- * ein '?' in pWild bedeutet genau ein beliebiges Zeichen
+ * If they match, return 1, otherwise 0.
+ *
+ * '*' in pWild means n chars for n > 0.
+ * '?' in pWild mean match exactly one character.
*
*/
sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const
@@ -50,8 +50,8 @@ sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const
else
pWild += pos;
else
- break; // ACHTUNG laeuft unter bestimmten
- // Umstaenden in den nachsten case rein!!
+ break; // WARNING: may cause execution of next case
+ // in some circumstances!
case '*':
while ( *pWild == '*' )
pWild++;
@@ -97,12 +97,11 @@ sal_Bool WildCard::Matches( const String& rString ) const
{
while ( (nSepPos = aTmpWild.indexOf(cSepSymbol)) != -1 )
{
- // alle getrennten WildCard's pruefen
+ // Check all splitted wildcards
if ( ImpMatch( aTmpWild.copy( 0, nSepPos ).getStr(), aString.getStr() ) )
return sal_True;
- aTmpWild = aTmpWild.copy(nSepPos + 1); // Trennsymbol entfernen
+ aTmpWild = aTmpWild.copy(nSepPos + 1); // remove separator
}
- // und noch den hinter dem letzen Trennsymbol bzw. den einzigen
}
if ( ImpMatch( aTmpWild.getStr(), aString.getStr() ) )
diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx
index f514b86f5783..f2eeffc7fad4 100644
--- a/tools/source/fsys/wntmsc.cxx
+++ b/tools/source/fsys/wntmsc.cxx
@@ -63,7 +63,7 @@ struct dirent *readdir( DIR *pDir )
char *pBuf = new char[ strlen( pDir->p ) + 5 ];
if ( pBuf )
{
- // *.* dahinter, ggf mit "\\" abtrennen (falls nicht schon da)
+ // if string ends with *.*, seperate with "\\" (unless it exists)
strcpy( pBuf, pDir->p );
strcat( pBuf, "\\*.*" + ( *(pBuf + strlen( pBuf ) - 1 ) == '\\' ) );
CharUpperBuff( pBuf, strlen(pBuf) );
@@ -145,12 +145,12 @@ String DirEntry::GetVolume() const
rtl::OString aRootDir = pTop->aName;
FSysFailOnErrorImpl();
- // Network-Device zuerst probieren wegen langsamer Samba-Drives
+ // Try network device first due to slow samba drives
if ( !WNetGetConnection( aRootDir.getStr(),
sVolumeName, &nVolumeNameLen ) )
aRet = String( sVolumeName, osl_getThreadTextEncoding());
- // dann den VolumeNamen fuer lokale Drives
+ // Append volume name for local drives
if ( aRet.Len() == 0 )
{
aRootDir += rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\"));
@@ -190,14 +190,14 @@ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const
USHORT DirReader_Impl::Init()
{
- // Block-Devices auflisten?
+ // List Block-devices?
if ( pDir->eAttrMask & FSYS_KIND_BLOCK )
{
- // CWD merken
+ // remember CWD
DirEntry aCurrentDir;
aCurrentDir.ToAbs();
- // einzeln auf Existenz und Masken-konformit"at pr"ufen
+ // Check for existence and conformity to flags
USHORT nRead = 0;
char sDrive[3] = { '?', ':', 0 };
char sRoot[4] = { '?', ':', '\\', 0 };
@@ -208,7 +208,7 @@ USHORT DirReader_Impl::Init()
DirEntry* pDrive = new DirEntry( sDrive, FSYS_FLAG_VOLUME );
if ( pDir->aNameMask.Matches( String(rtl::OStringToOUString(sDrive, osl_getThreadTextEncoding())) ) && GetDriveType( sRoot ) != 1 )
{
- if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ if ( pDir->pStatLst ) // Status required by sorting criteria?
{
FileStat *pNewStat = new FileStat( *pDrive );
pDir->ImpSortedInsert( pDrive, pNewStat );
@@ -221,7 +221,7 @@ USHORT DirReader_Impl::Init()
delete pDrive;
}
- // CWD restaurieren
+ // restore CWD
aCurrentDir.SetCWD();
return nRead;
}
@@ -231,19 +231,19 @@ USHORT DirReader_Impl::Init()
USHORT DirReader_Impl::Read()
{
- // Directories und Files auflisten?
+ // List directories and Files?
if ( ( pDir->eAttrMask & FSYS_KIND_DIR ||
pDir->eAttrMask & FSYS_KIND_FILE ) &&
( ( pDosEntry = readdir( pDosDir ) ) != NULL ) )
{
- // Gross/Kleinschreibung nicht beruecksichtigen
+ // Do not distinguish between lower-/upper-case letters
size_t nLen = strlen(pDosEntry->d_name);
std::vector<char> aBuffer(nLen);
memcpy(&aBuffer[0], pDosEntry->d_name, nLen);
CharLowerBuff(&aBuffer[0], nLen);
rtl::OString aLowerName(&aBuffer[0], nLen);
- // Flags pruefen
+ // check Flags
sal_Bool bIsDirAndWantsDir =
( ( pDir->eAttrMask & FSYS_KIND_DIR ) &&
#ifdef ICC
@@ -284,7 +284,7 @@ USHORT DirReader_Impl::Read()
#endif
if ( pParent )
pTemp->ImpChangeParent( new DirEntry( *pParent ), sal_False );
- if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ if ( pDir->pStatLst ) // Status required by sorting criteria?
{
FileStat *pNewStat = new FileStat( (void*) pDosDir );
pDir->ImpSortedInsert( pTemp, pNewStat );
@@ -585,8 +585,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
return sal_False;
}
- // Sonderbehandlung falls es sich um eine Root ohne Laufwerk handelt
-
+ // Special treatment if it's a root without device
if ( !rDirEntry.aName.getLength() && rDirEntry.eFlag == FSYS_FLAG_ABSROOT )
{
nKindFlags = FSYS_KIND_DIR;
@@ -594,15 +593,15 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
return sal_True;
}
- // keine Error-Boxen anzeigen
+ // Don't show error boxes
FSysFailOnErrorImpl();
// Redirect
String aPath( rDirEntry.GetFull() );
DirEntry aDirEntry( aPath );
- // ist ein Medium im Laufwerk?
- HACK("wie?")
+ // Is a medium in this device?
+ HACK("How?")
sal_Bool bAccess = sal_True;
const DirEntry *pTop = aDirEntry.ImpGetTopPtr();
rtl::OString aName = rtl::OString(pTop->aName).toAsciiLowerCase();
@@ -623,7 +622,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
DBG_WARNING( "floppy will clatter" );
}
- // Sonderbehandlung, falls es sich um ein Volume handelt
+ // Special treatment if it's a volume
if ( aDirEntry.eFlag == FSYS_FLAG_VOLUME ||
aDirEntry.eFlag == FSYS_FLAG_ABSROOT )
{
@@ -667,18 +666,17 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
return sal_True;
}
- // Statusinformation vom Betriebssystem holen
+ // Get status data from OS
HANDLE h; //()
_WIN32_FIND_DATAA aEntry = INIT_WIN32_FIND_DATAA;
DirEntry aAbsEntry( aDirEntry );
if ( bAccess && aAbsEntry.ToAbs() )
{
- // im Namen k"onnen auch ';*?' als normale Zeichen vorkommen
+ // names can contain ';*?' as normal characters
rtl::OString aFilePath(rtl::OUStringToOString(aAbsEntry.GetFull(), osl_getThreadTextEncoding()));
OSL_TRACE( "FileStat: %s", aFilePath.getStr() );
h = aFilePath.getLength() < 230
- // die Win32-API ist hier sehr schwammig
? FindFirstFile( aFilePath.getStr(), &aEntry )//TPF: 2i
: INVALID_HANDLE_VALUE;
@@ -733,7 +731,7 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool bForceAccess )
if ( h == INVALID_HANDLE_VALUE )
{
- // Sonderbehandlung falls es sich um eine Wildcard handelt
+ // Special treatment if name contains wildcard
rtl::OString aTempName(rtl::OUStringToOString(aDirEntry.GetName(), osl_getThreadTextEncoding()));
if ( strchr( aTempName.getStr(), '?' ) ||
strchr( aTempName.getStr(), '*' ) ||
diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx
index bb8ec2c9e0e8..ce4ce26d64c1 100644
--- a/tools/source/generic/b3dtrans.cxx
+++ b/tools/source/generic/b3dtrans.cxx
@@ -129,7 +129,7 @@ void B3dTransformationSet::Ortho(basegfx::B3DHomMatrix& rTarget,
/// reset values
void B3dTransformationSet::Reset()
{
- // Matritzen auf Einheitsmatritzen
+ // Reset matrices to identity matrices
maObjectTrans.identity();
PostSetObjectTrans();
@@ -161,7 +161,7 @@ void B3dTransformationSet::Reset()
/// Object transformation
void B3dTransformationSet::PostSetObjectTrans()
{
- // Zuweisen und Inverse bestimmen
+ // Assign and compute inverse
maInvObjectTrans = maObjectTrans;
maInvObjectTrans.invert();
}
@@ -180,7 +180,7 @@ void B3dTransformationSet::SetOrientation( basegfx::B3DPoint aVRP, basegfx::B3DV
void B3dTransformationSet::PostSetOrientation()
{
- // Zuweisen und Inverse bestimmen
+ // Assign and compute inverse
maInvOrientation = maOrientation;
maInvOrientation.invert();
}
@@ -201,11 +201,11 @@ const basegfx::B3DHomMatrix& B3dTransformationSet::GetProjection()
void B3dTransformationSet::PostSetProjection()
{
- // Zuweisen und Inverse bestimmen
+ // Assign and comptue inverse
maInvProjection = GetProjection();
maInvProjection.invert();
- // Abhaengige Matritzen invalidieren
+ // invalidate dependent matrices
mbObjectToDeviceValid = sal_False;
mbWorldToViewValid = sal_False;
}
@@ -213,17 +213,16 @@ void B3dTransformationSet::PostSetProjection()
/// Transformations for viewport
void B3dTransformationSet::CalcViewport()
{
- // Faktoren fuer die Projektion
+ // Parameters for projection
double fLeft(mfLeftBound);
double fRight(mfRightBound);
double fBottom(mfBottomBound);
double fTop(mfTopBound);
- // Soll das Seitenverhaeltnis Beachtung finden?
- // Falls ja, Bereich der Projektion an Seitenverhaeltnis anpassen
+ // Adjust projection to aspect ratio, if set
if(GetRatio() != 0.0)
{
- // Berechne aktuelles Seitenverhaeltnis der Bounds
+ // Compute current aspect ratio of boundaries
double fBoundWidth = (double)(maViewportRectangle.GetWidth() + 1);
double fBoundHeight = (double)(maViewportRectangle.GetHeight() + 1);
double fActRatio = 1;
@@ -237,17 +236,17 @@ void B3dTransformationSet::CalcViewport()
{
case Base3DRatioShrink :
{
- // Kleineren Teil vergroessern
+ // Dilate smaller part
if(fActRatio > mfRatio)
{
- // X vergroessern
+ // enlarge X
fFactor = 1.0 / fActRatio;
fRight *= fFactor;
fLeft *= fFactor;
}
else
{
- // Y vergroessern
+ // enlarge Y
fFactor = fActRatio;
fTop *= fFactor;
fBottom *= fFactor;
@@ -256,17 +255,17 @@ void B3dTransformationSet::CalcViewport()
}
case Base3DRatioGrow :
{
- // GroesserenTeil verkleinern
+ // scale down larger part
if(fActRatio > mfRatio)
{
- // Y verkleinern
+ // scale down Y
fFactor = fActRatio;
fTop *= fFactor;
fBottom *= fFactor;
}
else
{
- // X verkleinern
+ // scale down X
fFactor = 1.0 / fActRatio;
fRight *= fFactor;
fLeft *= fFactor;
@@ -275,7 +274,7 @@ void B3dTransformationSet::CalcViewport()
}
case Base3DRatioMiddle :
{
- // Mitteln
+ // averaging
fFactor = ((1.0 / fActRatio) + 1.0) / 2.0;
fRight *= fFactor;
fLeft *= fFactor;
@@ -287,10 +286,10 @@ void B3dTransformationSet::CalcViewport()
}
}
- // Ueberschneiden sich Darstellungsflaeche und Objektflaeche?
+ // Do projection and object areas overlap?
maSetBound = maViewportRectangle;
- // Mit den neuen Werten Projektion und ViewPort setzen
+ // Reset projection with new values
basegfx::B3DHomMatrix aNewProjection;
// #i36281#
@@ -299,8 +298,7 @@ void B3dTransformationSet::CalcViewport()
// which is 1/10000th, comared with 1/tenth of a million from SMALL_DVALUE.
const double fDistPart((mfFarBound - mfNearBound) * 0.0001);
- // Near, Far etwas grosszuegiger setzen, um falsches,
- // zu kritisches clippen zu verhindern
+ // To avoid critical clipping, set Near & Far generously
if(mbPerspective)
{
Frustum(aNewProjection, fLeft, fRight, fBottom, fTop, mfNearBound - fDistPart, mfFarBound + fDistPart);
@@ -310,10 +308,10 @@ void B3dTransformationSet::CalcViewport()
Ortho(aNewProjection, fLeft, fRight, fBottom, fTop, mfNearBound - fDistPart, mfFarBound + fDistPart);
}
- // jetzt schon auf gueltig setzen um Endlosschleife zu vermeiden
+ // Set to true to guarantee loop termination
mbProjectionValid = sal_True;
- // Neue Projektion setzen
+ // set new projection
SetProjection(aNewProjection);
// fill parameters for ViewportTransformation
@@ -322,12 +320,12 @@ void B3dTransformationSet::CalcViewport()
maTranslate.setY((double)maSetBound.Top() + ((maSetBound.GetHeight() - 1L) / 2.0));
maTranslate.setZ(ZBUFFER_DEPTH_RANGE / 2.0);
- // Skalierung
+ // Scaling
maScale.setX((maSetBound.GetWidth() - 1L) / 2.0);
maScale.setY((maSetBound.GetHeight() - 1L) / -2.0);
maScale.setZ(ZBUFFER_DEPTH_RANGE / 2.0);
- // Auf Veraenderung des ViewPorts reagieren
+ // React to change of viewport
PostSetViewport();
}
@@ -356,7 +354,7 @@ void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, d
mbObjectToDeviceValid = sal_False;
mbWorldToViewValid = sal_False;
- // Aenderung bekanntmachen
+ // Broadcast changes
if(bBroadCastChange)
DeviceRectangleChange();
}
@@ -472,7 +470,7 @@ void B3dCamera::DeviceRectangleChange()
// call parent
B3dViewport::DeviceRectangleChange();
- // Auf Aenderung reagieren
+ // react to changes
CalcNewViewportValues();
}
@@ -517,14 +515,14 @@ sal_Bool B3dCamera::CalcFocalLength()
if(bUseFocalLength)
{
- // Position aufgrund der FocalLength korrigieren
+ // Update position if focal length changes
aCorrectedPosition = basegfx::B3DPoint(0.0, 0.0, fFocalLength * fWidth / 35.0);
aCorrectedPosition = EyeToWorldCoor(aCorrectedPosition);
bRetval = sal_True;
}
else
{
- // FocalLength anhand der Position anpassen
+ // Adjust focal length based on given position
basegfx::B3DPoint aOldPosition;
aOldPosition = WorldToEyeCoor(aOldPosition);
if(fWidth != 0.0)
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 331b603cd38f..9247b1fec667 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -31,14 +31,14 @@ static const long MY_MINLONG = -MY_MAXLONG;
static const long MY_MAXSHORT = 0x00007fff;
static const long MY_MINSHORT = -MY_MAXSHORT;
-/* Die ganzen Algorithmen zur Addition, Subtraktion, Multiplikation und
- * Division von langen Zahlen stammen aus SEMINUMERICAL ALGORITHMS von
- * DONALD E. KNUTH aus der Reihe The Art of Computer Programming. Zu finden
- * sind diese Algorithmen im Kapitel 4.3.1. The Classical Algorithms.
+/*
+ * The algorithms for Addition, Substraction, Multiplication and Divison
+ * of large numbers originate from SEMINUMERICAL ALGORITHMS by
+ * DONALD E. KNUTH in the series The Art of Computer Programming:
+ * chapter 4.3.1. The Classical Algorithms.
*/
-// Muss auf sal_uInt16/INT16/sal_uInt32/sal_Int32 umgestellt werden !!! W.P.
-
+// TODO: Needs conversion to sal_uInt16/INT16/sal_uInt32/sal_Int32
void BigInt::MakeBigInt( const BigInt& rVal )
{
if ( rVal.bIsBig )
@@ -91,9 +91,9 @@ void BigInt::Normalize()
if ( bIsNeg )
nVal = -nVal;
}
- // else ist nVal undefiniert !!! W.P.
+ // else nVal is undefined !!! W.P.
}
- // wozu, nLen ist doch undefiniert ??? W.P.
+ // why? nVal is undefined ??? W.P.
else if ( nVal & 0xFFFF0000L )
nLen = 2;
else
@@ -158,8 +158,8 @@ void BigInt::AddLong( BigInt& rB, BigInt& rErg )
int i;
char len;
- // wenn die Zahlen unterschiedlich lang sind, sollte zunaechst bei
- // der kleineren Zahl die fehlenden Ziffern mit 0 initialisert werden
+ // if length of the two values differ, fill remaining positions
+ // of the smaller value with zeros.
if (nLen >= rB.nLen)
{
len = nLen;
@@ -173,7 +173,7 @@ void BigInt::AddLong( BigInt& rB, BigInt& rErg )
nNum[i] = 0;
}
- // Die Ziffern werden von hinten nach vorne addiert
+ // Add numerals, starting from the back
long k;
long nZ = 0;
for (i = 0, k = 0; i < len; i++) {
@@ -184,20 +184,18 @@ void BigInt::AddLong( BigInt& rB, BigInt& rErg )
k = 0;
rErg.nNum[i] = (sal_uInt16)(nZ & 0xffffL);
}
- // Trat nach der letzten Addition ein Ueberlauf auf, muss dieser
- // noch ins Ergebis uebernommen werden
- if (nZ & 0xff0000L) // oder if(k)
+ // If an overflow occured, add to solution
+ if (nZ & 0xff0000L) // or if(k)
{
rErg.nNum[i] = 1;
len++;
}
- // Die Laenge und das Vorzeichen setzen
+ // Set length and sign
rErg.nLen = len;
rErg.bIsNeg = bIsNeg && rB.bIsNeg;
rErg.bIsBig = sal_True;
}
- // Wenn nur einer der beiden Operanten negativ ist, wird aus der
- // Addition eine Subtaktion
+ // If one of the values is negative, perform substraction instead
else if (bIsNeg)
{
bIsNeg = sal_False;
@@ -220,8 +218,8 @@ void BigInt::SubLong( BigInt& rB, BigInt& rErg )
char len;
long nZ, k;
- // wenn die Zahlen unterschiedlich lang sind, sollte zunaechst bei
- // der kleineren Zahl die fehlenden Ziffern mit 0 initialisert werden
+ // if length of the two values differ, fill remaining positions
+ // of the smaller value with zeros.
if (nLen >= rB.nLen)
{
len = nLen;
@@ -259,14 +257,13 @@ void BigInt::SubLong( BigInt& rB, BigInt& rErg )
k = 0;
rErg.nNum[i] = (sal_uInt16)(nZ & 0xffffL);
}
- // wenn a < b, dann Vorzeichen vom Ergebnis umdrehen
+ // if a < b, revert sign
rErg.bIsNeg = !bIsNeg;
}
rErg.nLen = len;
rErg.bIsBig = sal_True;
}
- // Wenn nur einer der beiden Operanten negativ ist, wird aus der
- // Subtaktion eine Addition
+ // If one of the values is negative, perform addition instead
else if (bIsNeg)
{
bIsNeg = sal_False;
@@ -329,7 +326,7 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const
aTmpB.Mult( rB, nMult );
for (j = aTmpA.nLen - 1; j >= nLenB; j--)
- { // Raten des Divisors
+ { // guess divisor
nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
nQ = 0xFFFF;
@@ -339,7 +336,7 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const
if ( ((sal_uInt32)aTmpB.nNum[nLenB1 - 1] * nQ) >
((((sal_uInt32)nTmp) - aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2])
nQ--;
- // Und hier faengt das Teilen an
+ // Start division
nK = 0;
nTmp = 0;
for (i = 0; i < nLenB; i++)
@@ -398,7 +395,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const
aTmpB.Mult( rB, nMult);
for (j = aTmpA.nLen - 1; j >= nLenB; j--)
- { // Raten des Divisors
+ { // Guess divisor
nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
nQ = 0xFFFF;
@@ -408,7 +405,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const
if ( ((sal_uInt32)aTmpB.nNum[nLenB1 - 1] * nQ) >
((((sal_uInt32)nTmp) - aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2])
nQ--;
- // Und hier faengt das Teilen an
+ // Start division
nK = 0;
nTmp = 0;
for (i = 0; i < nLenB; i++)
@@ -669,13 +666,13 @@ BigInt& BigInt::operator+=( const BigInt& rVal )
{
if( nVal <= MY_MAXLONG && rVal.nVal <= MY_MAXLONG
&& nVal >= MY_MINLONG && rVal.nVal >= MY_MINLONG )
- { // wir bewegen uns im ungefaehrlichem Bereich
+ { // No overflows may occur here
nVal += rVal.nVal;
return *this;
}
if( (nVal < 0) != (rVal.nVal < 0) )
- { // wir bewegen uns im ungefaehrlichem Bereich
+ { // No overflows may occur here
nVal += rVal.nVal;
return *this;
}
@@ -695,13 +692,13 @@ BigInt& BigInt::operator-=( const BigInt& rVal )
{
if ( nVal <= MY_MAXLONG && rVal.nVal <= MY_MAXLONG &&
nVal >= MY_MINLONG && rVal.nVal >= MY_MINLONG )
- { // wir bewegen uns im ungefaehrlichem Bereich
+ { // No overflows may occur here
nVal -= rVal.nVal;
return *this;
}
if ( (nVal < 0) == (rVal.nVal < 0) )
- { // wir bewegen uns im ungefaehrlichem Bereich
+ { // No overflows may occur here
nVal -= rVal.nVal;
return *this;
}
@@ -720,8 +717,8 @@ BigInt& BigInt::operator*=( const BigInt& rVal )
if ( !bIsBig && !rVal.bIsBig
&& nVal <= MY_MAXSHORT && rVal.nVal <= MY_MAXSHORT
&& nVal >= MY_MINSHORT && rVal.nVal >= MY_MINSHORT )
- // nicht optimal !!! W.P.
- { // wir bewegen uns im ungefaehrlichem Bereich
+ // TODO: not optimal !!! W.P.
+ { // No overflows may occur here
nVal *= rVal.nVal;
}
else
@@ -747,7 +744,7 @@ BigInt& BigInt::operator/=( const BigInt& rVal )
if ( !bIsBig )
{
- // wir bewegen uns im ungefaehrlichem Bereich
+ // No overflows may occur here
nVal /= rVal.nVal;
return *this;
}
@@ -763,7 +760,7 @@ BigInt& BigInt::operator/=( const BigInt& rVal )
if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF )
{
- // ein BigInt durch ein sal_uInt16 teilen
+ // Divide BigInt with an sal_uInt16
sal_uInt16 nTmp;
if ( rVal.nVal < 0 )
{
@@ -785,7 +782,7 @@ BigInt& BigInt::operator/=( const BigInt& rVal )
return *this;
}
- // BigInt durch BigInt teilen
+ // Divide BigInt with BigInt
BigInt aTmp1, aTmp2;
aTmp1.MakeBigInt( *this );
aTmp2.MakeBigInt( rVal );
@@ -806,14 +803,14 @@ BigInt& BigInt::operator%=( const BigInt& rVal )
if ( !bIsBig )
{
- // wir bewegen uns im ungefaehrlichem Bereich
+ // No overflows may occur here
nVal %= rVal.nVal;
return *this;
}
if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF )
{
- // ein BigInt durch ein short teilen
+ // Divide Bigint by short
sal_uInt16 nTmp;
if ( rVal.nVal < 0 )
{
@@ -832,7 +829,7 @@ BigInt& BigInt::operator%=( const BigInt& rVal )
if ( ABS_IsLess( rVal ) )
return *this;
- // BigInt durch BigInt teilen
+ // Divide BigInt with BigInt
BigInt aTmp1, aTmp2;
aTmp1.MakeBigInt( *this );
aTmp2.MakeBigInt( rVal );
diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx
index c590f6b4ab64..d2852cf5f737 100644
--- a/tools/source/generic/config.cxx
+++ b/tools/source/generic/config.cxx
@@ -196,11 +196,10 @@ rtl::OString makeOString(const sal_uInt8* p, sal_uInt64 n)
static void ImplMakeConfigList( ImplConfigData* pData,
const sal_uInt8* pBuf, sal_uInt64 nLen )
{
- // kein Buffer, keine Daten
if ( !nLen )
return;
- // Buffer parsen und Liste zusammenbauen
+ // Parse buffer and build config list
sal_uInt64 nStart;
sal_uInt64 nLineLen;
sal_uInt64 nNameLen;
@@ -218,29 +217,29 @@ static void ImplMakeConfigList( ImplConfigData* pData,
if ( pBuf[i] == 0x1A )
break;
- // Spaces und Tabs entfernen
+ // Remove spaces and tabs
while ( (pBuf[i] == ' ') || (pBuf[i] == '\t') )
i++;
- // Zeilenanfang merken
+ // remember line-starts
nStart = i;
pLine = pBuf+i;
- // Zeilenende suchen
+ // search line-endings
while ( (i < nLen) && pBuf[i] && (pBuf[i] != '\r') && (pBuf[i] != '\n') &&
(pBuf[i] != 0x1A) )
i++;
nLineLen = i-nStart;
- // Wenn Zeilenende (CR/LF), dann noch einen weiterschalten
+ // if Line-ending is found, continue once
if ( (i+1 < nLen) &&
(pBuf[i] != pBuf[i+1]) &&
((pBuf[i+1] == '\r') || (pBuf[i+1] == '\n')) )
i++;
i++;
- // Zeile auswerten
+ // evaluate line
if ( *pLine == '[' )
{
pGroup = new ImplGroupData;
@@ -255,10 +254,10 @@ static void ImplMakeConfigList( ImplConfigData* pData,
pPrevKey = NULL;
pKey = NULL;
- // Gruppennamen rausfiltern
+ // filter group names
pLine++;
nLineLen--;
- // Spaces und Tabs entfernen
+ // remove spaces and tabs
while ( (*pLine == ' ') || (*pLine == '\t') )
{
nLineLen--;
@@ -278,8 +277,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
{
if ( nLineLen )
{
- // Wenn noch keine Gruppe existiert, dann alle Keys in die
- // Default-Gruppe
+ // If no group exists yet, add to default
if ( !pGroup )
{
pGroup = new ImplGroupData;
@@ -294,7 +292,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
pPrevKey = NULL;
}
- // Falls Leerzeile vorhanden, dann anhaengen
+ // if empty line, append it
if ( pPrevKey )
{
while ( pGroup->mnEmptyLines )
@@ -307,7 +305,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
}
}
- // Neuen Key erzeugen
+ // Generate new key
pKey = new ImplKeyData;
pKey->mpNext = NULL;
if ( pPrevKey )
@@ -327,7 +325,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
while ( (nNameLen < nLineLen) && (pLine[nNameLen] != '=') )
nNameLen++;
nKeyLen = nNameLen;
- // Spaces und Tabs entfernen
+ // Remove spaces and tabs
if ( nNameLen )
{
while ( (pLine[nNameLen-1] == ' ') || (pLine[nNameLen-1] == '\t') )
@@ -339,7 +337,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
{
pLine += nKeyLen;
nLineLen -= nKeyLen;
- // Spaces und Tabs entfernen
+ // Remove spaces and tabs
while ( (*pLine == ' ') || (*pLine == '\t') )
{
nLineLen--;
@@ -356,10 +354,8 @@ static void ImplMakeConfigList( ImplConfigData* pData,
}
else
{
- // Leerzeilen werden nur gezaehlt und beim Erzeugen des
- // naechsten Keys angehaengt, da wir Leerzeilen am Ende
- // einer Gruppe auch nach hinzufuegen von neuen Keys nur
- // am Ende der Gruppe wieder speichern wollen
+ // Spaces are counted and appended only after key generation,
+ // as we want to store spaces even after adding new keys
if ( pGroup )
pGroup->mnEmptyLines++;
}
@@ -396,12 +392,11 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
nLineEndLen = 2;
}
- // Buffergroesse ermitteln
nBufLen = 0;
pGroup = pData->mpFirstGroup;
while ( pGroup )
{
- // Leere Gruppen werden nicht geschrieben
+ // Don't write empty groups
if ( pGroup->mpFirstKey )
{
nBufLen += pGroup->maGroupName.getLength() + nLineEndLen + 2;
@@ -417,7 +412,7 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
pKey = pKey->mpNext;
}
- // Leerzeile nach jeder Gruppe auch wieder speichern
+ // Write empty lines after each group
if ( !pGroup->mnEmptyLines )
pGroup->mnEmptyLines = 1;
nBufLen += nLineEndLen * pGroup->mnEmptyLines;
@@ -426,7 +421,7 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
pGroup = pGroup->mpNext;
}
- // Laenge dem Aufrufer mitteilen
+ // Output buffer length
rLen = nBufLen;
if ( !nBufLen )
{
@@ -442,17 +437,17 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
return 0;
}
- // Schreibbuffer anlegen (wird vom Aufrufer zerstoert)
+ // Allocate new write buffer (caller frees it)
pWriteBuf = new sal_uInt8[nBufLen];
if ( !pWriteBuf )
return 0;
- // Buffer fuellen
+ // fill buffer
pBuf = pWriteBuf;
pGroup = pData->mpFirstGroup;
while ( pGroup )
{
- // Leere Gruppen werden nicht geschrieben
+ // Don't write empty groups
if ( pGroup->mpFirstKey )
{
*pBuf = '['; pBuf++;
@@ -499,7 +494,7 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr&
pKey = pKey->mpNext;
}
- // Leerzeile nach jeder Gruppe auch wieder speichern
+ // Store empty line after each group
sal_uInt16 nEmptyLines = pGroup->mnEmptyLines;
while ( nEmptyLines )
{
@@ -526,7 +521,7 @@ static void ImplReadConfig( ImplConfigData* pData )
sal_Bool bIsUTF8BOM =sal_False;
sal_uInt8* pBuf = ImplSysReadConfig( pData->maFileName, nRead, bRead, bIsUTF8BOM, nTimeStamp );
- // Aus dem Buffer die Config-Verwaltungsliste aufbauen
+ // Read config list from buffer
if ( pBuf )
{
ImplMakeConfigList( pData, pBuf, nRead );
@@ -552,7 +547,7 @@ static void ImplWriteConfig( ImplConfigData* pData )
}
#endif
- // Aus der Config-Liste einen Buffer zusammenbauen
+ // Read config list from buffer
sal_uIntPtr nBufLen;
sal_uInt8* pBuf = ImplGetConfigBuffer( pData, nBufLen );
if ( pBuf )
@@ -575,7 +570,7 @@ static void ImplDeleteConfigData( ImplConfigData* pData )
{
pTempGroup = pGroup->mpNext;
- // Alle Keys loeschen
+ // remove all keys
pKey = pGroup->mpFirstKey;
while ( pKey )
{
@@ -584,7 +579,7 @@ static void ImplDeleteConfigData( ImplConfigData* pData )
pKey = pTempKey;
}
- // Gruppe loeschen und weiterschalten
+ // remove group and continue
delete pGroup;
pGroup = pTempGroup;
}
@@ -617,7 +612,7 @@ static void ImplFreeConfigData( ImplConfigData* pDelData )
sal_Bool Config::ImplUpdateConfig() const
{
- // Wenn sich TimeStamp unterscheidet, dann Datei neu einlesen
+ // Re-read file if timestamp differs
if ( mpData->mnTimeStamp != ImplSysGetConfigTimeStamp( maFileName ) )
{
ImplDeleteConfigData( mpData );
@@ -644,7 +639,7 @@ ImplGroupData* Config::ImplGetGroup() const
pGroup = pGroup->mpNext;
}
- // Falls Gruppe noch nicht existiert, dann dazufuegen
+ // Add group if not exists
if ( !pGroup )
{
pGroup = new ImplGroupData;
@@ -657,9 +652,7 @@ ImplGroupData* Config::ImplGetGroup() const
mpData->mpFirstGroup = pGroup;
}
- // Gruppenname immer uebernehmen, da er auch in dieser Form
- // geschrieben werden soll. Ausserdem die Cache-Members der
- // Config-Klasse updaten
+ // Always inherit group names and upate cache members
pGroup->maGroupName = maGroupName;
((Config*)this)->mnDataUpdateId = mpData->mnDataUpdateId;
((Config*)this)->mpActGroup = pGroup;
@@ -670,7 +663,7 @@ ImplGroupData* Config::ImplGetGroup() const
Config::Config( const rtl::OUString& rFileName )
{
- // Daten initialisieren und einlesen
+ // Initialize config data
maFileName = toUncPath( rFileName );
mpData = ImplGetConfigData( maFileName );
mpActGroup = NULL;
@@ -699,8 +692,7 @@ Config::~Config()
void Config::SetGroup(const rtl::OString& rGroup)
{
- // Wenn neue Gruppe gesetzt wird, muss beim naechsten mal die
- // Gruppe neu ermittelt werden
+ // If group is to be reset, it needs to be updated on next call
if ( maGroupName != rGroup )
{
maGroupName = rGroup;
@@ -710,7 +702,7 @@ void Config::SetGroup(const rtl::OString& rGroup)
void Config::DeleteGroup(const rtl::OString& rGroup)
{
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount || !mpData->mbRead )
{
ImplUpdateConfig();
@@ -730,7 +722,7 @@ void Config::DeleteGroup(const rtl::OString& rGroup)
if ( pGroup )
{
- // Alle Keys loeschen
+ // Remove all keys
ImplKeyData* pTempKey;
ImplKeyData* pKey = pGroup->mpFirstKey;
while ( pKey )
@@ -740,14 +732,14 @@ void Config::DeleteGroup(const rtl::OString& rGroup)
pKey = pTempKey;
}
- // Gruppe weiterschalten und loeschen
+ // Rewire pointers and remove group
if ( pPrevGroup )
pPrevGroup->mpNext = pGroup->mpNext;
else
mpData->mpFirstGroup = pGroup->mpNext;
delete pGroup;
- // Config-Datei neu schreiben
+ // Rewrite config data
if ( !mnLockCount && mbPersistence )
ImplWriteConfig( mpData );
else
@@ -755,7 +747,6 @@ void Config::DeleteGroup(const rtl::OString& rGroup)
mpData->mbModified = sal_True;
}
- // Gruppen auf ungluetig setzen
mnDataUpdateId = mpData->mnDataUpdateId;
mpData->mnDataUpdateId++;
}
@@ -763,7 +754,7 @@ void Config::DeleteGroup(const rtl::OString& rGroup)
rtl::OString Config::GetGroupName(sal_uInt16 nGroup) const
{
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount )
ImplUpdateConfig();
@@ -787,7 +778,7 @@ rtl::OString Config::GetGroupName(sal_uInt16 nGroup) const
sal_uInt16 Config::GetGroupCount() const
{
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount )
ImplUpdateConfig();
@@ -804,7 +795,7 @@ sal_uInt16 Config::GetGroupCount() const
sal_Bool Config::HasGroup(const rtl::OString& rGroup) const
{
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount )
ImplUpdateConfig();
@@ -850,11 +841,11 @@ rtl::OString Config::ReadKey(const rtl::OString& rKey, const rtl::OString& rDefa
OSL_TRACE("%s", aTraceStr.getStr());
#endif
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount )
ImplUpdateConfig();
- // Key suchen und Value zurueckgeben
+ // Search key, return value if found
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
{
@@ -885,14 +876,14 @@ void Config::WriteKey(const rtl::OString& rKey, const rtl::OString& rStr)
OSL_TRACE("%s", aTraceStr.getStr());
#endif
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount || !mpData->mbRead )
{
ImplUpdateConfig();
mpData->mbRead = sal_True;
}
- // Key suchen und Value setzen
+ // Search key and update value if found
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
{
@@ -939,14 +930,14 @@ void Config::WriteKey(const rtl::OString& rKey, const rtl::OString& rStr)
void Config::DeleteKey(const rtl::OString& rKey)
{
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount || !mpData->mbRead )
{
ImplUpdateConfig();
mpData->mbRead = sal_True;
}
- // Key suchen und Value setzen
+ // Search key and update value
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
{
@@ -963,14 +954,14 @@ void Config::DeleteKey(const rtl::OString& rKey)
if ( pKey )
{
- // Gruppe weiterschalten und loeschen
+ // Rewire group pointers and delete
if ( pPrevKey )
pPrevKey->mpNext = pKey->mpNext;
else
pGroup->mpFirstKey = pKey->mpNext;
delete pKey;
- // Config-Datei neu schreiben
+ // Rewrite config file
if ( !mnLockCount && mbPersistence )
ImplWriteConfig( mpData );
else
@@ -993,11 +984,11 @@ sal_uInt16 Config::GetKeyCount() const
OSL_TRACE("%s", aTraceStr.getStr());
#endif
- // Config-Daten evt. updaten
+ // Update config data if necessary
if ( !mnLockCount )
ImplUpdateConfig();
- // Key suchen und Value zurueckgeben
+ // Search key and update value
sal_uInt16 nCount = 0;
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
@@ -1029,7 +1020,7 @@ rtl::OString Config::GetKeyName(sal_uInt16 nKey) const
OSL_TRACE("%s", aTraceStr.getStr());
#endif
- // Key suchen und Name zurueckgeben
+ // search key and return name if found
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
{
@@ -1064,7 +1055,7 @@ rtl::OString Config::ReadKey(sal_uInt16 nKey) const
OSL_TRACE("%s", aTraceStr.getStr());
#endif
- // Key suchen und Value zurueckgeben
+ // Search key and return value if found
ImplGroupData* pGroup = ImplGetGroup();
if ( pGroup )
{
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index a9a20de37f75..5c805dc7dcd1 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -23,20 +23,16 @@
#include <tools/stream.hxx>
#include <tools/bigint.hxx>
-// Beschreibung: Berechnet den groessten gemeinsamen Teiler von
-// nVal1 und nVal2
-// Parameter long nVal1, long nVal2
-
-// Die Funktion GetGGT berechnet den groessten gemeinsamen Teiler der
-// beiden als Parameter uebergebenen Werte nVal1 und nVal2 nach dem
-// Algorithmus von Euklid. Hat einer der beiden Parameter den Wert 0 oder
-// 1, so wird als Ergebnis der Wert 1 zur�ckgegeben. Da der Algorithmus
-// nur mit positiven Zahlen arbeitet, werden die beiden Parameter
-// entsprechend umgewandelt.
-// Zum Algorithmus: die beiden Parameter werden solange ducheinander
-// geteilt, bis sie beide gleich sind oder bis bei der Division
-// kein Rest bleibt. Der kleinere der beiden Werte ist dann der
-// GGT.
+/** Compute greates common divisor using Euclidian algorithm
+
+ As the algorithm works on positive values only, the absolute value
+ of each parameter is used.
+
+ @param nVal1
+ @param nVal2
+
+ @note: If one parameter is {0,1}, GetGGT returns 1.
+*/
static long GetGGT( long nVal1, long nVal2 )
{
nVal1 = Abs( nVal1 );
@@ -101,11 +97,10 @@ static void Reduce( BigInt &rVal1, BigInt &rVal2 )
rVal2 /= nB;
}
-// Zur Initialisierung eines Bruches wird nNum dem Zaehler und nDen dem
-// Nenner zugewiesen. Da negative Werte des Nenners einen Bruch als
-// ungueltig kennzeichnen, wird bei der Eingabe eines negativen Nenners
-// sowohl das Vorzeichen des Nenners und des Zaehlers invertiert um wieder
-// einen gueltigen Wert fuer den Bruch zu erhalten.
+// Initialized by setting nNum as nominator and nDen as denominator
+// Negative values in the denominator are invalid and cause the
+// inversion of both nominator and denominator signs
+// in order to return the correct value.
Fraction::Fraction( long nNum, long nDen )
{
nNumerator = nNum;
@@ -116,17 +111,15 @@ Fraction::Fraction( long nNum, long nDen )
nNumerator = -nNumerator;
}
- // Kuerzen ueber Groesste Gemeinsame Teiler
+ // Reduce through GCD
long n = GetGGT( nNumerator, nDenominator );
nNumerator /= n;
nDenominator /= n;
}
-// Wenn der Wert von dVal groesser ist als LONG_MAX, dann wird der Bruch
-// auf den Wert ungueltig gesetzt, ansonsten werden dVal und der Nenner
-// solange mit 10 multipliziert, bis entweder der Zaehler oder der Nenner
-// groesser als LONG_MAX / 10 ist. Zum Schluss wird der so entstandene Bruch
-// gekuerzt.
+// If dVal > LONG_MAX, the fraction is set as invalid.
+// Otherwise, dVal and denominator are multiplied with 10, until one of them
+// is larger than (LONG_MAX / 10) and the fraction is reduced with GCD
Fraction::Fraction( double dVal )
{
long nDen = 1;
@@ -147,7 +140,7 @@ Fraction::Fraction( double dVal )
nNumerator = (long)dVal;
nDenominator = nDen;
- // Kuerzen ueber Groesste Gemeinsame Teiler
+ // Reduce through GCD
long n = GetGGT( nNumerator, nDenominator );
nNumerator /= n;
nDenominator /= n;
@@ -161,15 +154,12 @@ Fraction::operator double() const
return (double)0;
}
-// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
-// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
-// ungueltig. Zur Addition werden die beiden Brueche erst durch
-// Erweiterung mit den Nenner des jeweils anderen Bruches auf einen
-// gemeinsamen Nenner gebracht. Anschliessend werden die beiden Zaehler
-// addiert und das Ergebnis gekuerzt (durch Division von Zaehler und
-// Nenner mit nGGT). Innerhalb der Funktion wird mit dem Datentyp SLong
-// gerechnet, um einen Moeglichen Ueberlauf erkennen zu koennen. Bei
-// einem Ueberlauf wird das Ergebnis auf den Wert ungueltig gesetzt.
+// This methods first validates both values.
+// If one of the arguments is invalid, the whole operation is invalid.
+// For addition both fractions are extended to match the denominator,
+// then nominators are added and reduced (through GCD).
+// Internal datatype for computation is SLong to detect overflows,
+// which cause the operation to be marked as invalid
Fraction& Fraction::operator += ( const Fraction& rVal )
{
if ( !rVal.IsValid() )
@@ -206,15 +196,12 @@ Fraction& Fraction::operator += ( const Fraction& rVal )
return *this;
}
-// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
-// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
-// ungueltig. Zur Subtraktion werden die beiden Brueche erst durch
-// Erweiterung mit den Nenner des jeweils anderen Bruches auf einen
-// gemeinsamen Nenner gebracht. Anschliessend werden die beiden Zaehler
-// subtrahiert und das Ergebnis gekuerzt (durch Division von Zaehler und
-// Nenner mit nGGT). Innerhalb der Funktion wird mit dem Datentyp BigInt
-// gerechnet, um einen Moeglichen Ueberlauf erkennen zu koennen. Bei
-// einem Ueberlauf wird das Ergebnis auf den Wert ungueltig gesetzt.
+// This methods first validates both values.
+// If one of the arguments is invalid, the whole operation is invalid.
+// For substraction, both fractions are extended to match the denominator,
+// then nominators are substracted and reduced (through GCD).
+// Internal datatype for computation is SLong to detect overflows,
+// which cause the operation to be marked as invalid
Fraction& Fraction::operator -= ( const Fraction& rVal )
{
if ( !rVal.IsValid() )
@@ -251,16 +238,12 @@ Fraction& Fraction::operator -= ( const Fraction& rVal )
return *this;
}
-// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
-// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
-// ungueltig. Zur Multiplikation werden jeweils die beiden Zaehler und
-// Nenner miteinander multipliziert. Um Ueberlaufe zu vermeiden, werden
-// vorher jeweils der GGT zwischen dem Zaehler des einen und dem Nenner
-// des anderen Bruches bestimmt und bei der Multiplikation Zaehler und
-// Nenner durch die entsprechenden Werte geteilt.
-// Innerhalb der Funktion wird mit dem Datentyp BigInt gerechnet, um
-// einen Moeglichen Ueberlauf erkennen zu koennen. Bei einem Ueberlauf
-// wird das Ergebnis auf den Wert ungueltig gesetzt.
+// This methods first validates both values.
+// If one of the arguments is invalid, the whole operation is invalid.
+// For mutliplication, nominator and denominators are first reduced
+// (through GCD), and then multiplied.
+// Internal datatype for computation is BigInt to detect overflows,
+// which cause the operation to be marked as invalid
Fraction& Fraction::operator *= ( const Fraction& rVal )
{
if ( !rVal.IsValid() )
@@ -292,19 +275,12 @@ Fraction& Fraction::operator *= ( const Fraction& rVal )
return *this;
}
-// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
-// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
-// ungueltig.
-// Um den Bruch a durch b zu teilen, wird a mit dem Kehrwert von b
-// multipliziert. Analog zu Multiplikation wird jezt jeweils der Zaehler
-// des einen Bruches mit dem Nenner des anderen multipliziert.
-// Um Ueberlaufe zu vermeiden, werden vorher jeweils der GGT zwischen den
-// beiden Zaehlern und den beiden Nennern bestimmt und bei der
-// Multiplikation Zaehler und Nenner durch die entsprechenden Werte
-// geteilt.
-// Innerhalb der Funktion wird mit dem Datentyp BigInt gerechnet, um
-// einen Moeglichen Ueberlauf erkennen zu koennen. Bei einem Ueberlauf
-// wird das Ergebnis auf den Wert ungueltig gesetzt.
+// This methods first validates both values.
+// If one of the arguments is invalid, the whole operation is invalid.
+// For dividing a/b, we multiply a with the inverse of b.
+// To avoid overflows, we first reduce both fractions with GCD.
+// Internal datatype for computation is BigInt to detect overflows,
+// which cause the operation to be marked as invalid
Fraction& Fraction::operator /= ( const Fraction& rVal )
{
if ( !rVal.IsValid() )
@@ -472,12 +448,9 @@ bool operator == ( const Fraction& rVal1, const Fraction& rVal2 )
&& rVal1.nDenominator == rVal2.nDenominator;
}
-// Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und
-// anschliessend zur Sicherheit noch einmal gekuerzt. Um die Brueche
-// (a/b) und (c/d) zu vergleichen, werden sie zunaechst auf einen
-// gemeinsamen Nenner gebracht (b*d), um dann die beiden Zaehler (a*d)
-// und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird
-// zurueckgegeben.
+// This methods first validates and reduces both values.
+// To compare (a/b) with (c/d), extend denominators (b*d), then return
+// the result of comparing the nominators (a < c)
bool operator < ( const Fraction& rVal1, const Fraction& rVal2 )
{
if ( !rVal1.IsValid() || !rVal2.IsValid() )
@@ -491,12 +464,9 @@ bool operator < ( const Fraction& rVal1, const Fraction& rVal2 )
return nN < nD;
}
-// Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und
-// anschliessend zur Sicherheit noch einmal gekuerzt. Um die Brueche
-// (a/b) und (c/d) zu vergleichen, werden sie zunaechst auf einen
-// gemeinsamen Nenner gebracht (b*d), um dann die beiden Zaehler (a*d)
-// und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird
-// zurueckgegeben.
+// This methods first validates and reduces both values.
+// To compare (a/b) with (c/d), extend denominators (b*d), then return
+// the result of comparing nominators (a > c)
bool operator > ( const Fraction& rVal1, const Fraction& rVal2 )
{
if ( !rVal1.IsValid() || !rVal2.IsValid() )
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 0c1702e678f7..e4a03a318f1f 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -89,18 +89,18 @@ Rectangle& Rectangle::Intersection( const Rectangle& rRect )
return *this;
}
- // nicht mit umgedrehten Rechtecken arbeiten
+ // Justify rectangle
Rectangle aTmpRect( rRect );
Justify();
aTmpRect.Justify();
- // Schnitt bilden
+ // Perform intersection
nLeft = Max( nLeft, aTmpRect.nLeft );
nRight = Min( nRight, aTmpRect.nRight );
nTop = Max( nTop, aTmpRect.nTop );
nBottom= Min( nBottom, aTmpRect.nBottom );
- // Feststellen ob Schnitt leer
+ // Determine if intersection is empty
if ( nRight < nLeft || nBottom < nTop )
*this = Rectangle();
@@ -111,7 +111,6 @@ void Rectangle::Justify()
{
long nHelp;
- // Abfrage, ob Right kleiner Left
if ( (nRight < nLeft) && (nRight != RECT_EMPTY) )
{
nHelp = nLeft;
@@ -119,7 +118,6 @@ void Rectangle::Justify()
nRight = nHelp;
}
- // Abfrage, ob Bottom kleiner Top
if ( (nBottom < nTop) && (nBottom != RECT_EMPTY) )
{
nHelp = nBottom;
@@ -167,7 +165,7 @@ sal_Bool Rectangle::IsInside( const Rectangle& rRect ) const
sal_Bool Rectangle::IsOver( const Rectangle& rRect ) const
{
- // Wenn sie sich nicht schneiden, ueberlappen sie auch nicht
+ // If there's no intersection, they don't overlap
return !GetIntersection( rRect ).IsEmpty();
}
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index cf0a017f8d41..b15c97c6efb7 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -218,7 +218,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
if( nPos >= mnPoints )
{
- // Hinten anhaengen
+ // Append at the back
nPos = mnPoints;
ImplSetSize( nNewSize, sal_True );
@@ -232,7 +232,6 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
}
else
{
- // PointArray ist in diesem Zweig immer vorhanden
const sal_uInt16 nSecPos = nPos + nSpace;
const sal_uInt16 nRest = mnPoints - nPos;
@@ -248,7 +247,7 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
memcpy( pNewAry + nSecPos, mpPointAry + nPos, nRest * sizeof( Point ) );
delete[] (char*) mpPointAry;
- // ggf. FlagArray beruecksichtigen
+ // consider FlagArray
if( mpFlagAry )
{
sal_uInt8* pNewFlagAry = new sal_uInt8[ nNewSize ];
@@ -281,7 +280,7 @@ void ImplPolygon::ImplCreateFlagArray()
inline void Polygon::ImplMakeUnique()
{
- // Falls noch andere Referenzen bestehen, dann kopieren
+ // copy references if any exist
if ( mpImplPolygon->mnRefCount != 1 )
{
if ( mpImplPolygon->mnRefCount )
@@ -413,7 +412,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin
if( nRadX && nRadY )
{
- // Default berechnen (abhaengig von Groesse)
+ // Compute default (depends on size)
if( !nPoints )
{
nPoints = (sal_uInt16) ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
@@ -425,7 +424,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin
nPoints >>= 1;
}
- // Anzahl der Punkte auf durch 4 teilbare Zahl aufrunden
+ // Ceil number of points until divisible by four
mpImplPolygon = new ImplPolygon( nPoints = (nPoints + 3) & ~3 );
Point* pPt;
@@ -481,7 +480,7 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn
if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
nPoints >>= 1;
- // Winkel berechnen
+ // compute threshold
const double fRadX = nRadX;
const double fRadY = nRadY;
const double fCenterX = aCenter.X();
@@ -499,9 +498,7 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn
if ( bFullCircle )
fDiff = F_2PI;
- // Punktanzahl proportional verkleinern ( fDiff / (2PI) );
- // ist eingentlich nur fuer einen Kreis richtig; wir
- // machen es hier aber trotzdem
+ // Proportionally shrink number of points( fDiff / (2PI) );
nPoints = Max( (sal_uInt16) ( ( fDiff * 0.1591549 ) * nPoints ), (sal_uInt16) 16 );
fStep = fDiff / ( nPoints - 1 );
@@ -576,8 +573,7 @@ Polygon::~Polygon()
{
DBG_DTOR( Polygon, NULL );
- // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
- // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ // Remove if refcount == 0, otherwise decrement refcount
if ( mpImplPolygon->mnRefCount )
{
if ( mpImplPolygon->mnRefCount > 1 )
@@ -1026,13 +1022,13 @@ void Polygon::Move( long nHorzMove, long nVertMove )
{
DBG_CHKTHIS( Polygon, NULL );
- // Diese Abfrage sollte man fuer die DrawEngine durchfuehren
+ // This check is required for DrawEngine
if ( !nHorzMove && !nVertMove )
return;
ImplMakeUnique();
- // Punkte verschieben
+ // Move points
sal_uInt16 nCount = mpImplPolygon->mnPoints;
for ( sal_uInt16 i = 0; i < nCount; i++ )
{
@@ -1109,7 +1105,7 @@ protected:
class ImplPolygonPointFilter : public ImplPointFilter
{
public:
- ImplPolygon* mpPoly; // Nicht loeschen, wird dem Polygon zugewiesen
+ ImplPolygon* mpPoly; // Don't remove, assigned by polygon
sal_uInt16 mnSize;
ImplPolygonPointFilter( sal_uInt16 nDestSize ) :
@@ -1316,8 +1312,7 @@ void Polygon::Clip( const Rectangle& rRect, sal_Bool bPolygon )
else
aPolygon.LastPoint();
- // Alte ImpPolygon-Daten loeschen und die vom ImpPolygonPointFilter
- // zuweisen
+ // Delete old ImpPolygon-data and assign from ImpPolygonPointFilter
if ( mpImplPolygon->mnRefCount )
{
if ( mpImplPolygon->mnRefCount > 1 )
@@ -1420,8 +1415,7 @@ sal_Bool Polygon::IsInside( const Point& rPoint ) const
if ( aLine.Intersection( Line( aPt1, rPt2 ), aIntersection ) )
{
- // Hiermit verhindern wir das Einfuegen von
- // doppelten Intersections, die gleich hintereinander folgen
+ // This avoids insertion of double intersections
if ( nPCounter )
{
if ( aIntersection != aLastIntersection )
@@ -1441,7 +1435,7 @@ sal_Bool Polygon::IsInside( const Point& rPoint ) const
}
}
- // innerhalb, wenn die Anzahl der Schnittpunkte ungerade ist
+ // is inside, if number of intersection points is odd
return ( ( nPCounter & 1 ) == 1 );
}
@@ -1503,13 +1497,12 @@ Polygon& Polygon::operator=( const Polygon& rPoly )
DBG_CHKOBJ( &rPoly, Polygon, NULL );
DBG_ASSERT( rPoly.mpImplPolygon->mnRefCount < 0xFFFFFFFE, "Polygon: RefCount overflow" );
- // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
- // RefCount == 0 fuer statische Objekte
+ // Increase refcounter before assigning
+ // Note: RefCount == 0 for static objects
if ( rPoly.mpImplPolygon->mnRefCount )
rPoly.mpImplPolygon->mnRefCount++;
- // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
- // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ // Delete if recount == 0, otherwise decrement
if ( mpImplPolygon->mnRefCount )
{
if ( mpImplPolygon->mnRefCount > 1 )
@@ -1562,7 +1555,7 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
sal_uInt16 i;
sal_uInt16 nPoints;
- // Anzahl der Punkte einlesen und Array erzeugen
+ // read all points and create array
rIStream >> nPoints;
if ( rPoly.mpImplPolygon->mnRefCount != 1 )
{
@@ -1574,7 +1567,7 @@ SvStream& operator>>( SvStream& rIStream, Polygon& rPoly )
rPoly.mpImplPolygon->ImplSetSize( nPoints, sal_False );
{
- // Feststellen, ob ueber die Operatoren geschrieben werden muss
+ // Determine whether we need to write through operators
#if (SAL_TYPES_SIZEOFLONG) != 4
if ( 1 )
#else
@@ -1609,11 +1602,11 @@ SvStream& operator<<( SvStream& rOStream, const Polygon& rPoly )
sal_uInt16 i;
sal_uInt16 nPoints = rPoly.GetSize();
- // Anzahl der Punkte rausschreiben
+ // Write number of points
rOStream << nPoints;
{
- // Feststellen, ob ueber die Operatoren geschrieben werden muss
+ // Determine whether we need to write through operators
#if (SAL_TYPES_SIZEOFLONG) != 4
if ( 1 )
#else
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 0bf255514d59..732f9b4b4060 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -389,17 +389,16 @@ void PolyPolygon::Move( long nHorzMove, long nVertMove )
{
DBG_CHKTHIS( PolyPolygon, NULL );
- // Diese Abfrage sollte man fuer die DrawEngine durchfuehren
+ // Required for DrawEngine
if( nHorzMove || nVertMove )
{
- // Referenzcounter beruecksichtigen
if ( mpImplPolyPolygon->mnRefCount > 1 )
{
mpImplPolyPolygon->mnRefCount--;
mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon );
}
- // Punkte verschieben
+ // move points
sal_uInt16 nPolyCount = mpImplPolyPolygon->mnCount;
for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
mpImplPolyPolygon->mpPolyAry[i]->Move( nHorzMove, nVertMove );
@@ -410,14 +409,13 @@ void PolyPolygon::Translate( const Point& rTrans )
{
DBG_CHKTHIS( PolyPolygon, NULL );
- // Referenzcounter beruecksichtigen
if( mpImplPolyPolygon->mnRefCount > 1 )
{
mpImplPolyPolygon->mnRefCount--;
mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon );
}
- // Punkte verschieben
+ // move points
for ( sal_uInt16 i = 0, nCount = mpImplPolyPolygon->mnCount; i < nCount; i++ )
mpImplPolyPolygon->mpPolyAry[ i ]->Translate( rTrans );
}
@@ -426,14 +424,13 @@ void PolyPolygon::Scale( double fScaleX, double fScaleY )
{
DBG_CHKTHIS( PolyPolygon, NULL );
- // Referenzcounter beruecksichtigen
if( mpImplPolyPolygon->mnRefCount > 1 )
{
mpImplPolyPolygon->mnRefCount--;
mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon );
}
- // Punkte verschieben
+ // Move points
for ( sal_uInt16 i = 0, nCount = mpImplPolyPolygon->mnCount; i < nCount; i++ )
mpImplPolyPolygon->mpPolyAry[ i ]->Scale( fScaleX, fScaleY );
}
@@ -454,35 +451,32 @@ void PolyPolygon::Rotate( const Point& rCenter, double fSin, double fCos )
{
DBG_CHKTHIS( PolyPolygon, NULL );
- // Referenzcounter beruecksichtigen
if( mpImplPolyPolygon->mnRefCount > 1 )
{
mpImplPolyPolygon->mnRefCount--;
mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon );
}
- // Punkte verschieben
+ // move points
for ( sal_uInt16 i = 0, nCount = mpImplPolyPolygon->mnCount; i < nCount; i++ )
mpImplPolyPolygon->mpPolyAry[ i ]->Rotate( rCenter, fSin, fCos );
}
void PolyPolygon::Clip( const Rectangle& rRect )
{
- // Polygon-Clippen
sal_uInt16 nPolyCount = mpImplPolyPolygon->mnCount;
sal_uInt16 i;
if ( !nPolyCount )
return;
- // Referenzcounter beruecksichtigen
if ( mpImplPolyPolygon->mnRefCount > 1 )
{
mpImplPolyPolygon->mnRefCount--;
mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon );
}
- // Erst jedes Polygon Clippen und dann die leeren entfernen
+ // Clip every polygon, deleting the empty ones
for ( i = 0; i < nPolyCount; i++ )
mpImplPolyPolygon->mpPolyAry[i]->Clip( rRect );
while ( nPolyCount )
@@ -607,13 +601,11 @@ SvStream& operator>>( SvStream& rIStream, PolyPolygon& rPolyPoly )
Polygon* pPoly;
sal_uInt16 nPolyCount;
- // Anzahl der Polygone einlesen
+ // read number of polygons
rIStream >> nPolyCount;
- // Daten anlegen
if( nPolyCount )
{
- // Referenzcounter beruecksichtigen
if ( rPolyPoly.mpImplPolyPolygon->mnRefCount > 1 )
rPolyPoly.mpImplPolyPolygon->mnRefCount--;
else
@@ -639,11 +631,11 @@ SvStream& operator<<( SvStream& rOStream, const PolyPolygon& rPolyPoly )
DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
DBG_ASSERTWARNING( rOStream.GetVersion(), "PolyPolygon::<< - Solar-Version not set on rOStream" );
- // Anzahl der Polygone rausschreiben
+ // Write number of polygons
sal_uInt16 nPolyCount = rPolyPoly.mpImplPolyPolygon->mnCount;
rOStream << nPolyCount;
- // Die einzelnen Polygone ausgeben
+ // output polygons
for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
rOStream << *(rPolyPoly.mpImplPolyPolygon->mpPolyAry[i]);
@@ -660,13 +652,11 @@ void PolyPolygon::Read( SvStream& rIStream )
Polygon* pPoly;
sal_uInt16 nPolyCount;
- // Anzahl der Polygone einlesen
+ // Read number of polygons
rIStream >> nPolyCount;
- // Daten anlegen
if( nPolyCount )
{
- // Referenzcounter beruecksichtigen
if ( mpImplPolyPolygon->mnRefCount > 1 )
mpImplPolyPolygon->mnRefCount--;
else
@@ -692,11 +682,11 @@ void PolyPolygon::Write( SvStream& rOStream ) const
DBG_CHKTHIS( PolyPolygon, NULL );
DBG_ASSERTWARNING( rOStream.GetVersion(), "PolyPolygon::<< - Solar-Version not set on rOStream" );
- // Anzahl der Polygone rausschreiben
+ // Write number of polygons
sal_uInt16 nPolyCount = mpImplPolyPolygon->mnCount;
rOStream << nPolyCount;
- // Die einzelnen Polygone ausgeben
+ // Output polygons
for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
mpImplPolyPolygon->mpPolyAry[i]->ImplWrite( rOStream );
}
diff --git a/tools/source/generic/svborder.cxx b/tools/source/generic/svborder.cxx
index 6cc15200a4ce..a905b2c34ba9 100644
--- a/tools/source/generic/svborder.cxx
+++ b/tools/source/generic/svborder.cxx
@@ -21,7 +21,7 @@
Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder )
{
- // wegen Empty-Rect, GetSize muss als erstes gerufen werden
+ // call GetSize first due to Empty-Rect
Size aS( rRect.GetSize() );
aS.Width() += rBorder.Left() + rBorder.Right();
aS.Height() += rBorder.Top() + rBorder.Bottom();
@@ -34,7 +34,7 @@ Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder )
Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder )
{
- // wegen Empty-Rect, GetSize muss als erstes gerufen werden
+ // call GetSize first due to Empty-Rect
Size aS( rRect.GetSize() );
aS.Width() -= rBorder.Left() + rBorder.Right();
aS.Height() -= rBorder.Top() + rBorder.Bottom();
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index a6895a354e95..429c60800dfd 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -304,7 +304,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect )
DBG_ASSERT(aTotRange.IsInside(nTmpMax), "selected index out of range" );
DBG_ASSERT(aTotRange.IsInside(nTmpMin), "selected index out of range" );
- // gesamte Selektion ersetzen ?
+ // replace whole selection?
if( nTmpMin <= nCurMin && nTmpMax >= nCurMax )
{
ImplClear();
@@ -315,12 +315,12 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect )
}
return;
}
- // links erweitern ?
+ // expand on left side?
if( nTmpMax < nCurMin )
{
if( bSelect )
{
- // ersten Range erweitern ?
+ // extend first range?
if( nCurMin > (nTmpMax+1) )
{
pRange = new Range( rIndexRange );
@@ -338,12 +338,12 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect )
}
return;
}
- // rechts erweitern ?
+ // expand on right side?
else if( nTmpMin > nCurMax )
{
if( bSelect )
{
- // letzten Range erweitern ?
+ // extend last range?
if( nTmpMin > (nCurMax+1) )
{
pRange = new Range( rIndexRange );
@@ -362,7 +362,7 @@ void MultiSelection::Select( const Range& rIndexRange, sal_Bool bSelect )
return;
}
- //HACK(Hier muss noch optimiert werden)
+ // TODO here is potential for optimization
while( nTmpMin <= nTmpMax )
{
Select( nTmpMin, bSelect );
@@ -554,7 +554,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
{
aTotRange = rTotRange;
- // die untere Bereichsgrenze anpassen
+ // adjust lower boundary
Range* pRange = aSels.empty() ? NULL : aSels.front();
while( pRange )
{
@@ -574,7 +574,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
pRange = aSels.empty() ? NULL : aSels.front();
}
- // die obere Bereichsgrenze anpassen
+ // adjust upper boundary
size_t nCount = aSels.size();
while( nCount )
{
@@ -595,7 +595,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
nCount = aSels.size();
}
- // Selection-Count neu berechnen
+ // re-calculate selection count
nSelCount = 0;
for ( size_t i = 0, n = aSels.size(); i < n; ++ i ) {
nSelCount += pRange->Len();
diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx
index 4707d76066ab..d9d7e7b970b9 100644
--- a/tools/source/memtools/unqidx.cxx
+++ b/tools/source/memtools/unqidx.cxx
@@ -21,26 +21,25 @@
sal_uIntPtr UniqueIndexImpl::Insert( void* p )
{
- // NULL-Pointer ist nicht erlaubt
+ // NULL-Pointer not allowed
if ( !p )
return UNIQUEINDEX_ENTRY_NOTFOUND;
- // Ist Array voll, dann expandieren
+ // Expend array if full
sal_uIntPtr nTmp = size();
if( nTmp == nCount )
nTmp++;
- // Damit UniqIndex nicht ueberlaeuft, wenn Items geloescht wurden
+ // Avoid overflow of UniqIndex upon deletion
nUniqIndex = nUniqIndex % nTmp;
- // Leeren Eintrag suchen
+ // Search next empty index
while ( find( nUniqIndex ) != end() )
nUniqIndex = (nUniqIndex+1) % nTmp;
- // Object im Array speichern
+ // Insert object to array
(*this)[ nUniqIndex ] = p;
- // Anzahl der Eintraege erhoehen und Index zurueckgeben
nCount++;
nUniqIndex++;
return ( nUniqIndex + nStartIndex - 1 );
@@ -48,7 +47,7 @@ sal_uIntPtr UniqueIndexImpl::Insert( void* p )
void UniqueIndexImpl::Insert( sal_uIntPtr nIndex, void* p )
{
- // NULL-Pointer ist nicht erlaubt
+ // NULL-Pointer not allowed
if ( !p )
return;
@@ -56,7 +55,7 @@ void UniqueIndexImpl::Insert( sal_uIntPtr nIndex, void* p )
bool bFound = find( nContIndex ) != end();
- // Object im Array speichern
+ // Insert object to array
(*this)[ nContIndex ] = p;
if( !bFound )
@@ -65,12 +64,12 @@ void UniqueIndexImpl::Insert( sal_uIntPtr nIndex, void* p )
void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex )
{
- // Ist Index zulaessig
+ // Check for valid index
if ( (nIndex >= nStartIndex) &&
(nIndex < (size() + nStartIndex)) )
{
- // Index-Eintrag als leeren Eintrag setzen und Anzahl der
- // gespeicherten Indexe erniedriegen, wenn Eintrag belegt war
+ // insert index as empty entry, and reduce indexcount,
+ // if this entry was used
iterator it = find( nIndex - nStartIndex );
if( it != end() )
{
@@ -85,7 +84,7 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex )
void* UniqueIndexImpl::Get( sal_uIntPtr nIndex ) const
{
- // Ist Index zulaessig
+ // check for valid index
if ( (nIndex >= nStartIndex) &&
(nIndex < (size() + nStartIndex)) )
{
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 2ce91a3001c1..cf51100ecbc7 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -568,10 +568,9 @@ sal_Bool InternalResMgr::Create()
pStm->Read( pContentBuf, lContLen );
// allocate ImpContent space (sizeof(ImpContent) per unit, not necessarily 12)
pContent = (ImpContent *)rtl_allocateMemory( sizeof(ImpContent)*lContLen/12 );
- // Auf die Anzahl der ImpContent k�rzen
+ // Shorten to number of ImpContent
nEntries = (sal_uInt32)lContLen / 12;
- bEqual2Content = sal_True; // Die Daten der Resourcen liegen
- // genauso wie das Inhaltsverzeichnis
+ bEqual2Content = sal_True;
sal_Bool bSorted = sal_True;
if( nEntries )
{
@@ -634,7 +633,7 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
if( pResUseDump )
pResUseDump->erase( (sal_uInt64(nRT) << 32) | nId );
#endif
- // Anfang der Strings suchen
+ // search beginning of string
ImpContent aValue;
aValue.nTypeAndId = ((sal_uInt64(nRT) << 32) | nId);
ImpContent* pEnd = (pContent + nEntries);
@@ -646,10 +645,10 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
{
if( nRT == RSC_STRING && bEqual2Content )
{
- // String Optimierung
+ // string optimization
if( !pStringBlock )
{
- // Anfang der Strings suchen
+ // search beginning of string
ImpContent * pFirst = pFind;
ImpContent * pLast = pFirst;
while( pFirst > pContent && ((pFirst -1)->nTypeAndId >> 32) == RSC_STRING )
@@ -684,14 +683,13 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
}
} // if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == nValue) )
*pResHandle = 0;
- //Resource holen
return NULL;
}
void InternalResMgr::FreeGlobalRes( void * pResHandle, void * pResource )
{
if ( !pResHandle )
- // REsource wurde extra allokiert
+ // Free allocated resource
rtl_freeMemory(pResource);
}
@@ -699,7 +697,7 @@ void InternalResMgr::FreeGlobalRes( void * pResHandle, void * pResource )
UniString GetTypeRes_Impl( const ResId& rTypeId )
{
- // Funktion verlassen, falls Resourcefehler in dieser Funktion
+ // Return on resource errors
static int bInUse = sal_False;
rtl::OUString aTypStr(OUString::valueOf(static_cast<sal_Int32>(rTypeId.GetId())));
@@ -716,7 +714,7 @@ UniString GetTypeRes_Impl( const ResId& rTypeId )
if ( rTypeId.GetResMgr()->IsAvailable( rTypeId ) )
{
aTypStr = rTypeId.toString();
- // Versions Resource Klassenzeiger ans Ende setzen
+ // Set class pointer to the end
rTypeId.GetResMgr()->Increment( sizeof( RSHEADER_TYPE ) );
}
}
@@ -821,10 +819,9 @@ static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack,
RESOURCE_TYPE nRTType,
sal_uInt32 nId )
{
- // Gibt die Position der Resource zurueck, wenn sie gefunden wurde.
- // Ansonsten gibt die Funktion Null zurueck.
- RSHEADER_TYPE* pTmp; // Zeiger auf Kind-Resourceobjekte
- RSHEADER_TYPE* pEnd; // Zeiger auf das Ende der Resource
+ // Returns position of the resource if found or NULL otherwise
+ RSHEADER_TYPE* pTmp; // Pointer to child resource
+ RSHEADER_TYPE* pEnd; // Pointer to the end of this resource
if ( pStack->pResource && pStack->pClassRes )
{
@@ -885,8 +882,8 @@ void ResMgr::Init( const OUString& rFileName )
#ifdef DBG_UTIL
else
{
- void* aResHandle = 0; // Hilfvariable fuer Resource
- void* pVoid; // Zeiger auf die Resource
+ void* aResHandle = 0; // Helper variable for resource handles
+ void* pVoid; // Pointer on the resource
pVoid = pImpRes->LoadGlobalRes( RSC_VERSIONCONTROL, RSCVERSION_ID,
&aResHandle );
@@ -1034,7 +1031,6 @@ sal_Bool ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const
}
}
- // vieleicht globale Resource
if ( !pClassRes )
bAvailable = pMgr->pImpRes->IsGlobalAvailable( nRT, nId );
@@ -1208,9 +1204,9 @@ void ResMgr::PopContext( const Resource* pResObj )
}
#endif
- // Resource freigeben
+ // free resource
if( (pTop->Flags & (RC_GLOBAL | RC_NOTFOUND)) == RC_GLOBAL )
- // kann auch Fremd-Resource sein
+ // free global resource if resource is foreign
InternalResMgr::FreeGlobalRes( pTop->aResHandle, pTop->pResource );
decStack();
}
@@ -1230,13 +1226,14 @@ RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
RSHEADER_TYPE* pHeader = NULL;
if ( GetResource( rId ) )
{
- // Der Zeiger steht am Anfang, deswegen zeigt der Klassen-Pointer
- // auf den Header und die restliche Groesse ist die Gesammte.
+ // Pointer is at the beginning of the resource, thus
+ // class pointer points to the header, and the remaining size
+ // equals to total size of allocated memory
pHeader = (RSHEADER_TYPE*)rtl_allocateMemory( GetRemainSize() );
memcpy( pHeader, GetClass(), GetRemainSize() );
Increment( pHeader->GetLocalOff() ); //ans Ende setzen
if ( pHeader->GetLocalOff() != pHeader->GetGlobOff() )
- // Hat Sub-Resourcen, deshalb extra freigeben
+ // Has sub-resources, thus release them as well
PopContext();
}
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
index 93d1c72f068b..48087a7186f2 100644
--- a/tools/source/ref/errinf.cxx
+++ b/tools/source/ref/errinf.cxx
@@ -85,16 +85,13 @@ EDcrData *EDcrData::GetData()
void EDcr_Impl::RegisterEDcr(DynamicErrorInfo *pDcr)
{
- //Vergibt eine dynamische Id
-
+ // Register dynamic identifier
EDcrData* pData=EDcrData::GetData();
lErrId= (((sal_uIntPtr)pData->nNextDcr + 1) << ERRCODE_DYNAMIC_SHIFT) +
pDcr->GetErrorCode();
DynamicErrorInfo **ppDcr=pData->ppDcr;
sal_uInt16 nNext=pData->nNextDcr;
- // bei einem Ringbuffer koennen wir uns das ASSERT wohl sparen!
- // DBG_ASSERT(ppDcr[nNext]==0,"ErrHdl: Alle Errors belegt");
if(ppDcr[nNext])
{
delete ppDcr[nNext];
@@ -247,26 +244,27 @@ void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp)
pData->pDsp = reinterpret_cast< DisplayFnPtr >(aDsp);
}
-sal_uInt16 ErrorHandler::HandleError_Impl(
- sal_uIntPtr lId, sal_uInt16 nFlags, sal_Bool bJustCreateString, String & rError)
-{
-
-/* [Beschreibung]
- Handelt einen Fehler ab. lId ist die FehlerId, nFlags sind die
- ErrorFlags. Werden nFlags nicht abgegeben, so werden die in
- der DynamicErrorInfo angegebenen Flags bzw. die aus der Resource
- verwendet.
+/** Handles an error.
- Also:
+ If nFlags is not set, the DynamicErrorInfo flags or the
+ resource flags will be used.
+ Thus:
1. nFlags,
2. Resource Flags
3. Dynamic Flags
4. Default ERRCODE_BUTTON_OK, ERRCODE_MSG_ERROR
+ @param lId error id
+ @param nFlags error flags.
+ @param bJustCreateString ???
+ @param rError ???
- */
-
+ @return ???
+*/
+sal_uInt16 ErrorHandler::HandleError_Impl(
+ sal_uIntPtr lId, sal_uInt16 nFlags, sal_Bool bJustCreateString, String & rError)
+{
String aErr;
String aAction;
if(!lId || lId == ERRCODE_ABORT)
@@ -277,7 +275,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
if(pCtx)
pCtx->GetString(pInfo->GetErrorCode(), aAction);
Window *pParent=0;
- //Nimm den Parent aus dem Konext
+ // Remove parent from context
for(;pCtx;pCtx=pCtx->pNext)
if(pCtx->GetParent())
{
@@ -336,7 +334,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl(
}
}
OSL_FAIL("Error nicht behandelt");
- // Error 1 ist General Error im Sfx
+ // Error 1 is General Error in the Sfx
if(pInfo->GetErrorCode()!=1)
{
HandleError_Impl(1, USHRT_MAX, bJustCreateString, rError);
@@ -355,25 +353,12 @@ sal_Bool ErrorHandler::GetErrorString(sal_uIntPtr lId, String& rStr)
return (sal_Bool)HandleError_Impl( lId, USHRT_MAX, sal_True, rStr );
}
+/** Handles an error.
+
+ @see ErrorHandler::HandleError_Impl
+*/
sal_uInt16 ErrorHandler::HandleError(sal_uIntPtr lId, sal_uInt16 nFlags)
{
-
-/* [Beschreibung]
- Handelt einen Fehler ab. lId ist die FehlerId, nFlags sind die
- ErrorFlags. Werden nFlags nicht abgegeben, so werden die in
- der DynamicErrorInfo angegebenen Flags bzw. die aus der Resource
- verwendet.
-
- Also:
-
- 1. nFlags,
- 2. Resource Flags
- 3. Dynamic Flags
- 4. Default ERRCODE_BUTTON_OK, ERRCODE_MSG_ERROR
-
-
- */
-
String aDummy;
return HandleError_Impl( lId, nFlags, sal_False, aDummy );
}
diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
index 95d5273b29c2..503cf70ecf2b 100644
--- a/tools/source/ref/globname.cxx
+++ b/tools/source/ref/globname.cxx
@@ -55,7 +55,6 @@ SvGlobalName::SvGlobalName()
pImp->nRefCount++;
}
-// locker die Struktur von Windows kopiert
#ifdef WNT
struct _GUID
#else
@@ -140,7 +139,7 @@ SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj )
SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj )
{
- rObj.NewImp(); // kopieren, falls noetig
+ rObj.NewImp(); // copy if necessary
sal_uInt32 a;
rStr >> a;
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
index 42074930fc05..60f8c869841e 100644
--- a/tools/source/ref/pstm.cxx
+++ b/tools/source/ref/pstm.cxx
@@ -60,20 +60,19 @@ void TOOLS_DLLPUBLIC WritePersistListObjects(const SvPersistListWriteable& rList
sal_uIntPtr nCountPos = rStm.Tell();
sal_uInt32 nWriteCount = 0;
rStm << nCountMember;
- //bloss die Liste nicht veraendern,
- //wegen Seiteneffekten beim Save
+ // Don't change the list, as it causes side-effects while saving
for( sal_uIntPtr n = 0; n < nCountMember; n++ )
{
SvPersistBase * pObj = rList.GetPersistBase( n );
if( !bOnlyStreamed || rStm.IsStreamed( pObj ) )
- { // Objekt soll geschrieben werden
+ { // Object should be stored
rStm << pObj;
nWriteCount++;
}
}
if( nWriteCount != nCountMember )
{
- // nicht alle Objekte geschrieben, Count anpassen
+ // Didn't write all members, adjust count
sal_uIntPtr nPos = rStm.Tell();
rStm.Seek( nCountPos );
rStm << nWriteCount;
@@ -123,29 +122,24 @@ void TOOLS_DLLPUBLIC ReadObjects( SvPersistListReadable& rLst, SvPersistStream &
#endif
}
-SvPersistStream::SvPersistStream
-(
- SvClassManager & rMgr, /* Alle Factorys, deren Objekt geladen und
- gespeichert werdn k"onnen */
- SvStream * pStream, /* Dieser Stream wird als Medium genommen, auf
- dem der PersistStream arbeitet */
- sal_uInt32 nStartIdxP /* Ab diesem Index werden die Id's f"ur
- die Objekte vergeben, er muss gr"osser
- als Null sein. */
-)
+/** Constructor
+
+ @param rMgr Stores factories for objects that can persisted
+ @param pStream This stream is used as the medium for PersistStream
+ @param nStartIdxP Start value for object identifier (set > 0 )
+
+ @warning Objects rMgr and pStream must not be manipulated while used in
+ SvPersistStream. An Exception to this is pvStream
+ (cf. <SvPersistStream::SetStream>).
+ @see SvPersistStream::SetStream
+*/
+SvPersistStream::SvPersistStream( SvClassManager & rMgr, SvStream * pStream, sal_uInt32 nStartIdxP )
: rClassMgr( rMgr )
, pStm( pStream )
, aPUIdx( nStartIdxP )
, nStartIdx( nStartIdxP )
, pRefStm( NULL )
, nFlags( 0 )
-/* [Beschreibung]
-
- Der Konstruktor der Klasse SvPersistStream. Die Objekte rMgr und
- pStream d"urfen nicht ver"andert werden, solange sie in einem
- SvPersistStream eingesetzt sind. Eine Aussnahme gibt es f"ur
- pStream (siehe <SvPersistStream::SetStream>).
-*/
{
DBG_ASSERT( nStartIdx != 0, "zero index not allowed" );
bIsWritable = sal_True;
@@ -158,29 +152,19 @@ SvPersistStream::SvPersistStream
}
SvPersistStream::~SvPersistStream()
-/* [Beschreibung]
-
- Der Detruktor ruft die Methode <SvPersistStream::SetStream>
- mit NULL.
-*/
{
SetStream( NULL );
}
-void SvPersistStream::SetStream
-(
- SvStream * pStream /* auf diesem Stream arbeitet der PersistStream */
+/**
-)
-/* [Beschreibung]
-
- Es wird ein Medium (pStream) eingesetzt, auf dem PersistStream arbeitet.
- Dieses darf nicht von aussen modifiziert werden, solange es
- eingesetzt ist. Es sei denn, w"ahrend auf dem Medium gearbeitet
- wird, wird keine Methode von SvPersistStream gerufen, bevor
- nicht <SvPersistStream::SetStream> mit demselben Medium gerufen
- wurde.
+ @param pStream This stream is used as the medium for PersistStream
+
+ @warning pStream is used as the medium for PersistStream.
+ It must not be manipulated while used in SvPersistStream.
+ An Exception to this is pvStream (cf. <SvPersistStream::SetStream>).
*/
+void SvPersistStream::SetStream( SvStream * pStream )
{
if( pStm != pStream )
{
@@ -199,20 +183,13 @@ void SvPersistStream::SetStream
}
}
-sal_uInt16 SvPersistStream::IsA() const
-/* [Beschreibung]
-
- Gibt den Identifier dieses Streamklasse zur"uck.
-
- [R"uckgabewert]
+/** Returns the identifier of this stream class.
- sal_uInt16 ID_PERSISTSTREAM wird zur"uckgegeben.
+ @return ID_PERSISTSTREAM
-
- [Querverweise]
-
- <SvStream::IsA>
+ @see SvStream::IsA
*/
+sal_uInt16 SvPersistStream::IsA() const
{
return ID_PERSISTSTREAM;
}
@@ -278,23 +255,18 @@ SvPersistBase * SvPersistStream::GetObject( sal_uIntPtr nIdx ) const
#define LEN_2 0x40
#define LEN_4 0x20
#define LEN_5 0x10
-sal_uInt32 SvPersistStream::ReadCompressed
-(
- SvStream & rStm /* Aus diesem Stream werden die komprimierten Daten
- gelesen */
-)
-/* [Beschreibung]
-
- Ein im Stream komprimiert abgelegtes Wort wird gelesen. In welchem
- Format komprimiert wird, siehe <SvPersistStream::WriteCompressed>.
- [R"uckgabewert]
+/** Reads a compressed word from the stream.
- sal_uInt32 Das nicht komprimierte Wort wird zur"uckgegeben.
+ For details on what format is used for compression, see
+ <SvPersistStream::WriteCompressed>.
- [Querverweise]
+ @param rStm Source to read compressed data from
+ @return Uncompressed word
+ @see SvPersistStream::WriteCompressed
*/
+sal_uInt32 SvPersistStream::ReadCompressed( SvStream & rStm )
{
sal_uInt32 nRet(0);
sal_uInt8 nMask;
@@ -336,25 +308,20 @@ sal_uInt32 SvPersistStream::ReadCompressed
return nRet;
}
-void SvPersistStream::WriteCompressed
-(
- SvStream & rStm,/* Aus diesem Stream werden die komprimierten Daten
- gelesen */
- sal_uInt32 nVal /* Dieser Wert wird komprimiert geschrieben */
-)
-/* [Beschreibung]
+/** Writes compressed stream
- Das "ubergebene Wort wird komprimiert und in den Stream
- geschrieben. Folgendermassen wir komprimiert.
- nVal < 0x80 => 0x80 + nVal ist 1 Byte gross.
- nVal < 0x4000 => 0x4000 + nVal ist 2 Byte gross.
- nVal < 0x20000000 => 0x20000000 + nVal ist 4 Byte gross.
- nVal > 0x1FFFFFFF => 0x1000000000+ nVal ist 5 Byte gross.
+ @param rStm Source for writing compressed data
+ @param nVal This value will be compressed and written
- [Querverweise]
+ nVal is compressed and written to stream using the following algorithm
+ nVal < 0x80 => 0x80 + nVal of size 1 Byte.
+ nVal < 0x4000 => 0x4000 + nVal of size 2 Byte.
+ nVal < 0x20000000 => 0x20000000 + nVal of size 4 Byte.
+ nVal > 0x1FFFFFFF => 0x1000000000+ nVal of size 5 Byte.
- <SvPersistStream::ReadCompressed>
+ @see SvPersistStream::ReadCompressed
*/
+void SvPersistStream::WriteCompressed( SvStream & rStm, sal_uInt32 nVal )
{
#ifdef STOR_NO_OPTIMIZE
if( nVal < 0x80 )
@@ -366,9 +333,9 @@ void SvPersistStream::WriteCompressed
}
else if( nVal < 0x20000000 )
{
- // hoechstes sal_uInt8
+ // highest sal_uInt8
rStm << (sal_uInt8)(LEN_4 | (nVal >> 24));
- // 2. hoechstes sal_uInt8
+ // 2nd highest sal_uInt8
rStm << (sal_uInt8)(nVal >> 16);
rStm << (sal_uInt16)(nVal);
}
@@ -380,89 +347,76 @@ void SvPersistStream::WriteCompressed
}
}
-sal_uInt32 SvPersistStream::WriteDummyLen()
-/* [Beschreibung]
-
- Die Methode schreibt 4 Byte in den Stream und gibt die Streamposition
- zur"uck.
-
- [R"uckgabewert]
-
- sal_uInt32 Die Position hinter der L"angenangabe wird zur"uckgegeben.
-
- [Beispiel]
+/** This method writes length value of 4 Bytes to the stream and returns the
+ stream position.
+ Example:
+ @code
sal_uInt32 nObjPos = rStm.WriteDummyLen();
...
- // Daten schreiben
+ // write data
...
rStm.WriteLen( nObjPos );
+ @endcode
- [Querverweise]
-
- <SvPersistStream::ReadLen>, <SvPersistStream::WriteLen>
+ @return Position of stream behind length value
+ @see SvPersistStream::ReadLen
+ @see SvPersistStream::WriteLen
*/
+sal_uInt32 SvPersistStream::WriteDummyLen()
{
#ifdef DBG_UTIL
sal_uInt32 nPos = Tell();
#endif
sal_uInt32 n0 = 0;
*this << n0; // wegen Sun sp
- // keine Assertion bei Streamfehler
+ // Don't assert on stream error
DBG_ASSERT( GetError() != SVSTREAM_OK
|| (sizeof( sal_uInt32 ) == Tell() -nPos),
"keine 4-Byte fuer Langenangabe" );
return Tell();
}
-void SvPersistStream::WriteLen
-(
- sal_uInt32 nObjPos /* die Position + 4, an der die L"ange geschrieben
- wird. */
-)
-/* [Beschreibung]
-
- Die Methode schreibt die Differenz zwischen der aktuellen und
- nObjPos als sal_uInt32 an die Position nObjPos -4 im Stream. Danach
- wird der Stream wieder auf die alte Position gestellt.
+/** Write difference between current position and nObjPos
+ as sal_uInt32 to position nObjPos-4 in the stream.
- [Beispiel]
-
- Die Differenz enth"alt nicht die L"angenangabe.
+ Afterwards, reset stream to old position.
+ Example: Difference does not contain length value
+ @code
sal_uInt32 nObjPos = rStm.WriteDummyLen();
...
- // Daten schreiben
+ // write data
...
rStm.WriteLen( nObjPos );
- // weitere Daten schreiben
+ // write more data
+ @endcode
- [Querverweise]
+ @param nObjPos Position+4, on which length is written to
- <SvPersistStream::ReadLen>, <SvPersistStream::WriteDummyLen>
+ @see SvPersistStream::ReadLen
+ @see SvPersistStream::WriteDummyLen
*/
+void SvPersistStream::WriteLen( sal_uInt32 nObjPos )
{
sal_uInt32 nPos = Tell();
sal_uInt32 nLen = nPos - nObjPos;
- // die Laenge mu� im stream 4-Byte betragen
+ // Length in stream must be 4 Bytes
Seek( nObjPos - sizeof( sal_uInt32 ) );
- // Laenge schreiben
+ // write length
*this << nLen;
Seek( nPos );
}
-sal_uInt32 SvPersistStream::ReadLen
-(
- sal_uInt32 * pTestPos /* Die Position des Streams, nach dem Lesen der
- L"ange, wird zur"uckgegeben. Es darf auch NULL
- "ubergeben werden. */
-)
-/* [Beschreibung]
+/** Read a length value written to stream
+
+ @param pTestPos Position of the stream after reading length. May be NULL.
- Liest die L"ange die vorher mit <SvPersistStream::WriteDummyLen>
- und <SvPersistStream::WriteLen> geschrieben wurde.
+ @see SvPersistStream::WriteDummyLen
+ @see SvPersistStream::WriteLen
*/
+sal_uInt32 SvPersistStream::ReadLen( sal_uInt32 * pTestPos )
{
sal_uInt32 nLen;
*this >> nLen;
@@ -471,7 +425,7 @@ sal_uInt32 SvPersistStream::ReadLen
return nLen;
}
-// Dateirormat abw"arts kompatibel
+// File format backward-compatible
#ifdef STOR_NO_OPTIMIZE
#define P_VER (sal_uInt8)0x00
#else
@@ -503,7 +457,7 @@ static void WriteId
if( nHdr & P_ID )
{
if( (nHdr & P_OBJ) || nId != 0 )
- { // Id nur bei Zeiger, oder DBGUTIL
+ { // Id set only for pointers or DBGUTIL
rStm << (sal_uInt8)(nHdr);
SvPersistStream::WriteCompressed( rStm, nId );
}
@@ -517,8 +471,8 @@ static void WriteId
rStm << nHdr;
if( (nHdr & P_DBGUTIL) || (nHdr & P_OBJ) )
- // Objekte haben immer eine Klasse,
- // Pointer nur bei DBG_UTIL und != NULL
+ // Objects always have a class id
+ // Pointers only for DBG_UTIL and != NULL
SvPersistStream::WriteCompressed( rStm, nClassId );
}
@@ -560,7 +514,7 @@ void SvPersistStream::WriteObj
#ifdef STOR_NO_OPTIMIZE
sal_uInt32 nObjPos = 0;
if( nHdr & P_DBGUTIL )
- // Position fuer Laenge merken
+ // remember position for length value
nObjPos = WriteDummyLen();
#endif
pObj->Save( *this );
@@ -609,10 +563,10 @@ sal_uInt32 SvPersistStream::ReadObj
sal_uInt32 nId = 0;
sal_uInt16 nClassId;
- rpObj = NULL; // Spezifikation: Im Fehlerfall 0.
+ rpObj = NULL; // specification: 0 in case of error
ReadId( *this, nHdr, nId, nClassId );
- // reine Versionsnummer durch maskieren
+ // get version nummer through masking
if( P_VER < (nHdr & P_VER_MASK) )
{
SetError( SVSTREAM_FILEFORMAT_ERROR );
@@ -622,7 +576,7 @@ sal_uInt32 SvPersistStream::ReadObj
if( !(nHdr & P_ID_0) && GetError() == SVSTREAM_OK )
{
if( P_OBJ & nHdr )
- { // read object, nId nur bei P_DBGUTIL gesetzt
+ { // read object, nId only set for P_DBGUTIL
DBG_ASSERT( !(nHdr & P_DBGUTIL) || NULL == aPUIdx.Get( nId ),
"object already exist" );
SvCreateInstancePersist pFunc = rClassMgr.Get( nClassId );
@@ -645,19 +599,18 @@ sal_uInt32 SvPersistStream::ReadObj
return 0;
}
pFunc( &rpObj );
- // Sichern
+ // Save reference
rpObj->AddRef();
if( bRegister )
{
- // unbedingt erst in Tabelle eintragen
+ // insert into table
sal_uIntPtr nNewId = aPUIdx.Insert( rpObj );
- // um den gleichen Zustand, wie nach dem Speichern herzustellen
+ // in order to restore state after saving
aPTable[ rpObj ] = nNewId;
DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId,
"read write id conflict: not the same" );
}
- // und dann Laden
rpObj->Load( *this );
#ifdef DBG_UTIL
if( nObjLen + nObjPos != Tell() )
@@ -754,12 +707,12 @@ SvStream& operator >>
for( sal_uInt32 i = 0; i < nCount; i++ )
{
SvPersistBase * pEle;
- // Lesen, ohne in die Tabellen einzutragen
+ // read, but don't insert into table
sal_uIntPtr nId = rThis.ReadObj( pEle, sal_False );
if( rThis.GetError() )
break;
- // Die Id eines Objektes wird nie modifiziert
+ // Id of object is never modified
rThis.aPUIdx.Insert( nId, pEle );
rThis.aPTable[ pEle ] = nId;
}
diff --git a/tools/source/stream/cachestr.cxx b/tools/source/stream/cachestr.cxx
index d5fd519fbb4e..e8d34fdb1f65 100644
--- a/tools/source/stream/cachestr.cxx
+++ b/tools/source/stream/cachestr.cxx
@@ -77,7 +77,7 @@ sal_uIntPtr SvCacheStream::GetData( void* pData, sal_uIntPtr nSize )
sal_uIntPtr SvCacheStream::PutData( const void* pData, sal_uIntPtr nSize )
{
- // lieber unnoetig auslagern als unnoetig umkopieren
+ // prefer swapping data instead copying it again
if( pCurrentStream != pSwapStream
&& pCurrentStream->Tell() + nSize > nMaxSize )
SwapOut();
@@ -113,8 +113,7 @@ void SvCacheStream::SetSize( sal_uIntPtr nSize )
sal_uIntPtr SvCacheStream::GetSize()
{
- // ACHTUNG: SvMemoryStream::GetSize() gibt Groesse
- // des allozierten Buffers zurueck
+ // CAUTION: SvMemoryStream::GetSize() returns size of the allocated buffer
Flush();
sal_uIntPtr nTemp = Tell();
sal_uIntPtr nLength = Seek( STREAM_SEEK_TO_END );
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 8673cec6c0fb..c0a20ece25c5 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-// ToDo:
-// - Read->RefreshBuffer->Auf Aenderungen von nBufActualLen reagieren
+// TODO: Read->RefreshBuffer-> React to changes from nBufActualLen
#include <cstddef>
@@ -47,7 +46,7 @@ c |= nSwapTmp;
DBG_NAME( Stream )
-// !!! Nicht inline, wenn Operatoren <<,>> inline sind
+// !!! Do not inline if already the operators <<,>> are inline
inline static void SwapUShort( sal_uInt16& r )
{ r = OSL_SWAPWORD(r); }
inline static void SwapShort( short& r )
@@ -125,10 +124,10 @@ inline static void SwapDouble( double& r )
} s;
s.d = r;
- s.c[0] ^= s.c[1]; // zwei 32-Bit-Werte in situ vertauschen
+ s.c[0] ^= s.c[1]; // swap 32-bit values in situ
s.c[1] ^= s.c[0];
s.c[0] ^= s.c[1];
- s.c[0] = OSL_SWAPDWORD(s.c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
+ s.c[0] = OSL_SWAPDWORD(s.c[0]); // swap dword itself in situ
s.c[1] = OSL_SWAPDWORD(s.c[1]);
r = s.d;
}
@@ -481,7 +480,7 @@ void SvStream::SetBufferSize( sal_uInt16 nBufferSize )
sal_Size nActualFilePos = Tell();
sal_Bool bDontSeek = (sal_Bool)(pRWBuf == 0);
- if( bIsDirty && bIsConsistent && bIsWritable ) // wg. Windows NT: Access denied
+ if( bIsDirty && bIsConsistent && bIsWritable ) // due to Windows NT: Access denied
Flush();
if( nBufSize )
@@ -547,16 +546,15 @@ sal_Bool SvStream::ReadLine( rtl::OString& rStr, sal_Int32 nMaxBytesToRead )
sal_Size nTotalLen = 0;
rtl::OStringBuffer aBuf(4096);
- while( !bEnd && !GetError() ) // !!! nicht auf EOF testen,
- // !!! weil wir blockweise
- // !!! lesen
+ while( !bEnd && !GetError() ) // Don't test for EOF as we
+ // are reading block-wise!
{
sal_uInt16 nLen = (sal_uInt16)Read( buf, sizeof(buf)-1 );
if ( !nLen )
{
if ( aBuf.getLength() == 0 )
{
- // der allererste Blockread hat fehlgeschlagen -> Abflug
+ // Exit on first block-read error
bIsEof = sal_True;
rStr = rtl::OString();
return sal_False;
@@ -595,9 +593,9 @@ sal_Bool SvStream::ReadLine( rtl::OString& rStr, sal_Int32 nMaxBytesToRead )
nOldFilePos += nTotalLen;
if( Tell() > nOldFilePos )
nOldFilePos++;
- Seek( nOldFilePos ); // seeken wg. obigem BlockRead!
+ Seek( nOldFilePos ); // Seek pointer due to BlockRead above
- if ( bEnd && (c=='\r' || c=='\n') ) // Sonderbehandlung DOS-Dateien
+ if ( bEnd && (c=='\r' || c=='\n') ) // Special treatment for DOS files
{
char cTemp;
sal_Size nLen = Read((char*)&cTemp , sizeof(cTemp) );
@@ -624,9 +622,8 @@ sal_Bool SvStream::ReadUniStringLine( rtl::OUString& rStr, sal_Int32 nMaxCodepoi
DBG_ASSERT( sizeof(sal_Unicode) == sizeof(sal_uInt16), "ReadUniStringLine: swapping sizeof(sal_Unicode) not implemented" );
rtl::OUStringBuffer aBuf(4096);
- while( !bEnd && !GetError() ) // !!! nicht auf EOF testen,
- // !!! weil wir blockweise
- // !!! lesen
+ while( !bEnd && !GetError() ) // Don't test for EOF as we
+ // are reading block-wise!
{
sal_uInt16 nLen = (sal_uInt16)Read( (char*)buf, sizeof(buf)-sizeof(sal_Unicode) );
nLen /= sizeof(sal_Unicode);
@@ -634,7 +631,7 @@ sal_Bool SvStream::ReadUniStringLine( rtl::OUString& rStr, sal_Int32 nMaxCodepoi
{
if ( aBuf.getLength() == 0 )
{
- // der allererste Blockread hat fehlgeschlagen -> Abflug
+ // exit on first BlockRead error
bIsEof = sal_True;
rStr = rtl::OUString();
return sal_False;
@@ -682,9 +679,9 @@ sal_Bool SvStream::ReadUniStringLine( rtl::OUString& rStr, sal_Int32 nMaxCodepoi
nOldFilePos += nTotalLen * sizeof(sal_Unicode);
if( Tell() > nOldFilePos )
nOldFilePos += sizeof(sal_Unicode);
- Seek( nOldFilePos ); // seeken wg. obigem BlockRead!
+ Seek( nOldFilePos ); // seek due to BlockRead above
- if ( bEnd && (c=='\r' || c=='\n') ) // Sonderbehandlung DOS-Dateien
+ if ( bEnd && (c=='\r' || c=='\n') ) // special treatment for DOS files
{
sal_Unicode cTemp;
Read( (char*)&cTemp, sizeof(cTemp) );
@@ -738,7 +735,7 @@ rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream)
nFilePos += aOutput.getLength();
if (rStream.Tell() > nFilePos)
- rStream.Seek(nFilePos+1); // seeken wg. obigem BlockRead!
+ rStream.Seek(nFilePos+1); // seek due to FileRead above
return aOutput.makeStringAndClear();
}
@@ -995,7 +992,7 @@ SvStream& SvStream::operator>>( signed char& r )
return *this;
}
-// Sonderbehandlung fuer Chars wegen PutBack
+// Special treatment for Chars due to PutBack
SvStream& SvStream::operator>>( char& r )
{
@@ -1139,7 +1136,7 @@ SvStream& SvStream::operator<< ( signed char v )
return *this;
}
-// Sonderbehandlung fuer chars wegen PutBack
+// Special treatment for Chars due to PutBack
SvStream& SvStream::operator<< ( char v )
{
@@ -1265,11 +1262,11 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
}
else
{
- // ist Block komplett im Puffer
+ // check if block is completely within buffer
eIOMode = STREAM_IO_READ;
if( nCount <= (sal_Size)(nBufActualLen - nBufActualPos ) )
{
- // Ja!
+ // => yes
memcpy(pData, pBufPos, (size_t) nCount);
nBufActualPos = nBufActualPos + (sal_uInt16)nCount;
pBufPos += nCount;
@@ -1277,7 +1274,7 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
}
else
{
- if( bIsDirty ) // Flushen ?
+ if( bIsDirty ) // Does stream require a flush?
{
SeekPos( nBufFilePos );
if( nCryptMask )
@@ -1287,11 +1284,11 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
bIsDirty = sal_False;
}
- // passt der Datenblock in den Puffer ?
+ // Does data block fit into buffer?
if( nCount > nBufSize )
{
- // Nein! Deshalb ohne Umweg ueber den Puffer direkt
- // in den Zielbereich einlesen
+ // => No! Thus read directly
+ // into target area without using the buffer
eIOMode = STREAM_IO_DONTKNOW;
@@ -1307,21 +1304,19 @@ sal_Size SvStream::Read( void* pData, sal_Size nCount )
}
else
{
- // Der Datenblock passt komplett in den Puffer. Deshalb
- // Puffer fuellen und dann die angeforderten Daten in den
- // Zielbereich kopieren.
+ // => Yes. Fill buffer first, then copy to target area
nBufFilePos += nBufActualPos;
SeekPos( nBufFilePos );
- // TODO: Typecast vor GetData, sal_uInt16 nCountTmp
+ // TODO: Typecast before GetData, sal_uInt16 nCountTmp
sal_Size nCountTmp = GetData( pRWBuf, nBufSize );
if( nCryptMask )
EncryptBuffer(pRWBuf, nCountTmp);
nBufActualLen = (sal_uInt16)nCountTmp;
if( nCount > nCountTmp )
{
- nCount = nCountTmp; // zurueckstutzen, Eof siehe unten
+ nCount = nCountTmp; // trim count back, EOF see below
}
memcpy( pData, pRWBuf, (size_t)nCount );
nBufActualPos = (sal_uInt16)nCount;
@@ -1348,7 +1343,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
return 0;
}
if( !bIsConsistent )
- RefreshBuffer(); // Aenderungen des Puffers durch PutBack loeschen
+ RefreshBuffer(); // Remove changes in buffer through PutBack
if( !pRWBuf )
{
@@ -1365,7 +1360,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
{
memcpy( pBufPos, pData, (size_t)nCount );
nBufActualPos = nBufActualPos + (sal_uInt16)nCount;
- // wurde der Puffer erweitert ?
+ // Update length if buffer was updated
if( nBufActualPos > nBufActualLen )
nBufActualLen = nBufActualPos;
@@ -1374,7 +1369,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
}
else
{
- // Flushen ?
+ // Does stream require flushing?
if( bIsDirty )
{
SeekPos( nBufFilePos );
@@ -1385,7 +1380,7 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
bIsDirty = sal_False;
}
- // passt der Block in den Puffer ?
+ // Does data block fit into buffer?
if( nCount > nBufSize )
{
eIOMode = STREAM_IO_DONTKNOW;
@@ -1402,10 +1397,10 @@ sal_Size SvStream::Write( const void* pData, sal_Size nCount )
}
else
{
- // Block in Puffer stellen
+ // Copy block to buffer
memcpy( pRWBuf, pData, (size_t)nCount );
- // Reihenfolge!
+ // Mind the order!
nBufFilePos += nBufActualPos;
nBufActualPos = (sal_uInt16)nCount;
pBufPos = pRWBuf + nCount;
@@ -1429,13 +1424,12 @@ sal_Size SvStream::Seek( sal_Size nFilePos )
return nBufFilePos;
}
- // Ist Position im Puffer ?
+ // Is seek position within buffer?
if( nFilePos >= nBufFilePos && nFilePos <= (nBufFilePos + nBufActualLen))
{
nBufActualPos = (sal_uInt16)(nFilePos - nBufFilePos);
pBufPos = pRWBuf + nBufActualPos;
- // nBufFree korrigieren, damit wir nicht von einem
- // PutBack (ignoriert den StreamMode) getoetet werden
+ // Update nBufFree to avoid crash upon PutBack
nBufFree = nBufActualLen - nBufActualPos;
}
else
@@ -1780,12 +1774,12 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
sal_Size nMaxCount = nSize-nPos;
- // auf Ueberlauf testen
+ // check for overflow
if( nCount > nMaxCount )
{
if( nResize == 0 )
{
- // soviel wie moeglich rueberschaufeln
+ // copy as much as possible
nCount = nMaxCount;
SetError( SVSTREAM_OUTOFMEMORY );
}
@@ -1799,8 +1793,8 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
if( (nCount-nMaxCount) < nResize )
{
- // fehlender Speicher ist kleiner als Resize-Offset,
- // deshalb um Resize-Offset vergroessern
+ // lacking memory is smaller than nResize,
+ // resize accordingly
if( !ReAllocateMemory( nNewResize) )
{
nCount = 0;
@@ -1809,8 +1803,8 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
}
else
{
- // fehlender Speicher ist groesser als Resize-Offset
- // deshalb um Differenz+ResizeOffset vergroessern
+ // lacking memory is larger than nResize,
+ // resize by (nCoount-nMaxCount) + resize offset
if( !ReAllocateMemory( nCount-nMaxCount+nNewResize ) )
{
nCount = 0;
@@ -1828,20 +1822,20 @@ sal_Size SvMemoryStream::PutData( const void* pData, sal_Size nCount )
return nCount;
}
-// nEndOfData: Erste Position im Stream, die nicht gelesen werden darf
-// nSize: Groesse des allozierten Speichers
-
sal_Size SvMemoryStream::SeekPos( sal_Size nNewPos )
{
+ // nEndOfData: First position in stream not allowed to read from
+ // nSize: Size of allocated buffer
+
if( nNewPos < nEndOfData )
nPos = nNewPos;
else if( nNewPos == STREAM_SEEK_TO_END )
nPos = nEndOfData;
else
{
- if( nNewPos >= nSize ) // muss Buffer vergroessert werden ?
+ if( nNewPos >= nSize ) // Does buffer need extension?
{
- if( nResize ) // ist vergroeseern erlaubt ?
+ if( nResize ) // Is extension possible?
{
long nDiff = (long)(nNewPos - nSize + 1);
nDiff += (long)nResize;
@@ -1849,13 +1843,13 @@ sal_Size SvMemoryStream::SeekPos( sal_Size nNewPos )
nPos = nNewPos;
nEndOfData = nNewPos;
}
- else // vergroessern ist nicht erlaubt -> ans Ende setzen
+ else // Extension not possible, set pos to end of data
{
// SetError( SVSTREAM_OUTOFMEMORY );
nPos = nEndOfData;
}
}
- else // gueltigen Bereich innerhalb des Buffers vergroessern
+ else // Expand buffer size
{
nPos = nNewPos;
nEndOfData = nNewPos;
@@ -1894,7 +1888,7 @@ sal_Bool SvMemoryStream::ReAllocateMemory( long nDiff )
if( pNewBuf )
{
bRetVal = sal_True; // Success!
- if( nNewSize < nSize ) // Verkleinern ?
+ if( nNewSize < nSize ) // Are we shrinking?
{
memcpy( pNewBuf, pBuf, (size_t)nNewSize );
if( nPos > nNewSize )
@@ -2036,21 +2030,21 @@ namespace
{
template <typename T, typename O> T tmpl_convertLineEnd(const T &rIn, LineEnd eLineEnd)
{
- // Zeilenumbrueche ermitteln und neue Laenge berechnen
- bool bConvert = false; // Muss konvertiert werden
+ // Determine linebreaks and compute length
+ bool bConvert = false; // Needs conversion
sal_Int32 nStrLen = rIn.getLength();
sal_Int32 nLineEndLen = (eLineEnd == LINEEND_CRLF) ? 2 : 1;
- sal_Int32 nLen = 0; // Ziel-Laenge
- sal_Int32 i = 0; // Source-Zaehler
+ sal_Int32 nLen = 0; // Target length
+ sal_Int32 i = 0; // Source counter
while (i < nStrLen)
{
- // Bei \r oder \n gibt es neuen Zeilenumbruch
+ // \r or \n causes linebreak
if ( (rIn[i] == _CR) || (rIn[i] == _LF) )
{
nLen = nLen + nLineEndLen;
- // Wenn schon gesetzt, dann brauchen wir keine aufwendige Abfrage
+ // If set already, skip expensive test
if ( !bConvert )
{
// Muessen wir Konvertieren
@@ -2063,7 +2057,7 @@ namespace
bConvert = true;
}
- // \r\n oder \n\r, dann Zeichen ueberspringen
+ // skip char if \r\n oder \n\r
if ( ((rIn[i+1] == _CR) || (rIn[i+1] == _LF)) &&
(rIn[i] != rIn[i+1]) )
++i;
@@ -2076,13 +2070,12 @@ namespace
if (!bConvert)
return rIn;
- // Zeilenumbrueche konvertieren
- // Neuen String anlegen
+ // convert linebreaks, insert string
O aNewData(nLen);
i = 0;
while (i < nStrLen)
{
- // Bei \r oder \n gibt es neuen Zeilenumbruch
+ // \r or \n causes linebreak
if ( (rIn[i] == _CR) || (rIn[i] == _LF) )
{
if ( eLineEnd == LINEEND_CRLF )
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 74bbce5d106f..c059ae80b5e8 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -240,7 +240,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ (int)0xFFFF, SVSTREAM_GENERALERROR }
};
- sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
@@ -280,7 +280,7 @@ static sal_uInt32 GetSvError( oslFileError nErrno )
{ (oslFileError)0xFFFF, SVSTREAM_GENERALERROR }
};
- sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
@@ -423,7 +423,7 @@ sal_Size SvFileStream::SeekPos( sal_Size nPos )
void SvFileStream::FlushData()
{
-// lokal gibt es nicht
+ // does not exist locally
}
sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes )
@@ -503,9 +503,9 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
Close();
errno = 0;
eStreamMode = nOpenMode;
- eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten
+ eStreamMode &= ~STREAM_TRUNC; // don't truncat on reopen
-// !!! NoOp: Ansonsten ToAbs() verwendern
+// !!! NoOp: use ToAbs()
// !!! DirEntry aDirEntry( rFilename );
// !!! aFilename = aDirEntry.GetFull();
aFilename = rFilename;
@@ -542,8 +542,8 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
else
uFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write;
- // Fix (MDA, 18.01.95): Bei RD_ONLY nicht mit O_CREAT oeffnen
- // Wichtig auf Read-Only-Dateisystemen (wie CDROM)
+ // Fix (MDA, 18.01.95): Don't open with O_CREAT upon RD_ONLY
+ // Important for Read-Only-Filesystems (e.g, CDROM)
if ( (!( nOpenMode & STREAM_NOCREATE )) && ( uFlags != osl_File_OpenFlag_Read ) )
uFlags |= osl_File_OpenFlag_Create;
if ( nOpenMode & STREAM_TRUNC )
@@ -580,7 +580,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
{
if ( uFlags & osl_File_OpenFlag_Write )
{
- // auf Lesen runterschalten
+ // Change to read-only
uFlags &= ~osl_File_OpenFlag_Write;
rc = osl_openFile( aFileURL.pData, &nHandleTmp, uFlags );
}
@@ -592,7 +592,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
if ( uFlags & osl_File_OpenFlag_Write )
bIsWritable = sal_True;
- if ( !LockFile() ) // ganze Datei
+ if ( !LockFile() ) // whole file
{
rc = osl_closeFile( nHandleTmp );
bIsOpen = sal_False;
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index 16a986a88a6a..7f1e47d28285 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -88,7 +88,7 @@ static sal_uIntPtr GetSvError( DWORD nWntError )
{ (DWORD)0xFFFFFFFF, SVSTREAM_GENERALERROR }
};
- sal_uIntPtr nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ sal_uIntPtr nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
@@ -145,7 +145,7 @@ sal_uInt16 SvFileStream::IsA() const
return ID_FILESTREAM;
}
-// Beschreibung: Prueft nicht Eof; IsEof danach rufbar
+/// Does not check for EOF, makes isEof callable
sal_uIntPtr SvFileStream::GetData( void* pData, sal_uIntPtr nSize )
{
DWORD nCount = 0;
@@ -178,7 +178,7 @@ sal_uIntPtr SvFileStream::SeekPos( sal_uIntPtr nPos )
if( IsOpen() )
{
if( nPos != STREAM_SEEK_TO_END )
- // 64-Bit files werden nicht unterstuetzt
+ // 64-Bit files are not supported
nNewPos=SetFilePointer(pInstanceData->hFile,nPos,NULL,FILE_BEGIN);
else
nNewPos=SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_END);
@@ -285,14 +285,14 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
SvStream::ClearBuffer();
eStreamMode = nMode;
- eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten
+ eStreamMode &= ~STREAM_TRUNC; // don't truncate on reopen
- // !!! NoOp: Ansonsten ToAbs() verwendern
+ // !!! NoOp: Use ToAbs() otherwise
// !!! DirEntry aDirEntry( rFilename );
// !!! aFilename = aDirEntry.GetFull();
aFilename = aParsedFilename;
rtl::OString aFileNameA(rtl::OUStringToOString(aFilename, osl_getThreadTextEncoding()));
- SetLastError( ERROR_SUCCESS ); // ggf. durch Redirector geaendert!
+ SetLastError( ERROR_SUCCESS ); // might be changed by Redirector
DWORD nOpenAction;
DWORD nShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
@@ -314,9 +314,9 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
nAccessMode |= GENERIC_WRITE;
if( nAccessMode == GENERIC_READ ) // ReadOnly ?
- nMode |= STREAM_NOCREATE; // wenn ja, nicht erzeugen
+ nMode |= STREAM_NOCREATE; // Don't create if readonly
- // Zuordnung siehe obige Wahrheitstafel
+ // Assignment based on true/false table above
if( !(nMode & STREAM_NOCREATE) )
{
if( nMode & STREAM_TRUNC )
@@ -343,17 +343,17 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
);
if( pInstanceData->hFile!=INVALID_HANDLE_VALUE && (
- // Hat Create Always eine existierende Datei ueberschrieben ?
+ // Did Create Always overwrite a file?
GetLastError() == ERROR_ALREADY_EXISTS ||
- // Hat Open Always eine neue Datei angelegt ?
+ // Did Create Always open a new file?
GetLastError() == ERROR_FILE_NOT_FOUND ))
{
- // wenn ja, dann alles OK
+ // If so, no error
if( nOpenAction == OPEN_ALWAYS || nOpenAction == CREATE_ALWAYS )
SetLastError( ERROR_SUCCESS );
}
- // Bei Fehler pruefen, ob wir lesen duerfen
+ // Otherwise, determine if we're allowed to read
if( (pInstanceData->hFile==INVALID_HANDLE_VALUE) &&
(nAccessMode & GENERIC_WRITE))
{
@@ -362,8 +362,8 @@ void SvFileStream::Open( const String& rFilename, StreamMode nMode )
{
nMode &= (~STREAM_WRITE);
nAccessMode = GENERIC_READ;
- // OV, 28.1.97: Win32 setzt die Datei auf 0-Laenge, wenn
- // die Openaction CREATE_ALWAYS ist!!!!
+ // OV, 28.1.97: Win32 sets file to length 0
+ // if Openaction is CREATE_ALWAYS
nOpenAction = OPEN_EXISTING;
SetLastError( ERROR_SUCCESS );
pInstanceData->hFile = CreateFile(
@@ -414,7 +414,7 @@ void SvFileStream::Close()
SvStream::ClearError();
}
-// Beschreibung: Setzt Filepointer auf Dateianfang
+/// Reset filepointer to beginning of file
void SvFileStream::ResetError()
{
SvStream::ClearError();
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx
index 2a080e6e5d4a..e057c03fc655 100644
--- a/tools/source/string/strascii.cxx
+++ b/tools/source/string/strascii.cxx
@@ -98,7 +98,7 @@ static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Ch
sal_Char c2;
do
{
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ // Convert if char is between 'A' and 'Z'
c1 = *pStr1;
c2 = *pStr2;
if ( (c1 >= 65) && (c1 <= 90) )
@@ -128,7 +128,7 @@ static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Ch
if ( !nCount )
break;
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ // Convert if char is between 'A' and 'Z'
c1 = *pStr1;
c2 = *pStr2;
if ( (c1 >= 65) && (c1 <= 90) )
@@ -153,7 +153,7 @@ UniString& UniString::AssignAscii( const sal_Char* pAsciiStr )
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( pAsciiStr, "UniString::AssignAscii() - pAsciiStr is NULL" );
- // Stringlaenge ermitteln
+ // Determine string length
xub_StrLen nLen = ImplStringLen( pAsciiStr );
if ( !nLen )
@@ -162,15 +162,15 @@ UniString& UniString::AssignAscii( const sal_Char* pAsciiStr )
}
else
{
- // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ // Replace string in-place if new size is equal
if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
else
{
- // Alte Daten loeschen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
- // Daten initialisieren und String kopieren
+ // copy new string
mpData = ImplAllocData( nLen );
ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
}
@@ -206,15 +206,15 @@ UniString& UniString::AssignAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
}
else
{
- // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ // Replace string in-place if new size is equal
if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
else
{
- // Alte Daten loeschen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
- // Daten initialisieren und String kopieren
+ // copy new string
mpData = ImplAllocData( nLen );
ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
}
@@ -228,23 +228,23 @@ UniString& UniString::AppendAscii( const sal_Char* pAsciiStr )
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( pAsciiStr, "UniString::AppendAscii() - pAsciiStr is NULL" );
- // Stringlaenge ermitteln
+ // determine string length
sal_Int32 nCopyLen = ImplStringLen( pAsciiStr );
- // Ueberlauf abfangen
+ // detect overflow
nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen );
- // Ist es kein leerer String
+ // If appended string is not empty
if ( nCopyLen )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // Allocate new string
UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
- // String kopieren
+ // copy string data
memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) );
ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen );
- // Alte Daten loeschen und Neue zuweisen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -273,20 +273,20 @@ UniString& UniString::AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
}
#endif
- // Ueberlauf abfangen
+ // detect overflow
sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen );
- // Ist es kein leerer String
+ // If appended string is not empty
if ( nCopyLen )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // Allocate new string
UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
- // String kopieren
+ // copy string data
memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) );
ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen );
- // Alte Daten loeschen und Neue zuweisen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -299,30 +299,30 @@ UniString& UniString::InsertAscii( const char* pAsciiStr, xub_StrLen nIndex )
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( pAsciiStr, "UniString::InsertAscii() - pAsciiStr is NULL" );
- // Stringlaenge ermitteln
+ // Determine string length
sal_Int32 nCopyLen = ImplStringLen( pAsciiStr );
- // Ueberlauf abfangen
+ // detect overflow
nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen );
- // Ist der einzufuegende String ein Leerstring
+ // If appended string is not empty
if ( !nCopyLen )
return *this;
- // Index groesser als Laenge
+ // Adjust index if exceeds length
if ( nIndex > mpData->mnLen )
nIndex = static_cast< xub_StrLen >(mpData->mnLen);
- // Neue Laenge ermitteln und neuen String anlegen
+ // Allocate new string
UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
- // String kopieren
+ // copy string data
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( sal_Unicode ) );
ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, nCopyLen );
memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
(mpData->mnLen-nIndex)*sizeof( sal_Unicode ) );
- // Alte Daten loeschen und Neue zuweisen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -335,31 +335,31 @@ UniString& UniString::ReplaceAscii( xub_StrLen nIndex, xub_StrLen nCount,
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( pAsciiStr, "UniString::ReplaceAscii() - pAsciiStr is NULL" );
- // Wenn Index groessergleich Laenge ist, dann ist es ein Append
+ // Use append if index >= length
if ( nIndex >= mpData->mnLen )
{
AppendAscii( pAsciiStr, nStrLen );
return *this;
}
- // Ist es eine Zuweisung
+ // Use assign if index = 0 and count >= length
if ( (nIndex == 0) && (nCount >= mpData->mnLen) )
{
AssignAscii( pAsciiStr, nStrLen );
return *this;
}
- // Reicht ein Erase
+ // Use erase if length is equal
if ( nStrLen == STRING_LEN )
nStrLen = ImplStringLen( pAsciiStr );
if ( !nStrLen )
return Erase( nIndex, nCount );
- // nCount darf nicht ueber das Stringende hinnausgehen
+ // nCount must not exceed string length
if ( nCount > mpData->mnLen - nIndex )
nCount = static_cast< xub_StrLen >(mpData->mnLen-nIndex);
- // Reicht eine zeichenweise Zuweisung
+ // Use assign if length matches
if ( nCount == nStrLen )
{
ImplCopyData();
@@ -367,19 +367,19 @@ UniString& UniString::ReplaceAscii( xub_StrLen nIndex, xub_StrLen nCount,
return *this;
}
- // Ueberlauf abfangen
+ // detect overflow
sal_Int32 n = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen );
- // Neue Daten anlegen
+ // allocate new string
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+n );
- // String kopieren
+ // copy string data
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, n );
memcpy( pNewData->maStr+nIndex+n, mpData->maStr+nIndex+nCount,
(mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // release old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -412,10 +412,9 @@ StringCompare UniString::CompareIgnoreCaseToAscii( const sal_Char* pAsciiStr,
DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
"UniString::CompareIgnoreCaseToAscii() - pAsciiStr include characters > 127" );
- // String vergleichen
+ // compare strings
sal_Int32 nCompare = ImplStringICompareAscii( mpData->maStr, pAsciiStr, nLen );
- // Rueckgabewert anpassen
if ( nCompare == 0 )
return COMPARE_EQUAL;
else if ( nCompare < 0 )
@@ -479,8 +478,7 @@ xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex
sal_Int32 nLen = mpData->mnLen;
xub_StrLen nStrLen = ImplStringLen( pAsciiStr );
- // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
- // hinter dem String liegt, dann wurde der String nicht gefunden
+ // If length of pAsciiStr is 0 or index exceeds length, it was not found
if ( !nStrLen || (nIndex >= nLen) )
return STRING_NOTFOUND;
@@ -500,10 +498,10 @@ xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex
}
else
{
- // Nur innerhalb des Strings suchen
+ // Only search within string
while ( nLen - nIndex >= nStrLen )
{
- // Stimmt der String ueberein
+ // Check if string matches
if ( ImplStringCompareWithoutZeroAscii( pStr, pAsciiStr, nStrLen ) == 0 )
return nIndex;
++pStr,
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index 5c36af8d53f2..3c47dabfbeb6 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -62,7 +62,6 @@ const char* DBGCHECKSTRING( const void* pString )
static STRINGDATA* ImplAllocData( sal_Int32 nLen )
{
- // Dann kopiere die Daten
STRINGDATA* pData = (STRINGDATA*)rtl_allocateMemory( sizeof(STRINGDATA)+(nLen*sizeof( STRCODE )) );
pData->mnRefCount = 1;
pData->mnLen = nLen;
@@ -84,14 +83,13 @@ inline void STRING::ImplCopyData()
{
DBG_ASSERT( (mpData->mnRefCount != 0), "String::ImplCopyData() - RefCount == 0" );
- // ist es ein referenzierter String, dann die Daten abkoppeln
+ // Dereference data if this string is referenced
if ( mpData->mnRefCount != 1 )
mpData = _ImplCopyData( mpData );
}
inline STRCODE* STRING::ImplCopyStringData( STRCODE* pStr )
{
- // Ist der Referenzzaehler groesser 0
if ( mpData->mnRefCount != 1 ) {
DBG_ASSERT( (pStr >= mpData->maStr) &&
((pStr-mpData->maStr) < mpData->mnLen),
@@ -124,8 +122,7 @@ STRING::STRING( const STRING& rStr )
DBG_CTOR( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Pointer auf die Daten des uebergebenen Strings setzen und
- // Referenzzaehler erhoehen
+ // Set pointer to argument string and increase reference counter
STRING_ACQUIRE((STRING_TYPE *)rStr.mpData);
mpData = rStr.mpData;
}
@@ -136,21 +133,19 @@ STRING::STRING( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen )
DBG_CTOR( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Stringlaenge ermitteln
if ( nPos > rStr.mpData->mnLen )
nLen = 0;
else
{
- // Laenge korrigieren, wenn noetig
+ // correct length if necessary
sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos;
if ( nLen > nMaxLen )
nLen = static_cast< xub_StrLen >(nMaxLen);
}
- // Ist es kein leerer String
if ( nLen )
{
- // Reicht ein einfaches erhoehen des Referenzcounters
+ // Increase reference counter if it suffices
if ( (nPos == 0) && (nLen == rStr.mpData->mnLen) )
{
STRING_ACQUIRE((STRING_TYPE *)rStr.mpData);
@@ -158,7 +153,7 @@ STRING::STRING( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen )
}
else
{
- // Verwaltungsdaten anlegen und String kopieren
+ // otherwise, copy string
mpData = ImplAllocData( nLen );
memcpy( mpData->maStr, rStr.mpData->maStr+nPos, nLen*sizeof( STRCODE ) );
}
@@ -173,7 +168,7 @@ STRING::~STRING()
{
DBG_DTOR( STRING, DBGCHECKSTRING );
- // Daten loeschen
+ // free string data
STRING_RELEASE((STRING_TYPE *)mpData);
}
@@ -193,7 +188,7 @@ STRING& STRING::Append( const STRING& rStr )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Wenn String leer, dann reicht eine Zuweisung
+ // Assignment is sufficient if string is empty
sal_Int32 nLen = mpData->mnLen;
if ( !nLen )
{
@@ -203,20 +198,19 @@ STRING& STRING::Append( const STRING& rStr )
}
else
{
- // Ueberlauf abfangen
+ // Detect overflow
sal_Int32 nCopyLen = ImplGetCopyLen( nLen, rStr.mpData->mnLen );
- // Ist der uebergebene String kein Leerstring
if ( nCopyLen )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nLen, rStr.mpData->maStr, nCopyLen*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -230,24 +224,23 @@ STRING& STRING::Append( const STRCODE* pCharStr )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_ASSERT( pCharStr, "String::Append() - pCharStr is NULL" );
- // Stringlaenge ermitteln
+ // determine string length
sal_Int32 nLen = mpData->mnLen;
sal_Int32 nCopyLen = ImplStringLen( pCharStr );
- // Ueberlauf abfangen
+ // detect overflow
nCopyLen = ImplGetCopyLen( nLen, nCopyLen );
- // Ist es kein leerer String
if ( nCopyLen )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nLen, pCharStr, nCopyLen*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -260,7 +253,7 @@ void STRING::SetChar( xub_StrLen nIndex, STRCODE c )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_ASSERT( nIndex < mpData->mnLen, "String::SetChar() - nIndex > String.Len()" );
- // Daten kopieren, wenn noetig und Character zuweisen
+ // copy data if necessary
ImplCopyData();
mpData->maStr[nIndex] = c;
}
@@ -270,27 +263,26 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nIndex )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Ueberlauf abfangen
+ // detect overflow
sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, rStr.mpData->mnLen );
- // Ist der einzufuegende String ein Leerstring
if ( !nCopyLen )
return *this;
- // Index groesser als Laenge
+ // adjust index if necessary
if ( nIndex > mpData->mnLen )
nIndex = static_cast< xub_StrLen >(mpData->mnLen);
- // Neue Laenge ermitteln und neuen String anlegen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr, nCopyLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
(mpData->mnLen-nIndex)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -302,34 +294,33 @@ STRING& STRING::Replace( xub_StrLen nIndex, xub_StrLen nCount, const STRING& rSt
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Wenn Index groessergleich Laenge ist, dann ist es ein Append
+ // Append if index > current length
if ( nIndex >= mpData->mnLen )
{
Append( rStr );
return *this;
}
- // Ist es eine Zuweisung
+ // assign if index = 0 and length >= stringlen
if ( (nIndex == 0) && (nCount >= mpData->mnLen) )
{
Assign( rStr );
return *this;
}
- // Reicht ein Erase
+ // Use erase if replacestring is empty
sal_Int32 nStrLen = rStr.mpData->mnLen;
if ( !nStrLen )
return Erase( nIndex, nCount );
- // nCount darf nicht ueber das Stringende hinnausgehen
+ // Adjust nCount if it's larger than the string
if ( nCount > mpData->mnLen - nIndex )
nCount = static_cast< xub_StrLen >(mpData->mnLen-nIndex);
- // Reicht ein Insert
if ( !nCount )
return Insert( rStr, nIndex );
- // Reicht eine zeichenweise Zuweisung
+ // Use character-based assignment if length is equal
if ( nCount == nStrLen )
{
ImplCopyData();
@@ -337,19 +328,19 @@ STRING& STRING::Replace( xub_StrLen nIndex, xub_StrLen nCount, const STRING& rSt
return *this;
}
- // Ueberlauf abfangen
+ // detect overflow
nStrLen = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen );
- // Neue Daten anlegen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+nStrLen );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr, nStrLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex+nStrLen, mpData->maStr+nIndex+nCount,
(mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -360,26 +351,25 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- // Ist der Index ausserhalb des Strings oder ist nCount == 0
+ // Return if index outside string or count = 0
if ( (nIndex >= mpData->mnLen) || !nCount )
return *this;
- // nCount darf nicht ueber das Stringende hinnausgehen
+ // Adjust nCount if it's larger than the string
if ( nCount > mpData->mnLen - nIndex )
nCount = static_cast< xub_StrLen >(mpData->mnLen-nIndex);
- // Ist das Ergebnis kein Leerstring
if ( mpData->mnLen - nCount )
{
- // Neue Daten anlegen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex, mpData->maStr+nIndex+nCount,
(mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -400,10 +390,10 @@ STRING& STRING::ToLowerAscii()
STRCODE* pStr = mpData->maStr;
while ( nIndex < nLen )
{
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ // Convert if char is between 'A' and 'Z'
if ( (*pStr >= 65) && (*pStr <= 90) )
{
- // Daten kopieren, wenn noetig
+ // allocate string of new size
pStr = ImplCopyStringData( pStr );
*pStr += 32;
}
@@ -441,8 +431,8 @@ xub_StrLen STRING::Search( const STRING& rStr, xub_StrLen nIndex ) const
sal_Int32 nLen = mpData->mnLen;
sal_Int32 nStrLen = rStr.mpData->mnLen;
- // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
- // hinter dem String liegt, dann wurde der String nicht gefunden
+ // rStr was not found if its length is zero
+ // or index is larger than searched string
if ( !nStrLen || (nIndex >= nLen) )
return STRING_NOTFOUND;
@@ -464,10 +454,10 @@ xub_StrLen STRING::Search( const STRING& rStr, xub_StrLen nIndex ) const
{
const STRCODE* pStr2 = rStr.mpData->maStr;
- // Nur innerhalb des Strings suchen
+ // search only within string
while ( nLen - nIndex >= nStrLen )
{
- // Stimmt der String ueberein
+ // increase match if found
if ( ImplStringCompareWithoutZero( pStr1, pStr2, nStrLen ) == 0 )
return nIndex;
++pStr1,
@@ -485,8 +475,8 @@ xub_StrLen STRING::Search( const STRCODE* pCharStr, xub_StrLen nIndex ) const
sal_Int32 nLen = mpData->mnLen;
xub_StrLen nStrLen = ImplStringLen( pCharStr );
- // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
- // hinter dem String liegt, dann wurde der String nicht gefunden
+ // rStr was not found if its length is zero
+ // or index is larger than searched string
if ( !nStrLen || (nIndex >= nLen) )
return STRING_NOTFOUND;
@@ -506,10 +496,10 @@ xub_StrLen STRING::Search( const STRCODE* pCharStr, xub_StrLen nIndex ) const
}
else
{
- // Nur innerhalb des Strings suchen
+ // search only within string
while ( nLen - nIndex >= nStrLen )
{
- // Stimmt der String ueberein
+ // increase match if found
if ( ImplStringCompareWithoutZero( pStr, pCharStr, nStrLen ) == 0 )
return nIndex;
++pStr,
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index eb04784e474f..58217be7c270 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -128,38 +128,37 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen,
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Stringlaenge ermitteln
+ // Determine string length
if ( nPos > rStr.mpData->mnLen )
nLen = 0;
else
{
- // Laenge korrigieren, wenn noetig
+ // Correct length if necessary
sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos;
if ( nLen > nMaxLen )
nLen = static_cast< xub_StrLen >(nMaxLen);
}
- // Ueberlauf abfangen
+ // Detect overflow
sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen );
- // Ist der einzufuegende String ein Leerstring
if ( !nCopyLen )
return *this;
- // Index groesser als Laenge
+ // Correct index if necessary
if ( nIndex > mpData->mnLen )
nIndex = static_cast< xub_StrLen >(mpData->mnLen);
- // Neue Laenge ermitteln und neuen String anlegen
+ // Determine new length and allocate string
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
- // String kopieren
+ // copy string to newdata
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
(mpData->mnLen-nIndex)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // release old data
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -177,7 +176,7 @@ static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRC
if ( !nCount )
break;
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ // convert if char is between 'A' and 'Z'
c1 = *pStr1;
c2 = *pStr2;
if ( (c1 >= 65) && (c1 <= 90) )
@@ -211,7 +210,6 @@ sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, x
nLen = static_cast< xub_StrLen >(nMaxLen);
}
- // String vergleichen
return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
}
@@ -221,20 +219,17 @@ StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr,
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Auf Gleichheit der Pointer testen
if ( mpData == rStr.mpData )
return COMPARE_EQUAL;
- // Maximale Laenge ermitteln
+ // determine maximal length
if ( mpData->mnLen < nLen )
nLen = static_cast< xub_StrLen >(mpData->mnLen+1);
if ( rStr.mpData->mnLen < nLen )
nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1);
- // String vergleichen
sal_Int32 nCompare = ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
- // Rueckgabewert anpassen
if ( nCompare == 0 )
return COMPARE_EQUAL;
else if ( nCompare < 0 )
@@ -250,10 +245,10 @@ STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar )
if ( !nCount )
return *this;
- // Ist nCount groesser wie der jetzige String, dann verlaengern
+ // extend string if fill length is larger
if ( nCount > mpData->mnLen )
{
- // dann neuen String mit der neuen Laenge anlegen
+ // allocate string of new length
STRINGDATA* pNewData = ImplAllocData( nCount );
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -277,25 +272,25 @@ STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- // Muss der String erweitert werden
+ // return if string doesn't need expanding
sal_Int32 nLen = mpData->mnLen;
if ( nCount <= nLen )
return *this;
- // Neuen String anlegen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( nCount );
- // Alten String kopieren
+ // copy from old string
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
- // und initialisieren
+ // and expand using the given character
STRCODE* pStr = pNewData->maStr;
pStr += nLen;
for (sal_Int32 i = nCount - nLen; i > 0; --i) {
*pStr++ = cExpandChar;
}
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -306,17 +301,17 @@ STRCODE* STRING::GetBufferAccess()
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- // Daten kopieren, wenn noetig
+ // Copy data if necessary
if ( mpData->mnLen )
ImplCopyData();
- // Pointer auf den String zurueckgeben
+ // return pointer to string data
return mpData->maStr;
}
void STRING::ReleaseBufferAccess( xub_StrLen nLen )
{
- // Hier ohne Funktionstest, da String nicht konsistent
+ // String not consinstent, thus no functionality test
DBG_CHKTHIS( STRING, NULL );
DBG_ASSERT( mpData->mnRefCount == 1, "String::ReleaseCharStr() called for String with RefCount" );
@@ -327,7 +322,7 @@ void STRING::ReleaseBufferAccess( xub_StrLen nLen )
{
STRING_NEW((STRING_TYPE **)&mpData);
}
- // Bei mehr als 8 Zeichen unterschied, kuerzen wir den Buffer
+ // shorten buffer is difference > 8 chars
else if ( mpData->mnLen - nLen > 8 )
{
STRINGDATA* pNewData = ImplAllocData( nLen );
@@ -360,7 +355,7 @@ STRING::STRING( STRCODE c )
DBG_CTOR( STRING, DBGCHECKSTRING );
DBG_ASSERT( c, "String::String() - c is 0" );
- // Verwaltungsdaten anlegen und initialisieren
+ // Initalize maintenance data
mpData = ImplAllocData( 1 );
mpData->maStr[0] = c;
}
@@ -369,24 +364,24 @@ STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- // Ist es kein 0-Character
+ // Don't insert 0 char or string size is maximum
if ( !c || (mpData->mnLen == STRING_MAXLEN) )
return *this;
- // Index groesser als Laenge
+ // Adjust string index
if ( nIndex > mpData->mnLen )
nIndex = static_cast< xub_StrLen >(mpData->mnLen);
- // Neue Laenge ermitteln und neuen String anlegen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+1 );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
pNewData->maStr[nIndex] = c;
memcpy( pNewData->maStr+nIndex+1, mpData->maStr+nIndex,
(mpData->mnLen-nIndex)*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old data
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
@@ -402,10 +397,10 @@ STRING& STRING::ToUpperAscii()
STRCODE* pStr = mpData->maStr;
while ( nIndex < nLen )
{
- // Ist das Zeichen zwischen 'a' und 'z' dann umwandeln
+ // convert char if between 'a' and 'z'
if ( (*pStr >= 97) && (*pStr <= 122) )
{
- // Daten kopieren, wenn noetig
+ // allocate string of new size
pStr = ImplCopyStringData( pStr );
*pStr -= 32;
}
@@ -422,20 +417,17 @@ StringCompare STRING::CompareTo( const STRING& rStr, xub_StrLen nLen ) const
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Auf Gleichheit der Pointer testen
if ( mpData == rStr.mpData )
return COMPARE_EQUAL;
- // Maximale Laenge ermitteln
+ // determine maximal length
if ( mpData->mnLen < nLen )
nLen = static_cast< xub_StrLen >(mpData->mnLen+1);
if ( rStr.mpData->mnLen < nLen )
nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1);
- // String vergleichen
sal_Int32 nCompare = ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
- // Rueckgabewert anpassen
if ( nCompare == 0 )
return COMPARE_EQUAL;
else if ( nCompare < 0 )
@@ -449,15 +441,12 @@ sal_Bool STRING::Equals( const STRING& rStr ) const
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Sind die Daten gleich
if ( mpData == rStr.mpData )
return sal_True;
- // Gleiche Laenge
if ( mpData->mnLen != rStr.mpData->mnLen )
return sal_False;
- // String vergleichen
return (ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
}
@@ -466,15 +455,13 @@ sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr ) const
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Sind die Daten gleich
if ( mpData == rStr.mpData )
return sal_True;
- // Gleiche Laenge
if ( mpData->mnLen != rStr.mpData->mnLen )
return sal_False;
- // String vergleichen
+ // compare string while ignoring case
return (ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
}
@@ -494,7 +481,6 @@ sal_Bool STRING::Equals( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen
nLen = static_cast< xub_StrLen >(nMaxLen);
}
- // String vergleichen
return (ImplStringCompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
}
@@ -514,17 +500,17 @@ xub_StrLen STRING::Match( const STRING& rStr ) const
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- // Ist dieser String leer
+ // return if string is empty
if ( !mpData->mnLen )
return STRING_MATCH;
- // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ // Search the string for unmatching chars
const STRCODE* pStr1 = mpData->maStr;
const STRCODE* pStr2 = rStr.mpData->maStr;
xub_StrLen i = 0;
while ( i < mpData->mnLen )
{
- // Stimmt das Zeichen nicht ueberein, dann abbrechen
+ // Abort on the first unmatching char
if ( *pStr1 != *pStr2 )
return i;
++pStr1,
@@ -583,11 +569,11 @@ void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr,
xub_StrLen nFirstChar = nIndex;
xub_StrLen i = nFirstChar;
- // Bestimme die Token-Position und Laenge
+ // Determine token position and length
pStr += i;
while ( i < nLen )
{
- // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ // Increase token count if match
if ( *pStr == cTok )
{
++nTok;
@@ -619,11 +605,11 @@ STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) c
xub_StrLen nFirstChar = rIndex;
xub_StrLen i = nFirstChar;
- // Bestimme die Token-Position und Laenge
+ // Determine token position and length
pStr += i;
while ( i < nLen )
{
- // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ // Increase token count if match
if ( *pStr == cTok )
{
++nTok;
@@ -677,21 +663,20 @@ STRING& STRING::Append( const STRCODE* pCharStr, xub_StrLen nCharLen )
}
#endif
- // Ueberlauf abfangen
+ // Catch overflow
sal_Int32 nLen = mpData->mnLen;
sal_Int32 nCopyLen = ImplGetCopyLen( nLen, nCharLen );
- // Ist es kein leerer String
if ( nCopyLen )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
memcpy( pNewData->maStr+nLen, pCharStr, nCopyLen*sizeof( STRCODE ) );
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -703,18 +688,18 @@ STRING& STRING::Append( STRCODE c )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- // kein 0-Character und maximale Stringlaenge nicht ueberschreiten
+ // don't append null characters and keep string length < maxlen
sal_Int32 nLen = mpData->mnLen;
if ( c && (nLen < STRING_MAXLEN) )
{
- // Neue Datenstruktur und neuen String erzeugen
+ // allocate string of new size
STRINGDATA* pNewData = ImplAllocData( nLen+1 );
- // String kopieren
+ // copy string
memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
pNewData->maStr[nLen] = c;
- // Alte Daten loeschen und Neue zuweisen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = pNewData;
}
@@ -749,15 +734,15 @@ STRING& STRING::Assign( const STRCODE* pCharStr, xub_StrLen nLen )
}
else
{
- // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ // copy without allocation if string length is identical
if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
else
{
- // Alte Daten loeschen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
- // Daten initialisieren und String kopieren
+ // allocate string of new size and copy
mpData = ImplAllocData( nLen );
memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
}
@@ -771,7 +756,7 @@ STRING& STRING::Assign( STRCODE c )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_ASSERT( c, "String::Assign() - c is 0" );
- // Verwaltungsdaten anlegen und initialisieren
+ // initialize maintenance data
STRING_RELEASE((STRING_TYPE *)mpData);
mpData = ImplAllocData( 1 );
mpData->maStr[0] = c;
@@ -799,7 +784,7 @@ static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2
STRCODE c2;
do
{
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ // Convert char if between 'A' and 'Z'
c1 = *pStr1;
c2 = *pStr2;
if ( (c1 >= 65) && (c1 <= 90) )
@@ -830,7 +815,6 @@ STRING& STRING::Assign( const STRCODE* pCharStr )
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
DBG_ASSERT( pCharStr, "String::Assign() - pCharStr is NULL" );
- // Stringlaenge ermitteln
xub_StrLen nLen = ImplStringLen( pCharStr );
if ( !nLen )
@@ -839,15 +823,15 @@ STRING& STRING::Assign( const STRCODE* pCharStr )
}
else
{
- // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ // copy without allocation if string length is identical
if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
else
{
- // Alte Daten loeschen
+ // free old string
STRING_RELEASE((STRING_TYPE *)mpData);
- // Daten initialisieren und String kopieren
+ // allocate string of new size and copy
mpData = ImplAllocData( nLen );
memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
}