kerneltest/e32test/misc/unzip.h
author Tom Cosgrove <tom.cosgrove@nokia.com>
Fri, 28 May 2010 16:26:05 +0100
branchRCL_3
changeset 29 743008598095
parent 0 a41df078684a
permissions -rw-r--r--
Fix for bug 2283 (RVCT 4.0 support is missing from PDK 3.0.h) Have multiple extension sections in the bld.inf, one for each version of the compiler. The RVCT version building the tools will build the runtime libraries for its version, but make sure we extract all the other versions from zip archives. Also add the archive for RVCT4.

// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32test\misc\unzip.h
// 
//

#ifndef __UNZIP_H__
#define __UNZIP_H__
#include <e32cmn.h>

#ifdef __KERNEL_MODE__
#define	MALLOC(x)				Kern::Alloc(x)
#define	FREE(x)					Kern::Free(x)
#define WAIT_FOR_ANY_REQUEST()	Kern::WaitForAnyRequest()
#else
#include <e32std.h>
#define	MALLOC(x)				User::Alloc(x)
#define	FREE(x)					User::Free(x)
#define WAIT_FOR_ANY_REQUEST()	User::WaitForAnyRequest()
#define	WAIT_FOR_REQUEST(x)		User::WaitForRequest(x)
#define DELAY(x)				User::After(x)
#endif

const TInt KZipLocalHeaderLen=30;
const TInt KZipExtHeaderLen=16;
const TUint KZipSignature=0x04034b50u;
const TInt KZipWindowSize=0x8000;

class TZipInfo
	{
public:
	TInt iFlags;
	TInt iMethod;
	TUint iCrc;
	TInt iCompressedSize;
	TInt iUncompressedSize;
	TInt iFileNameLength;
	TInt iExtraLength;
	TInt iNameOffset;
	TInt iDataOffset;
	TBuf<128> iName;
	TUint iInBufSize;				// must be a power of 2
	volatile TUint iFileBufW;
	volatile TUint iFileBufR;
	TUint iFileBufSize;				// must be a power of 2 and a multiple of iInBufSize
	TUint8* iFileBuf;
	TRequestStatus iProcessedHeader;
	volatile TInt iHeaderDone;
	TUint8* iOutBuf;
	TInt iRemain;
	TInt iThreadHandle;
	TRequestStatus iThreadStatus;
	};

GLREF_C void AcceptUnzippedBlock(TZipInfo& aInfo, TUint8*& aOutPtr, TInt aError);
GLREF_C TInt InitInfo(TZipInfo& a);
GLREF_C TInt UnzipThread(TAny* aInfo);
GLREF_C TInt ReadBlockToBuffer(TZipInfo& a);
GLREF_C TInt ReadInputData(TUint8* aDest, TInt& aLength);
GLREF_C TInt UnzipComplete(TZipInfo& a, TUint8* aOutPtr, TInt aError);
#endif