installationservices/swi/source/sisfile/siscompressed.cpp
branchRCL_3
changeset 62 5cc91383ab1e
parent 0 ba25891c3a9e
equal deleted inserted replaced
61:cd189dac02f7 62:5cc91383ab1e
     1 /*
     1 /*
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    51 	}
    51 	}
    52 
    52 
    53 void CCompressed::ConstructL(TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
    53 void CCompressed::ConstructL(TInt64& aBytesRead, TReadTypeBehaviour aTypeReadBehaviour)
    54 	{	
    54 	{	
    55 	CField::ConstructL(iDataProvider, EFieldTypeCompressed, aBytesRead, aTypeReadBehaviour);	
    55 	CField::ConstructL(iDataProvider, EFieldTypeCompressed, aBytesRead, aTypeReadBehaviour);	
       
    56 	// Get the current offset
    56 	User::LeaveIfError(iDataProvider.Seek(ESeekCurrent, iOffset));
    57 	User::LeaveIfError(iDataProvider.Seek(ESeekCurrent, iOffset));
       
    58 	TInt64 fieldOffset = 0;
       
    59 
       
    60 #ifdef SIS_CRC_CHECK_ENABLED
    57 
    61 
    58 	// Calculate CRC of header and field data
    62 	// Calculate CRC of header and field data
    59 	TInt64 fieldOffset = iOffset - HeaderSize();
    63 	fieldOffset = iOffset - HeaderSize();
    60 	User::LeaveIfError(iDataProvider.Seek(ESeekStart, fieldOffset));
    64 	User::LeaveIfError(iDataProvider.Seek(ESeekStart, fieldOffset));
    61 	CField::CalculateCrcL(iDataProvider, HeaderSize() + Length() + PaddingSize(), iCrc );
    65 	CField::CalculateCrcL(iDataProvider, HeaderSize() + Length() + PaddingSize(), iCrc );
       
    66 #else
       
    67 	fieldOffset = iOffset + Length() + PaddingSize();
       
    68 	User::LeaveIfError(iDataProvider.Seek(ESeekStart, fieldOffset));
       
    69 #endif
       
    70 
    62 	aBytesRead += Length() + PaddingSize();
    71 	aBytesRead += Length() + PaddingSize();
    63 	}
    72 	}
    64 
    73 
    65 
    74 
    66 MSisDataProvider& CCompressed::DataProviderL()
    75 MSisDataProvider& CCompressed::DataProviderL()