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