diff -r 000000000000 -r 0e4a32b9112d tsrc/xmltestharness/xmlclient/src/paramconversion.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/xmltestharness/xmlclient/src/paramconversion.cpp Wed Aug 25 12:40:50 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/** +@file +@internalComponent +*/ + +#include "paramconversion.h" +#include +#include + +OMX_PARAM_CONTENTURITYPE* ParamConversion::FilenameAsContentUriStructV1_0L(const TDesC& aFileName) + { + CUri8* aFileUri = CUri8::CreateFileUriL(aFileName); + CleanupStack::PushL(aFileUri); + const TDesC8& aUriDes = aFileUri->Uri().UriDes(); + if(aUriDes.Length() > 255) + { + User::Leave(KErrTooBig); + } + OMX_PARAM_CONTENTURITYPE* aUriStruct = reinterpret_cast(new(ELeave) TUint8[264]); + aUriStruct->nSize = 264; + aUriStruct->nVersion.s.nVersionMajor = 1; + aUriStruct->nVersion.s.nVersionMinor = 0; + aUriStruct->nVersion.s.nRevision = 0; + aUriStruct->nVersion.s.nStep = 0; + TPtr8 aUriStructDes(aUriStruct->contentURI, aUriDes.Length()+1); + aUriStructDes = aUriDes; + aUriStructDes.Append('\0'); + CleanupStack::PopAndDestroy(aFileUri); + return aUriStruct; + } + +OMX_PARAM_CONTENTURITYPE* ParamConversion::FilenameAsContentUriStructV1_1L(const TDesC& aFileName) + { + CUri8* aFileUri = CUri8::CreateFileUriL(aFileName); + CleanupStack::PushL(aFileUri); + const TDesC8& aUriDes = aFileUri->Uri().UriDes(); + // sizeof(OMX_PARAM_CONTENTURITYPE) includes 1 byte for the URI name. counting this as well leaves room for a null terminator. + TInt aStructSize = 9 + aUriDes.Length(); + TUint8* aUriBytes = new(ELeave) TUint8[aStructSize]; + OMX_PARAM_CONTENTURITYPE* aUriStruct = reinterpret_cast(aUriBytes); + aUriStruct->nSize = aStructSize; + aUriStruct->nVersion.s.nVersionMajor = OMX_VERSION_MAJOR; + aUriStruct->nVersion.s.nVersionMinor = OMX_VERSION_MINOR; + aUriStruct->nVersion.s.nRevision = OMX_VERSION_REVISION; + aUriStruct->nVersion.s.nStep = OMX_VERSION_STEP; + TPtr8 aUriStructDes(aUriStruct->contentURI, aUriDes.Length()+1); + aUriStructDes = aUriDes; + aUriStructDes.Append('\0'); + CleanupStack::PopAndDestroy(aFileUri); + return aUriStruct; + }