[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/utils/ktranslator
From: Raul Fernandes <rgfbr () yahoo ! com ! br>
Date: 2006-01-31 20:13:11
Message-ID: 1138738391.153438.20272.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 504333 by rgfbr:
Optimization in Dictd plugin start
M +1 -0 ChangeLog
M +17 -8 plugins/dictd/dictzip.cpp
--- trunk/extragear/utils/ktranslator/ChangeLog #504332:504333
@@ -2,6 +2,7 @@
Add a configure option to choose which plugin is to be compiled
Fix a crash when no dictionaries are selected and click in Edit or Remove
StarDict plugin
+ Optimization in Dictd plugin start
2006-01-29
Fix a small bug (Webster DICT dictionary doesn't works correctly)
--- trunk/extragear/utils/ktranslator/plugins/dictd/dictzip.cpp #504332:504333
@@ -109,22 +109,26 @@
QString line, headword;
struct entry entry;
dic.clear();
+ int pos, pos1;
idxFile->open( IO_ReadOnly );
while( !idxFile->atEnd() )
{
idxFile->readLine( line, 1024 );
+ pos = line.find( '\t' );
+ headword = QString::fromUtf8( line.left( pos ).lower().local8Bit() );
+
// Catch the position of definition in definition file
- headword = line.section( '\t', 1, 1);
// The value is coded in base64
- entry.position = b64_decode( headword.local8Bit() );
+ pos++;
+ pos1 = line.find( '\t', pos);
+ entry.position = b64_decode( line.mid( pos, pos1 - pos ).local8Bit() );
// Catch the size of definition in definition file
- headword = line.section( '\t', 2, 2 ).remove('\n');
// The value is coded in base64
- entry.size = b64_decode( headword.local8Bit() );
+ pos1++;
+ entry.size = b64_decode( line.right( line.length() - pos1 ).remove('\n').local8Bit() );
- headword = QString::fromUtf8( line.section( '\t', 0, 0 ).lower().local8Bit() );
dic.insert( headword, entry );
}
idxFile->close();
@@ -223,24 +227,29 @@
#else
QString line, headword;
bool found = false;
+ int pos, pos1;
idxFile->open( IO_ReadOnly );
// Find the headword in index file
while( !idxFile->atEnd() )
{
idxFile->readLine( line, 1024 );
- headword = QString::fromUtf8( line.section( '\t', 0, 0 ).local8Bit() );
+ pos = line.find( '\t' );
+ headword = QString::fromUtf8( line.left( pos ).local8Bit() );
if( QString::localeAwareCompare( headword, word ) != 0 ) continue;
found = true;
// Catch the position of definition in definition file
- headword = line.section( '\t', 1, 1);
+ pos++;
+ pos1 = line.find( '\t', pos );
+ headword = line.mid( pos, pos1 - pos );
// The value is coded in base64
entry.position = b64_decode( headword.local8Bit() );
// Catch the size of definition in definition file
- headword = line.section( '\t', 2, 2 ).remove('\n');
+ pos1++;
+ headword = line.right( line.length() - pos1 ).remove('\n');
// The value is coded in base64
entry.size = b64_decode( headword.local8Bit() );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic