diff -r f5809cfbf6d5 -r 523717cdb0ad mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Tue May 11 16:59:11 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Tue May 25 13:35:25 2010 +0300 @@ -21,8 +21,6 @@ #include #include -#include "mtpframeworkconst.h" - //This file is exported from s60 sdk, now just copy it //to make sure onb can run #include "UiklafInternalCRKeys.h" @@ -141,9 +139,9 @@ */ EXPORT_C CMTPTypeFile* CMTPTypeFile::NewLC(RFs& aFs, const TDesC& aName, TFileMode aMode) { - CMTPTypeFile* self = new(ELeave) CMTPTypeFile; + CMTPTypeFile* self = new(ELeave) CMTPTypeFile(aFs); CleanupStack::PushL(self); - self->ConstructL(aFs, aName, aMode); + self->ConstructL(aName, aMode); return self; } @@ -156,9 +154,9 @@ EXPORT_C CMTPTypeFile* CMTPTypeFile::NewLC(RFs& aFs, const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet) { - CMTPTypeFile* self = new(ELeave) CMTPTypeFile; + CMTPTypeFile* self = new(ELeave) CMTPTypeFile(aFs); CleanupStack::PushL(self); - self->ConstructL(aFs, aName, aMode, aRequiredSize, aOffSet); + self->ConstructL(aName, aMode, aRequiredSize, aOffSet); return self; } @@ -188,12 +186,10 @@ //file syncing TInt driveNo; TDriveInfo driveInfo; - iFile.Drive(driveNo,driveInfo); - RFs fs; + User::LeaveIfError(iFile.Drive(driveNo,driveInfo)); + TVolumeInfo volumeInfo; - fs.Connect(); - fs.Volume(volumeInfo,driveNo); - fs.Close(); + User::LeaveIfError(iFs.Volume(volumeInfo,driveNo)); //Read the threshold value from Central Repository and check against it CRepository* repository(NULL); @@ -571,28 +567,29 @@ return iByteSent; } -CMTPTypeFile::CMTPTypeFile() : +CMTPTypeFile::CMTPTypeFile(RFs& aFs) : CActive(EPriorityUserInput), iBuffer1AvailForWrite(ETrue), - iFileRdWrError(EFalse), iCurrentCommitChunk(NULL, 0) + iFileRdWrError(EFalse), iCurrentCommitChunk(NULL, 0), + iFs(aFs) { CActiveScheduler::Add(this); } -void CMTPTypeFile::ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode) +void CMTPTypeFile::ConstructL(const TDesC& aName, TFileMode aMode) { if (aMode & EFileWrite) { iFileOpenForRead = EFalse; - TInt err = iFile.Create(aFs, aName, aMode|EFileWriteDirectIO); + TInt err = iFile.Create(iFs, aName, aMode|EFileWriteDirectIO); if (err != KErrNone) { - User::LeaveIfError(iFile.Replace(aFs, aName, aMode|EFileWriteDirectIO)); + User::LeaveIfError(iFile.Replace(iFs, aName, aMode|EFileWriteDirectIO)); } } else { iFileOpenForRead = ETrue; - User::LeaveIfError(iFile.Open(aFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly)); + User::LeaveIfError(iFile.Open(iFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly)); #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API TInt64 size = 0; #else @@ -615,22 +612,22 @@ } } -void CMTPTypeFile::ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet) +void CMTPTypeFile::ConstructL(const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet) { if (aMode & EFileWrite) { iFileOpenForRead = EFalse; - TInt err = iFile.Create(aFs, aName, aMode|EFileWriteDirectIO); + TInt err = iFile.Create(iFs, aName, aMode|EFileWriteDirectIO); if (err != KErrNone) { - User::LeaveIfError(iFile.Replace(aFs, aName, aMode|EFileWriteDirectIO)); + User::LeaveIfError(iFile.Replace(iFs, aName, aMode|EFileWriteDirectIO)); } } else { iFileOpenForRead = ETrue; iOffSet = aOffSet; - User::LeaveIfError(iFile.Open(aFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly)); + User::LeaveIfError(iFile.Open(iFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly)); #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API TInt64 size = 0; #else