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: // bootldr\inc\unzip.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __UNZIP_H__ sl@0: #define __UNZIP_H__ sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __KERNEL_MODE__ sl@0: #define MALLOC(x) Kern::Alloc(x) sl@0: #define FREE(x) Kern::Free(x) sl@0: #define WAIT_FOR_ANY_REQUEST() Kern::WaitForAnyRequest() sl@0: #else sl@0: #include sl@0: #define MALLOC(x) User::Alloc(x) sl@0: #define FREE(x) User::Free(x) sl@0: #define WAIT_FOR_ANY_REQUEST() User::WaitForAnyRequest() sl@0: #define WAIT_FOR_REQUEST(x) User::WaitForRequest(x) sl@0: #define DELAY(x) User::After(x) sl@0: #endif sl@0: sl@0: const TInt KZipLocalHeaderLen=30; sl@0: const TInt KZipExtHeaderLen=16; sl@0: const TUint KZipSignature=0x04034b50u; sl@0: const TInt KZipWindowSize=0x8000; sl@0: sl@0: class TZipInfo sl@0: { sl@0: public: sl@0: TInt iFlags; sl@0: TInt iMethod; sl@0: TUint iCrc; sl@0: TInt iCompressedSize; sl@0: TInt iUncompressedSize; sl@0: TInt iFileNameLength; sl@0: TInt iExtraLength; sl@0: TInt iNameOffset; sl@0: TInt iDataOffset; sl@0: TBuf<128> iName; sl@0: TUint iInBufSize; // must be a power of 2 sl@0: volatile TUint iFileBufW; sl@0: volatile TUint iFileBufR; sl@0: TUint iFileBufSize; // must be a power of 2 and a multiple of iInBufSize sl@0: TUint8* iFileBuf; sl@0: TRequestStatus iProcessedHeader; sl@0: volatile TInt iHeaderDone; sl@0: TUint8* iOutBuf; sl@0: TInt iRemain; sl@0: TInt iThreadHandle; sl@0: TRequestStatus iThreadStatus; sl@0: }; sl@0: sl@0: GLREF_C void AcceptUnzippedBlock(TZipInfo& aInfo, TUint8*& aOutPtr, TInt aError); sl@0: GLREF_C TInt InitInfo(TZipInfo& a); sl@0: GLREF_C TInt UnzipThread(TAny* aInfo); sl@0: GLREF_C TInt ReadBlockToBuffer(TZipInfo& a, RFile &aBootFile); sl@0: GLREF_C TInt ReadInputData(TUint8* aDest, TInt& aLength); sl@0: GLREF_C TInt UnzipComplete(TZipInfo& a, TUint8* aOutPtr, TInt aError); sl@0: #endif