|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Definition of the Swi::Sis::CCrc |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "siscrc.h" |
|
21 |
|
22 using namespace Swi::Sis; |
|
23 |
|
24 /*static*/ CCrc* CCrc::NewLC(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour) |
|
25 { |
|
26 CCrc* self = new(ELeave) CCrc(); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(aDataProvider, aBytesRead, aTypeReadBehaviour); |
|
29 return self; |
|
30 } |
|
31 |
|
32 /*static*/ CCrc* CCrc::NewL(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour) |
|
33 { |
|
34 CCrc* self = NewLC(aDataProvider, aBytesRead, aTypeReadBehaviour); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CCrc::CCrc() |
|
40 { |
|
41 } |
|
42 |
|
43 CCrc::~CCrc() |
|
44 { |
|
45 } |
|
46 |
|
47 void CCrc::ConstructL(MSisDataProvider& aDataProvider, TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour) |
|
48 { |
|
49 |
|
50 TInt64 fieldOffset = aBytesRead; |
|
51 |
|
52 if (aTypeReadBehaviour == EReadType) |
|
53 { |
|
54 TFieldType fieldType; |
|
55 CField::ReadEnumL<TFieldType,TUint32>(aDataProvider, fieldType, aBytesRead); |
|
56 |
|
57 if ((fieldType != EFieldTypeControllerCRC) || (fieldType != EFieldTypeDataCRC)) |
|
58 { |
|
59 User::Leave(KErrSISUnexpectedFieldType); |
|
60 } |
|
61 } |
|
62 else |
|
63 { |
|
64 CField::ConstructL(aDataProvider, EFieldTypeControllerCRC, aBytesRead, aTypeReadBehaviour); |
|
65 } |
|
66 |
|
67 CField::ReadTTypeL(aDataProvider, iChecksum, aBytesRead); |
|
68 CField::SkipUnknownFieldsL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour); |
|
69 CField::EnsureAlignedL(aDataProvider, aBytesRead - fieldOffset, aBytesRead, aTypeReadBehaviour); |
|
70 } |