mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp
branchRCL_3
changeset 66 1f1dad4af8f8
parent 56 2cbbefa9af78
equal deleted inserted replaced
60:bdd9da0d70fe 66:1f1dad4af8f8
   327         {
   327         {
   328         // aName is a filename
   328         // aName is a filename
   329         extractPos = KMCPathStartPos;     // c:\..., include first '\' of the path
   329         extractPos = KMCPathStartPos;     // c:\..., include first '\' of the path
   330         }
   330         }
   331 
   331 
   332     HBufC* fileNameBuf = HBufC::NewLC(aName.Length()+KMCIntegerLen);
   332     TBuf<KMaxFileName+KMCIntegerLen> fileName;
   333 	TPtr fileName(fileNameBuf->Des());
       
   334     if( extractPos )
   333     if( extractPos )
   335         {
   334         {
   336         // append volume's unique Id to path to maintain uniqueness
   335         // append volume's unique Id to path to maintain uniqueness
   337         TDriveUnit driveUnit( aName );
   336         TDriveUnit driveUnit( aName );
   338         TUint volId = MPXDbCommonUtil::GetVolIdMatchDriveIdL(aFs, driveUnit);
   337         TUint volId = MPXDbCommonUtil::GetVolIdMatchDriveIdL(aFs, driveUnit);
   356         }
   355         }
   357 
   356 
   358     TInt narrowFileLen(0);
   357     TInt narrowFileLen(0);
   359     TPtrC8 narrowFileName;
   358     TPtrC8 narrowFileName;
   360     #if defined(_UNICODE)
   359     #if defined(_UNICODE)
   361         narrowFileLen = fileNameBuf->Des().Length() * 2;
   360         narrowFileLen = fileName.Length() * 2;
   362         narrowFileName.Set((TUint8*)fileName.Ptr(), narrowFileLen);
   361         narrowFileName.Set((TUint8*)fileName.Ptr(), narrowFileLen);
   363     #else
   362     #else
   364         narrowFileLen = fileName.Length();
   363         narrowFileLen = fileName.Length();
   365         narrowFileName.Set(fileName.Ptr(), narrowFileLen);
   364         narrowFileName.Set(fileName.Ptr(), narrowFileLen);
   366     #endif
   365     #endif
   374     const TText8* ptr = hash.Ptr();
   373     const TText8* ptr = hash.Ptr();
   375 
   374 
   376     TUint32 uniqueId(0);
   375     TUint32 uniqueId(0);
   377     uniqueId = aTableId << 28;
   376     uniqueId = aTableId << 28;
   378     uniqueId |= (ptr[3]&0x0F)<<24 | (ptr[2]<<16) | (ptr[1]<<8) | ptr[0];
   377     uniqueId |= (ptr[3]&0x0F)<<24 | (ptr[2]<<16) | (ptr[1]<<8) | ptr[0];
   379     
       
   380     CleanupStack::PopAndDestroy(fileNameBuf);
       
   381     
       
   382     return uniqueId;
   378     return uniqueId;
   383     }
   379     }
   384 
   380 
   385 // ---------------------------------------------------------------------------
   381 // ---------------------------------------------------------------------------
   386 // Append an item into the media array
   382 // Append an item into the media array