/** Reads a descriptor setting. @param aKey Key of setting to be read. @param aValue Returns the value of the setting if it is a descriptor. @return KErrNone if successful, KErrNotFound if the setting does not exist, KErrArgument if the setting exists but is not a descriptor, KErrOverflow if the descriptor is too small to receive the value in the repository, plus other system-wide error codes. @post Transactions fail only on those "other system-wide error codes". @capability Dependent Caller must satisfy the read access policy of that key in the repository. */ EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue) { TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize()); TInt ret=Get(aKey,ptr8); if (ret==KErrNone) aValue.SetLength(ptr8.Length()/2); return ret; }
/** Reads a descriptor setting. @param aKey Key of setting to be read. @param aValue Returns the value of the setting if it is a descriptor. @param aActualLength Returns the actual length of the setting if it is a descriptor. @return KErrNone if successful, KErrNotFound if the setting does not exist, KErrArgument if the setting exists but is not a descriptor, KErrOverflow if the descriptor is too small to receive the value in the repository, plus other system-wide error codes. @post Transactions fail only on those "other system-wide error codes". @capability Dependent Caller must satisfy the read access policy of that key in the repository. */ EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes16& aValue, TInt& aActualLength) { TInt actualLength8; TPtr8 ptr8((TUint8*)aValue.Ptr(), 0, aValue.MaxSize()); TInt ret=Get(aKey,ptr8,actualLength8); aValue.SetLength(ptr8.Length()/2); aActualLength=actualLength8/2; return ret; }
void CMemSpyMemStreamReader::ReadL( TDes16& aDes ) { // The kernel driver only ever writes narrow descriptors. // However, we can expand them to be UCS2 const TInt length = ReadInt32L(); // Need to check the remaining text is actually present... IsAvailableL( length ); // Set final length in descriptor aDes.SetLength( length ); // Read each char TUint16* dest = const_cast< TUint16* >( aDes.Ptr() ); for( TInt i=0; i<length; i++ ) { *dest++ = *iCurrent++; } }