omadrm/drmhelper/src/drmhelper.cpp
branchRCL_3
changeset 10 89a1f2bd800d
parent 2 76350b5be3d8
child 12 8a03a285ab14
equal deleted inserted replaced
5:79d62d1d7957 10:89a1f2bd800d
     1 /*
     1 /*
     2 * Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003-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 "Eclipse Public License v1.0"
     5 * under the terms of "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".
  3585     const HBufC8* aUrl,
  3585     const HBufC8* aUrl,
  3586     HBufC*& aLaunchParam )
  3586     HBufC*& aLaunchParam )
  3587     {
  3587     {
  3588     TInt index;
  3588     TInt index;
  3589 
  3589 
  3590     // MaxInt will fit into 10 characters
  3590     // MaxInt will fit into 11 characters
  3591     HBufC* b( HBufC::NewLC( 10 ) );
  3591     HBufC* b( HBufC::NewLC( 11 ) );
  3592     b->Des().NumUC( aLocalId );
  3592     b->Des().NumUC( aLocalId );
  3593     HBufC* localIDBuf( b->ReAllocL( b->Des().Length() ) );
  3593     HBufC* localIDBuf( b->ReAllocL( b->Des().Length() ) );
  3594     CleanupStack::Pop( b );
  3594     CleanupStack::Pop( b );
  3595     b = NULL;
  3595     b = NULL;
  3596     CleanupStack::PushL( localIDBuf );
  3596     CleanupStack::PushL( localIDBuf );
  3597 
  3597 
  3598     // length of startparam is always 1 and 2 spaces are needed
  3598     // length of startparam is always 1 and some markers are needed
  3599     TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 2;
  3599     TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 4;
  3600 
  3600 
  3601     aLaunchParam = HBufC::NewMaxL( length );
  3601     aLaunchParam = HBufC::NewMaxL( length );
  3602 
  3602 
  3603     TPtr ptr( aLaunchParam->Des() );
  3603     TPtr ptr( aLaunchParam->Des() );
  3604     ptr.SetLength( 0 );
  3604     ptr.SetLength( 0 );
  3605     _LIT( KOne, "1" );
  3605     _LIT( KOne, "1" );
  3606     _LIT( KTwo, "2" );
  3606     _LIT( KTwo, "2" );
  3607     _LIT( KSpace, " " );
  3607     _LIT( KMarker, "\x00" );
  3608 
  3608 
  3609     // start param is 1 for embedded launch and 2 for launching details view
  3609     // start param is 1 for embedded launch and 2 for launching details view
  3610     // standalone
  3610     // standalone
  3611     if ( iUseCoeEnv )
  3611     if ( iUseCoeEnv )
  3612         {
  3612         {
  3614         }
  3614         }
  3615     else
  3615     else
  3616         {
  3616         {
  3617         ptr.Append( KTwo() );
  3617         ptr.Append( KTwo() );
  3618         }
  3618         }
  3619     ptr.Append( KSpace() );
  3619     ptr.Append( KMarker() );
  3620     ptr.Append( localIDBuf->Des() );
  3620     ptr.Append( localIDBuf->Des() );
  3621     ptr.Append( KSpace() );
  3621     ptr.Append( KMarker() );
  3622 
  3622 
  3623     index = ptr.Length();
  3623     index = ptr.Length();
  3624     ptr.SetLength( length );
  3624     ptr.SetLength( length );
  3625     for ( TInt i = 0 ; i < aUrl->Length(); i++ )
  3625     for ( TInt i = 0 ; i < aUrl->Length(); i++ )
  3626         {
  3626         {
  3627         ptr[index++] = ( unsigned char ) (*aUrl)[i];
  3627         ptr[index++] = ( unsigned char ) (*aUrl)[i];
  3628         }
  3628         }
  3629 
  3629 
       
  3630     ptr.Append( KMarker() );
       
  3631     
  3630     CleanupStack::PopAndDestroy( localIDBuf );
  3632     CleanupStack::PopAndDestroy( localIDBuf );
  3631     }
  3633     }
  3632 
  3634 
  3633 
  3635 
  3634 // -----------------------------------------------------------------------------
  3636 // -----------------------------------------------------------------------------