os/kernelhwsrv/kerneltest/e32test/misc/unzip.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\misc\unzip.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __UNZIP_H__
sl@0
    19
#define __UNZIP_H__
sl@0
    20
#include <e32cmn.h>
sl@0
    21
sl@0
    22
#ifdef __KERNEL_MODE__
sl@0
    23
#define	MALLOC(x)				Kern::Alloc(x)
sl@0
    24
#define	FREE(x)					Kern::Free(x)
sl@0
    25
#define WAIT_FOR_ANY_REQUEST()	Kern::WaitForAnyRequest()
sl@0
    26
#else
sl@0
    27
#include <e32std.h>
sl@0
    28
#define	MALLOC(x)				User::Alloc(x)
sl@0
    29
#define	FREE(x)					User::Free(x)
sl@0
    30
#define WAIT_FOR_ANY_REQUEST()	User::WaitForAnyRequest()
sl@0
    31
#define	WAIT_FOR_REQUEST(x)		User::WaitForRequest(x)
sl@0
    32
#define DELAY(x)				User::After(x)
sl@0
    33
#endif
sl@0
    34
sl@0
    35
const TInt KZipLocalHeaderLen=30;
sl@0
    36
const TInt KZipExtHeaderLen=16;
sl@0
    37
const TUint KZipSignature=0x04034b50u;
sl@0
    38
const TInt KZipWindowSize=0x8000;
sl@0
    39
sl@0
    40
class TZipInfo
sl@0
    41
	{
sl@0
    42
public:
sl@0
    43
	TInt iFlags;
sl@0
    44
	TInt iMethod;
sl@0
    45
	TUint iCrc;
sl@0
    46
	TInt iCompressedSize;
sl@0
    47
	TInt iUncompressedSize;
sl@0
    48
	TInt iFileNameLength;
sl@0
    49
	TInt iExtraLength;
sl@0
    50
	TInt iNameOffset;
sl@0
    51
	TInt iDataOffset;
sl@0
    52
	TBuf<128> iName;
sl@0
    53
	TUint iInBufSize;				// must be a power of 2
sl@0
    54
	volatile TUint iFileBufW;
sl@0
    55
	volatile TUint iFileBufR;
sl@0
    56
	TUint iFileBufSize;				// must be a power of 2 and a multiple of iInBufSize
sl@0
    57
	TUint8* iFileBuf;
sl@0
    58
	TRequestStatus iProcessedHeader;
sl@0
    59
	volatile TInt iHeaderDone;
sl@0
    60
	TUint8* iOutBuf;
sl@0
    61
	TInt iRemain;
sl@0
    62
	TInt iThreadHandle;
sl@0
    63
	TRequestStatus iThreadStatus;
sl@0
    64
	};
sl@0
    65
sl@0
    66
GLREF_C void AcceptUnzippedBlock(TZipInfo& aInfo, TUint8*& aOutPtr, TInt aError);
sl@0
    67
GLREF_C TInt InitInfo(TZipInfo& a);
sl@0
    68
GLREF_C TInt UnzipThread(TAny* aInfo);
sl@0
    69
GLREF_C TInt ReadBlockToBuffer(TZipInfo& a);
sl@0
    70
GLREF_C TInt ReadInputData(TUint8* aDest, TInt& aLength);
sl@0
    71
GLREF_C TInt UnzipComplete(TZipInfo& a, TUint8* aOutPtr, TInt aError);
sl@0
    72
#endif