mpserviceplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp
changeset 54 c5b304f4d89b
parent 48 af3740e3753f
equal deleted inserted replaced
48:af3740e3753f 54:c5b304f4d89b
   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