mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
clean up TDesc usage
This commit is contained in:
parent
04424e8294
commit
636c66043e
1 changed files with 18 additions and 24 deletions
|
@ -48,7 +48,6 @@ readXP_U8( RFile* file )
|
||||||
static XP_U16
|
static XP_U16
|
||||||
readXP_U16( RFile* file )
|
readXP_U16( RFile* file )
|
||||||
{
|
{
|
||||||
XP_U16 result;
|
|
||||||
TBuf8<2> buf;
|
TBuf8<2> buf;
|
||||||
TInt err = file->Read( buf, 2 );
|
TInt err = file->Read( buf, 2 );
|
||||||
XP_ASSERT( err == KErrNone );
|
XP_ASSERT( err == KErrNone );
|
||||||
|
@ -182,6 +181,7 @@ readFileToBuf( XP_UCHAR* dictBuf, const RFile* file )
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
TBuf8<1024> buf;
|
TBuf8<1024> buf;
|
||||||
TInt err = file->Read( buf, buf.MaxLength() );
|
TInt err = file->Read( buf, buf.MaxLength() );
|
||||||
|
XP_ASSERT( err == KErrNone );
|
||||||
TInt nRead = buf.Size();
|
TInt nRead = buf.Size();
|
||||||
if ( nRead <= 0 ) {
|
if ( nRead <= 0 ) {
|
||||||
break;
|
break;
|
||||||
|
@ -208,13 +208,11 @@ sym_dictionary_makeL( MPFORMAL const XP_UCHAR* aDictName )
|
||||||
#endif
|
#endif
|
||||||
TFileName nameD; /* need the full path to name in this */
|
TFileName nameD; /* need the full path to name in this */
|
||||||
nameD.Copy( dir );
|
nameD.Copy( dir );
|
||||||
TBuf8<32> dname8(aDictName);
|
|
||||||
TBuf16<32> dname16;
|
TBuf16<32> dname16;
|
||||||
dname16.Copy( dname8 );
|
dname16.Copy( TPtrC8(aDictName) );
|
||||||
nameD.Append( dname16 );
|
nameD.Append( dname16 );
|
||||||
nameD.Append( _L(".xwd") );
|
nameD.Append( _L(".xwd") );
|
||||||
SymDictCtxt* ctxt = NULL;
|
SymDictCtxt* ctxt = NULL;
|
||||||
TInt err;
|
|
||||||
|
|
||||||
RFs fileSession;
|
RFs fileSession;
|
||||||
User::LeaveIfError(fileSession.Connect());
|
User::LeaveIfError(fileSession.Connect());
|
||||||
|
@ -282,38 +280,34 @@ sym_dictionary_makeL( MPFORMAL const XP_UCHAR* aDictName )
|
||||||
TInt pos = 0;
|
TInt pos = 0;
|
||||||
file.Seek( ESeekCurrent, pos );
|
file.Seek( ESeekCurrent, pos );
|
||||||
dawgSize -= pos;
|
dawgSize -= pos;
|
||||||
XP_U32 offset;
|
|
||||||
if ( dawgSize > sizeof(XP_U32) ) {
|
if ( dawgSize > sizeof(XP_U32) ) {
|
||||||
offset = readXP_U32( &file );
|
XP_U32 offset = readXP_U32( &file );
|
||||||
dawgSize -= sizeof(XP_U32);
|
dawgSize -= sizeof(XP_U32);
|
||||||
|
|
||||||
XP_ASSERT( dawgSize % ctxt->super.nodeSize == 0 );
|
XP_ASSERT( dawgSize % ctxt->super.nodeSize == 0 );
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
ctxt->super.numEdges = dawgSize / ctxt->super.nodeSize;
|
ctxt->super.numEdges = dawgSize / ctxt->super.nodeSize;
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
|
|
||||||
if ( dawgSize > 0 ) {
|
if ( dawgSize > 0 ) {
|
||||||
XP_DEBUGF( "setting topEdge; offset = %ld", offset );
|
XP_DEBUGF( "setting topEdge; offset = %ld", offset );
|
||||||
|
|
||||||
XP_U8* dictBuf = (XP_U8*)XP_MALLOC( mpool, dawgSize );
|
XP_U8* dictBuf = (XP_U8*)XP_MALLOC( mpool, dawgSize );
|
||||||
User::LeaveIfNull( dictBuf ); // will leak ctxt (PENDING...)
|
User::LeaveIfNull( dictBuf ); // will leak ctxt (PENDING...)
|
||||||
|
|
||||||
readFileToBuf( dictBuf, &file );
|
readFileToBuf( dictBuf, &file );
|
||||||
|
|
||||||
ctxt->super.base = (array_edge*)dictBuf;
|
ctxt->super.base = (array_edge*)dictBuf;
|
||||||
|
|
||||||
ctxt->super.topEdge = ctxt->super.base
|
ctxt->super.topEdge = ctxt->super.base
|
||||||
+ (offset * ctxt->super.nodeSize);
|
+ (offset * ctxt->super.nodeSize);
|
||||||
#ifdef NODE_CAN_4
|
ctxt->super.topEdge = ctxt->super.base
|
||||||
ctxt->super.topEdge = ctxt->super.base
|
+ (offset * ctxt->super.nodeSize);
|
||||||
+ (offset * ctxt->super.nodeSize);
|
} else {
|
||||||
#else
|
ctxt->super.topEdge = (array_edge*)NULL;
|
||||||
ctxt->super.topEdge = ctxt->super.base + (offset * 3);
|
ctxt->super.base = (array_edge*)NULL;
|
||||||
#endif
|
}
|
||||||
} else {
|
|
||||||
ctxt->super.topEdge = (array_edge*)NULL;
|
|
||||||
ctxt->super.base = (array_edge*)NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanupStack::PopAndDestroy( &file ); // file
|
CleanupStack::PopAndDestroy( &file ); // file
|
||||||
|
|
Loading…
Reference in a new issue