Exemple #1
0
void CImageRescaler::RunL()
    {
    switch( iState ) 
        {
        case EStartRescale:
            {
            // Start rescaling process
            DecodeL();
            break;
            }
        case EDecoding:
            {
            if(iStatus == KErrNone) 
                {
                ScaleL();
                }
            else if(iStatus == KErrUnderflow) 
                {
                iImageDecoder->ContinueConvert( &iStatus );
                SetActive();
                }
            else
                {
                // Unknown error
                iErr = iStatus.Int();
                CompleteRerescale();
                }
            break;
            }
        case EEncoding:
            {
            iErr = iStatus.Int();
            CompleteRerescale();
            break;
            }
        case EScaling:
            {
            EncodeL();
            break;
            }
        default:
            {
            iErr = KErrGeneral;
            CompleteRerescale();
            break;
            }
        }   
    }
CAsn1PerEncodingFragment* CAsn1PerEnum::EncodeLC(TUint aExistingBitLength,
												const TInt aChoice,
												const TInt aMaxChoice,
												const TBool aIsExtensible,
												const TBool aIsExtended,
												const TBool aIsPaddingNeeded)
	{
	
	CAsn1PerEncodingFragment* encodeFragment=EncodeL(aExistingBitLength, 
													aChoice,
													aMaxChoice,
													aIsExtensible,
													aIsExtended,
													aIsPaddingNeeded);
	
		
	CleanupStack::PushL(encodeFragment);
	return encodeFragment;
		
	}
// -----------------------------------------------------------------------------
// CNATFWUNSAFMessage::EncodeL
// 1. Encode the UNSAF message normally.
// 2. Create a MESSAGE-INTEGRITY attribute. This updates also the header's
//    length field to include the MESSAGE-INTEGRITY before computing the hash.
// 3. Encode it to the last attribute of the UNSAF message.
// 4. Create a FINGERPRINT attribute. This updates also the header's
//    length field to include the FINGERPRINT before computing the hash.
// 5. Encode it to the last attribute of the UNSAF message.
// -----------------------------------------------------------------------------
//
EXPORT_C CBufBase* CNATFWUNSAFMessage::EncodeL(
    const TDesC8& aSharedSecret,
    TBool aUseFingerprint) const
{
    CBufBase* msg = EncodeL();
    CleanupStack::PushL(msg);
    if ( aSharedSecret.Length() )
    {
        //Long term credentials need be used if there's a REALM attribute
        CNATFWUNSAFMessageIntegrityAttribute* msgIntegrity =
            CNATFWUNSAFMessageIntegrityAttribute::NewLC(aSharedSecret, *msg,
                    HasAttribute( CNATFWUNSAFAttribute::ERealm ));

        HBufC8* encodedMsgIntegrity = msgIntegrity->EncodeL();
        CleanupStack::PushL(encodedMsgIntegrity);
        msg->InsertL(msg->Size(), *encodedMsgIntegrity);
        CleanupStack::PopAndDestroy(encodedMsgIntegrity);
        CleanupStack::PopAndDestroy(msgIntegrity);
    }
    if ( aUseFingerprint )
    {
        CNATFWUNSAFFingerprintAttribute* fingerprint =
            CNATFWUNSAFFingerprintAttribute::NewLC(*msg);

        HBufC8* encodedFingerprint = fingerprint->EncodeL();
        CleanupStack::PushL(encodedFingerprint);
        msg->InsertL(msg->Size(), *encodedFingerprint);
        CleanupStack::PopAndDestroy(encodedFingerprint);
        CleanupStack::PopAndDestroy(fingerprint);
    }

    CleanupStack::Pop(msg);
    msg->Compress();

    return msg;
}