sl@0: /* sl@0: * Copyright (c) 1998-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: * sl@0: */ sl@0: sl@0: sl@0: #include "t_inputextra.h" sl@0: sl@0: sl@0: EXPORT_C HBufC8* InputExtra::ReadFilesLC(CDesCArray& aFilenames, RFs& aFs) sl@0: { sl@0: TInt count = aFilenames.MdcaCount(); sl@0: TInt totalSize = 0; sl@0: TInt i = 0; sl@0: for (i = 0; i < count; i++) sl@0: { sl@0: RFile file; sl@0: User::LeaveIfError(file.Open(aFs, aFilenames.MdcaPoint(i), EFileRead)); sl@0: CleanupClosePushL(file); sl@0: TInt size; sl@0: file.Size(size); sl@0: CleanupStack::PopAndDestroy(2);// fileClose sl@0: totalSize += size; sl@0: } sl@0: HBufC8* res = HBufC8::NewLC(totalSize); sl@0: TPtr8 pRes = res->Des(); sl@0: for (i = 0; i < count; i++) sl@0: { sl@0: HBufC8* cert = Input::ReadFileLC(aFilenames.MdcaPoint(i), aFs); sl@0: pRes.Append(cert->Des()); sl@0: CleanupStack::PopAndDestroy();//cert sl@0: } sl@0: return res; sl@0: } sl@0: sl@0: EXPORT_C HBufC8* InputExtra::ReadFilesLC(CDesCArray& aFilenames, const TDesC& aPath, RFs& aFs) sl@0: { sl@0: TInt count = aFilenames.MdcaCount(); sl@0: TInt totalSize = 0; sl@0: TInt i = 0; sl@0: for (i = 0; i < count; i++) sl@0: { sl@0: HBufC* filenameBuf = HBufC::NewLC(256); sl@0: TPtr fullFilename = filenameBuf->Des(); sl@0: fullFilename.Append(aPath); sl@0: TPtrC filename = aFilenames.MdcaPoint(i); sl@0: fullFilename.Append(filename); sl@0: sl@0: RFile file; sl@0: User::LeaveIfError(file.Open(aFs, fullFilename, EFileRead)); sl@0: CleanupClosePushL(file); sl@0: TInt size; sl@0: file.Size(size); sl@0: CleanupStack::PopAndDestroy(2);//filenameBuf, fileClose sl@0: totalSize += size; sl@0: } sl@0: HBufC8* res = HBufC8::NewLC(totalSize); sl@0: TPtr8 pRes = res->Des(); sl@0: for (i = 0; i < count; i++) sl@0: { sl@0: HBufC8* cert = Input::ReadFileLC(aFilenames.MdcaPoint(i), aPath, aFs); sl@0: pRes.Append(cert->Des()); sl@0: CleanupStack::PopAndDestroy();//cert sl@0: } sl@0: return res; sl@0: } sl@0: