sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\sfsrv\cl_clamp.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: EXPORT_C TInt RFileClamp::Clamp(RFile& aFile) sl@0: /** sl@0: Clamp the supplied file and store the resulting cookie in this object. sl@0: sl@0: @param aFile File to clamp. sl@0: @return Symbian OS error code. sl@0: */ sl@0: { sl@0: return aFile.Clamp(*this); sl@0: } sl@0: sl@0: EXPORT_C TInt RFileClamp::Close(RFs& aFs) sl@0: /** sl@0: Unclamp the file which was clamped with this object. sl@0: It is safe to call this function a handle that was not sl@0: successfully opened. sl@0: sl@0: @param aFs File server session which was used to sl@0: generate this clamp cookie value. sl@0: @return Symbian OS error code. sl@0: */ sl@0: { sl@0: TInt r = KErrNone; sl@0: sl@0: TBool opened = !(iCookie[0] == 0 && iCookie[1] == 0); sl@0: if (opened) sl@0: { sl@0: r = aFs.Unclamp(*this); sl@0: if (r == KErrNone) sl@0: *this = RFileClamp(); sl@0: } sl@0: sl@0: return r; sl@0: } sl@0: sl@0: