コード例 #1
0
EXPORT_C  void CObexMtmFileNameExternaliser::Internalise1FileNameL(CMsvEntry* aEntry,  TDes16* aFileName)
/**
* Static function to read in one filename from the store.
*
* @param aEntry entry to read the filename from
* @param aFileName Descriptor to receive the new filename. Any existing data will be overwritten. MUST be long enough to contain the name.
* @leave KErrXXX system wide error codes.
*/	
	{
	CMsvStore* messageStore = aEntry->ReadStoreL();
	CleanupStack::PushL(messageStore);

	RMsvReadStream messageReadStream;
	messageReadStream.OpenLC(*messageStore, KObexFileNameStreamUid);  // If data hasn't been stored then this will provide the error.

	// verify that we're reading the right type of data from the stream


	// INC042468: "AV21: Data Compatibility break caused by "PHAR-5SDJG9""
	// To regain compatibility, if the first integer read from the stream
	// is not the expected "KObexFileNameStreamFileNameUid", it is assumed it 
	// is the filename length. An extra check is made that it is a valid filename
	// length (<= KMaxFileName).
	// "KObexFileNameStreamFileNameUid" has also been modified so that there cannot
	// be a file with a name length equal to KObexFileNameStreamFileNameUid (in which
	// case we would have been in trouble ;-) )

	TInt32 firstInt = messageReadStream.ReadInt32L();
	TInt32 fileNameLength = 0;
	if (firstInt == KObexFileNameStreamFileNameUid)
		{
		// next will be the filename length
		fileNameLength = messageReadStream.ReadInt32L();
		}
	else if (firstInt <= KMaxFileName)
		{
		// let's assume the first integer in the stream was the filename length
		// (this happens if the message was saved by an old build (previous to PHAR-5SDJG9)
		fileNameLength = firstInt;
		}
	else
		{
		// neither the expected "KObexFileNameStreamFileNameUid" nor a valid filename length
		User::Leave(KErrArgument);	
		}

	messageReadStream.ReadL(*aFileName, fileNameLength);

	CleanupStack::PopAndDestroy(2, messageStore);  // messageStore, messageReadStream (calls Close() first)
	}
コード例 #2
0
EXPORT_C void CImOffLineOperation::InternalizeL( RMsvReadStream& aReadStream )
    {                        
    DeleteBuffer();
    iOpType				= TOffLineOpType(aReadStream.ReadInt32L());
    iMessageId			= TMsvId(aReadStream.ReadInt32L());
    iTargetMessageId	= TMsvId(aReadStream.ReadInt32L());
    iMtmFunctionId		= aReadStream.ReadInt32L();

    TInt length			= aReadStream.ReadInt32L();
    
    if (length > 0)
        {               
        iMtmParameters = HBufC8::NewL(aReadStream, length);
        }
	return;
	}
コード例 #3
0
// -----------------------------------------------------------------------------
// CMmsElementDescriptor::InternalizeL
// -----------------------------------------------------------------------------
//
void CMmsElementDescriptor::InternalizeL( RMsvReadStream& aStream  )
    {
    delete iContentReference;
    iContentReference = NULL;
    delete iContentType;
    iContentType = NULL;
    TInt32 length = 0;
    length = aStream.ReadInt32L();

    if ( length > 0 )
        {
        iContentReference = HBufC::NewL( aStream, length );
        }

    length = aStream.ReadInt32L();
    if ( length > 0 )
        {
        iContentType = HBufC8::NewL( aStream, length );
        }
    }
コード例 #4
0
EXPORT_C void CImOffLineArrayStore::InternalizeL(RMsvReadStream& aReadStream)
    {
    TInt nr;
    TUint16 version = aReadStream.ReadUint16L();
    if (version > iVersion)
        return;
    
    nr = aReadStream.ReadInt32L();
    CImOffLineOperation *operation=new(ELeave)CImOffLineOperation;
    CleanupStack::PushL(operation);
    
    TInt i;
    for (i = 0 ; i < nr ; i++)
        {
        operation->InternalizeL(aReadStream);
        iArray->AppendOperationL(*operation);
        }
    CleanupStack::PopAndDestroy();//operation
    }
コード例 #5
0
EXPORT_C  RObexMtmFileNameWithHeadersArray* CObexMtmFileNameExternaliser::InternaliseFileNamesLC(CMsvStore& aMessageStore)
/**
 * Static function to get the filenames stored within the message entry. The returned array is pushed onto the cleanup
 * stack.
 *
 * @param aMessageStore Store from which the names are to be read
 * @return Array of filenames, pushed onto the cleanup stack.
 * @leave System wide error codes
 */
	{
	RObexMtmFileNameWithHeadersArray* fileNameArray = new(ELeave) RObexMtmFileNameWithHeadersArray(KObexArrayGranularity);
	CleanupStack::PushL(fileNameArray);

	RMsvReadStream  newMessageReadStream;
	newMessageReadStream.OpenL(aMessageStore, KObexFileNameStreamUid);  // If data hasn't been stored then this will provide the error.
	CleanupClosePushL(newMessageReadStream);




	// INC042468: "AV21: Data Compatibility break caused by "PHAR-5SDJG9""
	// To regain compatibility, if the first integer read from the stream
	// is not the expected "KObexFileNameStreamFileNameUid", it is assumed it 
	// is the filename length. An extra check is made that it is a valid filename
	// length (<= KMaxFileName).
	// "KObexFileNameStreamFileNameUid" has also been modified so that there cannot
	// be a file with a name length equal to KObexFileNameStreamFileNameUid (in which
	// case we would have been in trouble ;-) )

	TInt32 firstInt = newMessageReadStream.ReadInt32L();
	
	TInt32 fileNameLength = 0;
	if (firstInt == KObexFileNameStreamFileNameUid)
		{
		// next will be the filename length
		fileNameLength = newMessageReadStream.ReadInt32L();
		}
	else if (firstInt <= KMaxFileName)
		{
		// let's assume the first integer in the stream was the filename length
		// (this happens if the message was saved by an old build (previous to PHAR-5SDJG9)
		fileNameLength = firstInt;
		}
	else
		{
		// neither the expected "KObexFileNameStreamFileNameUid" nor a valid filename length
		User::Leave(KErrArgument);	
		}

	TInt32 elementTypeID;
	TBool lengthAlreadyReadFlag;
	TFileName thisName;
	CObexMtmFileNameWithHeaders *thisPackage;
	while(fileNameLength)
		{

		thisPackage = CObexMtmFileNameWithHeaders::NewL();
		CleanupStack::PushL(thisPackage);
				
		// read 'bodylength' bytes into a descriptor			
		newMessageReadStream.ReadL(thisName, fileNameLength);
		
		// store this descriptor in the container
		thisPackage->iFileName = new(ELeave) TFileName(thisName);
		CleanupStack::PushL(thisPackage->iFileName);

		lengthAlreadyReadFlag = EFalse;	
		// get the type of the next element
		elementTypeID = newMessageReadStream.ReadInt32L();

		switch(elementTypeID)
			{
		case KObexFileNameStreamHeaderListUid:
			// this filename has some headers associated with it
			
			// read these headers in...
			thisPackage->iHeaderList = CObexHeaderList::NewLC();
			thisPackage->iHeaderList->InternalizeL(newMessageReadStream);

			// get the type of the next element
			elementTypeID = newMessageReadStream.ReadInt32L();
						
			// fall through to add this container to the array
		case KObexFileNameStreamFileNameUid:
			// this filename has no headers associated with it, this is OK.
			fileNameArray->Append(thisPackage);
			break;

		default:
			// builds previous to PHAR-5SDJG9: 
			// no stream Uids are externalised and elementTypeID contains already the filename length
			if (elementTypeID <= KMaxFileName)
				{
				fileNameArray->Append(thisPackage);
				fileNameLength = elementTypeID;
				lengthAlreadyReadFlag = ETrue;
				}
			else
				{
				User::Leave(KErrArgument);
				}
			// if this value is not one of the two element types, then we can't read the stream
			
			break;
			}

		// this member will be zero if there were no headers on this filename
		if(thisPackage->iHeaderList)
			{
			CleanupStack::Pop(thisPackage->iHeaderList);
			}

		// safely added filename and headers to list, pop the allocations off the cleanup stack.
		CleanupStack::Pop(thisPackage->iFileName);
		
		CleanupStack::Pop(thisPackage);

		// get the length of the next element
		if (!lengthAlreadyReadFlag)
			{
			TRAPD (err, fileNameLength = newMessageReadStream.ReadInt32L();)  // Length == 0 --> end of array
			}
		}