TBool assert_equals_des8(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity, const TDesC8& aRes, const TDesC8& aExp, const TDesC& aMsg) { if(aRes != aExp) { TBuf<20> tempRes; TBuf<20> tempExp; TPtrC8 exp; TPtrC8 res; exp.Set(aExp.Ptr(), aExp.Length()); res.Set(aRes.Ptr(), aRes.Length()); if(exp.Length() > KMaxLogCharLength) { exp.Set(exp.Ptr(), KMaxLogCharLength); } if(res.Length() > KMaxLogCharLength) { res.Set(res.Ptr(), KMaxLogCharLength); } //8-bit copy to unicode for logging tempRes.Copy(res); tempExp.Copy(exp); aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &tempRes, &tempExp, &aMsg); return EFalse; } return ETrue; }
LOCAL_C TInt NumberOfBytesAbleToConvertToSampleExtension(const TDesC8& aDescriptor) { const TUint8* pointerToPreviousByte=aDescriptor.Ptr()-1; const TUint8* const pointerToLastByte=pointerToPreviousByte+aDescriptor.Length(); if (pointerToPreviousByte==pointerToLastByte) { return 0; } FOREVER { __ASSERT_DEBUG(pointerToPreviousByte<pointerToLastByte, Panic(EPanicBadPointers1)); TUint currentByte=*(pointerToPreviousByte+1); if ((currentByte<0xef) || (currentByte>0xf0)) { break; } __ASSERT_DEBUG(pointerToPreviousByte<pointerToLastByte, Panic(EPanicBadPointers2)); if (pointerToLastByte-pointerToPreviousByte<2) { break; } ++pointerToPreviousByte; __ASSERT_DEBUG(pointerToPreviousByte<pointerToLastByte, Panic(EPanicBadPointers3)); ++pointerToPreviousByte; __ASSERT_DEBUG(pointerToPreviousByte<=pointerToLastByte, Panic(EPanicBadPointers4)); if (pointerToPreviousByte>=pointerToLastByte) { break; } } return (pointerToPreviousByte+1)-aDescriptor.Ptr(); }
void TAlfLinearMappingFunctionHandler::HandleCmdL( TInt aCommandId, const TDesC8& aInputBuffer, TDes8& /*aResponse*/ ) { switch ( aCommandId ) { case EAlfLinearMappingFunctionSetFactor: { TReal32* mapValues = (TReal32*) aInputBuffer.Ptr(); iLinearMappingFunction.iFactor = *mapValues; break; } case EAlfLinearMappingFunctionSetOffset: { TReal32* mapValues = (TReal32*) aInputBuffer.Ptr(); iLinearMappingFunction.iOffset = *mapValues; break; } default: User::Leave( KErrNotSupported ); } }
// -------------------------------------------------------------------------- // From class CMMFCodec. // The function sets codec configuration. // value used for aConfigType must be KUidMmfCodecAudioSettings // (defined in include\mmf\plugins\mmfCodecImplementationUIDs.hrh) // // -------------------------------------------------------------------------- // void CAriAmrNbEncMmfCodec::ConfigureL( TUid /* aConfigType */, const TDesC8& aParam ) { PRINT_ENTRY; if ( !iConfigured ) { TInt encMode = 0; TInt dtx = 0; TInt offset = 0; Mem::Copy( &encMode, aParam.Ptr() + offset, sizeof( TInt ) ); offset += sizeof(TInt); Mem::Copy( &dtx, aParam.Ptr() + offset, sizeof( TInt ) ); offset += sizeof(TInt); iParam.iMode = ( TInt16 )encMode; iParam.iDtx = ( TInt16 )dtx; PRINT_MSG( LEVEL_HIGH, ( "Mode: %d", iParam.iMode ) ); PRINT_MSG( LEVEL_HIGH, ( "DTX: %d", iParam.iDtx ) ); User::LeaveIfError( iCodec->Reset( &iParam ) ); iConfigured = ETrue; } PRINT_EXIT; }
void CPjAudioInputEngine::MaiscBufferCopied(TInt aError, const TDesC8 &aBuffer) { lastError_ = aError; if (aError != KErrNone) { snd_perror("Error in MaiscBufferCopied()", aError); return; } if (frameRecBufLen_ || aBuffer.Length() < frameLen_) { pj_memcpy(frameRecBuf_ + frameRecBufLen_, (void*) aBuffer.Ptr(), aBuffer.Length()); frameRecBufLen_ += aBuffer.Length(); } if (frameRecBufLen_) { while (frameRecBufLen_ >= frameLen_) { pjmedia_frame f; f.type = PJMEDIA_FRAME_TYPE_AUDIO; f.buf = frameRecBuf_; f.size = frameLen_; f.timestamp.u32.lo = timeStamp_; f.bit_info = 0; // Call the callback. recCb_(userData_, &f); // Increment timestamp. timeStamp_ += parentStrm_->param.samples_per_frame; frameRecBufLen_ -= frameLen_; pj_memmove(frameRecBuf_, frameRecBuf_+frameLen_, frameRecBufLen_); } } else { pjmedia_frame f; f.type = PJMEDIA_FRAME_TYPE_AUDIO; f.buf = (void*)aBuffer.Ptr(); f.size = aBuffer.Length(); f.timestamp.u32.lo = timeStamp_; f.bit_info = 0; // Call the callback. recCb_(userData_, &f); // Increment timestamp. timeStamp_ += parentStrm_->param.samples_per_frame; } // Record next frame TPtr8 & frm = GetFrame(); TRAPD(err2, iInputStream_->ReadL(frm)); if (err2) { PJ_LOG(4,(THIS_FILE, "Exception in iInputStream_->ReadL()")); } }
void CT_KOI8R::Merge_Big(TDesC8& aSource, TDes16& aTarget) { TInt length = aSource.Length(); TInt i = 0; for(i=0;i<length-1;i++) { TInt64 temp = *(aSource.Ptr()+(i))*16*16 + *(aSource.Ptr()+i+1); aTarget.Append(temp); i++; } }
/** * Parses a descriptor that contains part of a document. */ void CXMLEngineSAXPlugin::ParseChunkL(const TDesC8& aDescriptor) { TInt result = KErrNone; if (!iParserContext) { //creating sax parser object iParserContext = xmlCreatePushParserCtxt( (xmlSAXHandler*) &iParserEvents, this, (const char *) aDescriptor.Ptr(), aDescriptor.Length(), NULL ); if(!iParserContext) { CleanupAndLeaveL(KErrNoMemory); } //creating empty document object iParserContext->myDoc = xmlNewDoc(BAD_CAST "SAX compatibility mode document"); if(!iParserContext->myDoc) { CleanupAndLeaveL(KErrNoMemory); } iParserContext->myDoc->intSubset = xmlNewDtd(iParserContext->myDoc, BAD_CAST "fake", NULL, NULL); if(!iParserContext->myDoc->intSubset) { CleanupAndLeaveL(KErrNoMemory); } //parsing process result = xmlParseChunk(iParserContext, NULL, 0, 0); } else { //parsing process result = xmlParseChunk( iParserContext, (const char *) aDescriptor.Ptr(), aDescriptor.Length(), 0); } //handling error situation //if fatal error, function throws exception //in any other case next chunk is taken (recoverable) if ((result == XML_ERR_NO_MEMORY) || (iParserContext->lastError.level == XML_ERR_FATAL) || (result < 0)) { CleanupAndLeaveL(GetErrorNum(result)); } }
//translate from unicode big endian TDesC8 to TDes16 void CT_TURKISHLOCKING::Unicode_Big(TDesC8& aSource, TDes16& aTarget) { TInt length = aSource.Length(); TInt i = 0; for(i=0;i<length-1;i++) { TInt32 temp = *(aSource.Ptr()+(i))*16*16 + *(aSource.Ptr()+i+1); aTarget.Append(temp); i++; } }
// This is called in 1...N thread contextes void DISICLTransceiver::ReceiveISIMessage( const TDesC8& aMessage, const TUint8 aTrxId ) { C_TRACE( ( _T( "DISICLTransceiver::ReceiveMsg 0x%x 0x%x 0x%x>" ), this, &aMessage, aTrxId ) ); // Can only be called from thread context. ASSERT_THREAD_CONTEXT_ALWAYS( ( EISICLTransceiverNotThreadContext | EDISIUserChannelTraceId << KClassIdentifierShift ) ); TUint8 txDevId = GET_SENDER_DEV( aMessage.Ptr() ); if ( DynamicDevice( txDevId ) ) { TUint8 staticDevId(0); const TInt count( iShDevices.Count() ); TInt index(0); TBool staticDeviceFound(EFalse); MISIRouterLinkIf* Link = NULL; while( !staticDeviceFound && ( index < count ) ) { C_TRACE( ( _T( "DISICLTransceiver::ReceiveMsg find static device for trx 0x%x index %d" ), aTrxId, index ) ); DISIDevice* tmpDevice = iShDevices[ index ]; ASSERT_RESET_ALWAYS( tmpDevice, ( EISICLTransceiverNULLPtr4 | EDISICLTransceiverTraceId << KClassIdentifierShift ) ); tmpDevice->LockDeviceFM(); Link = tmpDevice->GetLink(); if( Link->GetTrxId() == aTrxId ) { staticDevId = tmpDevice->GetDeviceIdentifier(); tmpDevice->FreeDeviceFM(); C_TRACE( ( _T( "DISICLTransceiver::ReceiveMsg static device 0x%x trx 0x%x" ), this, &aMessage, aTrxId ) ); staticDeviceFound = ETrue; } else { tmpDevice->FreeDeviceFM(); } index++; } #ifdef USE_MEDIAAPI if ( PN_DEV_PC == GET_SENDER_DEV( aMessage.Ptr() )) { C_TRACE( ( _T( "DISICLTransceiver::ReceiveMsg 0x%x 0x%x trx id = %d<" ), this, &aMessage, (Link->GetTrxId()) ) ); iDevPcLastActiveTrxId = iDevPcLastSendTrxId; iDevPcLastSendTrxId = Link->GetTrxId(); } #endif /* USE_MEDIAAPI */ UpdateDynamicDeviceTable( txDevId, staticDevId ); } // else static device. No need to save trxId iRxQueue->Add( aMessage ); iRxQueueDfc->Enque(); C_TRACE( ( _T( "DISICLTransceiver::ReceiveMsg 0x%x 0x%x 0x%x<" ), this, &aMessage, aTrxId ) ); }
//------------------------------------------------------------ // CNsmlObexClient::SendDataL( TDesC8& aStartPtr, TBool /*aFinalPacket*/, TRequestStatus &aStatus ) //------------------------------------------------------------ void CNsmlObexClient::SendDataL( TDesC8& aStartPtr, TBool /*aFinalPacket*/, TRequestStatus &aStatus ) { iAgentStatus = &aStatus; // agent *iAgentStatus = KRequestPending; if ( iState == EWaitingToReceive ) { iClient->Abort(); iState = EWaitingToSend; } if ( iState != EWaitingToSend ) { User::Leave( KErrDisconnected ); } else if ( IsActive() ) { User::Leave( KErrInUse ); } iCurrObject->Reset(); DBG_DUMP((void*)aStartPtr.Ptr(), aStartPtr.Length(), _S8("SendDataL (WBXML)") ); #ifdef __NSML_DEBUG__ _DBG_FILE("CNsmlObexClient::SendDataL: CWbxml2XmlConverter::ConvertL() begin"); CWbxml2XmlConverter* c = CWbxml2XmlConverter::NewLC(); c->ConvertL(aStartPtr.Ptr(), aStartPtr.Length()); DBG_DUMP((void*)c->Document().Ptr(), c->Document().Length(), _S8("SendDataL (XML)") ); CleanupStack::PopAndDestroy(); // c _DBG_FILE("CNsmlObexClient::SendDataL: CWbxml2XmlConverter::ConvertL() end"); #endif // __NSML_DEBUG__ iDocumentLength = aStartPtr.Length(); iDataBuf->Reset(); iDataBuf->InsertL( 0, aStartPtr ); TRAPD( err, iCurrObject->SetDataBufL( iDataBuf ) ); if( KErrNone == err ) { TBuf8<KNameLen> str; str.Copy( this->iMimeType->Des() ); iCurrObject->SetTypeL( str ); iClient->Put( *iCurrObject, iStatus ); SetActive (); } }
EXPORT_C TBool TBtreeInlineIndexOrg::Update(TAny *aNode,TInt aPos,const TDesC8& anEntry) const { __ASSERT_DEBUG(anEntry.Size()<=KeySize(),Panic(EBadEntrySize)); __ASSERT_DEBUG(aPos<Node(aNode)->iHead.iCount,Panic(EBadEntryPos)); Mem::Copy(Entry(Node(aNode),aPos)->iKey,anEntry.Ptr(),KeySize()); return ETrue; }
void TAlfTableMappingFunctionHandler::HandleCmdL( TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse ) { switch ( aCommandId ) { case EAlfMappingFunctionMapValue: { TIntTReal* mapValues = (TIntTReal*) aInputBuffer.Ptr(); const TReal32 returnValue = iMappingFunction.MapValue( mapValues->iReal, mapValues->iInt ); TPckg<TReal32> returnValuePckg(returnValue); aResponse = returnValuePckg; break; } case EAlfMappingFunctionTableSetValues: { TAlfTableMappingFunctionParams* mapValues = (TAlfTableMappingFunctionParams*) aInputBuffer.Ptr(); iMappingFunction.iParams = *mapValues; break; } default: User::Leave( KErrNotSupported ); } }
EXPORT_C int Tbufc8ToWchar(TDesC8& aSrc, wchar_t* aDes, int& n_size) { int retval = ESuccess; unsigned int ilen = aSrc.Length(); int minusone = -1; if(0 == ilen) { return EDescriptorNoData; } else if(!aDes) { return EInvalidPointer; } else if (n_size < ilen+1) { n_size = ilen+1; return EInvalidSize; } if(minusone != mbstowcs(aDes, (const char *)aSrc.Ptr(), ilen)) { aDes[ilen] = L'\0'; } else { retval = EInvalidMBSSequence; } return retval; }
void CStateDownload::FindFilesL(const TDesC8& aFileList,CDesCArrayFlat* aFilesArray) { //retrieve the num of required files TUint8* ptr = (TUint8 *)aFileList.Ptr(); TUint32 numFiles = 0; Mem::Copy(&numFiles, ptr, 4); ptr += sizeof(TUint32); for(TInt i=0; i<numFiles; i++) { //retrieve search-string len TUint32 len = 0; Mem::Copy(&len,ptr,4); ptr += sizeof(TUint32); //retrieve search string HBufC* searchString = HBufC::NewL(len); if (len > 0) { TUint8 totChars = (len-2) / 2; TPtr16 ptrNum((TUint16 *) ptr, totChars, totChars); searchString->Des().Append(ptrNum); //check string, check typo errors like "E.\" or stupid requests such as "\*\" if(!MalformedPath(*searchString)) { StartScanL(iFs,*searchString,aFilesArray); } } delete searchString; ptr += len; } }
// from MRemConInterfaceIf void CRemConGroupNavigationApiTarget::MrcibNewMessage(TUint aOperationId, const TDesC8& aData) { LOG1(_L("\taOperationId = 0x%02x"), aOperationId); LOG1(_L("\taData.Length = %d"), aData.Length()); /* Decode the get GroupNavigation message */ TGroupNavigationPassthroughOperationIds currentOp = static_cast<TGroupNavigationPassthroughOperationIds>(aOperationId); TRemConCoreApiButtonAction button = static_cast<TRemConCoreApiButtonAction>(aData.Ptr()[0]); switch (currentOp) { case ENextGroup: { iObserver.MrcgntoNextGroup( button ); break; } case EPreviousGroup: { iObserver.MrcgntoPreviousGroup( button ); break; } default: break; } }
// --------------------------------------------------------------------------- // CWmDrmDlaUiNotifierImpl::InitializeL // --------------------------------------------------------------------------- // void CWmDrmDlaUiNotifierImpl::InitializeL( TDesC8& aOpaqueData ) { TInt err( KErrNotFound ); LOGFNR( "CWmDrmDlaUiNotifierImpl::InitializeL", err ); LOGHEX( aOpaqueData.Ptr(), aOpaqueData.Length() ); delete iUiPlugin; iUiPlugin = NULL; RImplInfoPtrArray implArray; CleanupStack::PushL( TCleanupItem( DoResetDestroyAndClose, &implArray ) ); REComSession::ListImplementationsL( KWmDrmDlaUiPluginIfUid, implArray ); for ( TInt i( 0 ); i < implArray.Count() && err == KErrNotFound; ++i ) { if ( aOpaqueData.CompareF( implArray[i]->OpaqueData() ) == 0 && implArray[i]->VendorId() == VID_DEFAULT ) { err = KErrNone; iUiPlugin = CWmDrmDlaUiPluginIf::NewL( implArray[i]->ImplementationUid() ); } } if ( err == KErrNotFound ) { err = KErrNone; iUiPlugin = CWmDrmDlaUiPluginIf::NewL( KWmDrmDlaDefaultUiPluginUid ); } CleanupStack::PopAndDestroy( &implArray ); }
EXPORT_C TPtrC8 CTestConfig::TrimLeft(const TDesC8& aInput) { const TText8* first = aInput.Ptr(); // pointer to first char const TText8* last = first + aInput.Length() - 1; // pointer to last char while (first < last && TChar(*first).IsSpace()) first++; // trim the left return TPtrC8(first, last + 1 - first); // return the result }
/** This method is a callback that sends the content of the element. Not all the content may be returned in one go. The data may be sent in chunks. When an OnEndElementL is received this means there is no more content to be sent. @param aBytes is the raw content data for the element. The client is responsible for converting the data to the required character set if necessary. In some instances the content may be binary and must not be converted. @param aErrorCode is the error code. If this is not KErrNone then special action may be required. */ void CTestHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode) { _LIT8(KOnContentFuncName,"OnContent()\r\n"); _LIT8(KInfoOnContent,"\tContent of element: %S \r\n"); _LIT8(KInfoOnError,"Error occurs %d \r\n"); TBuf8<KShortInfoSize> info; TBuf8<KShortInfoSize> info2; iLog.Write(KOnContentFuncName); if (aErrorCode == KErrNone) { if(aBytes.Length() >= KShortInfoSize) { TPtrC8 bytes = aBytes.Ptr(); HBufC8* buf1 = HBufC8::NewL(aBytes.Length() + 100); buf1->Des().Format(KInfoOnContent,&bytes); iLog.Write(*buf1); } info2.Copy(aBytes); info2.Trim(); if (info2.Length()) { info.Format(KInfoOnContent,&info2); iLog.Write(info); } } else { TBuf8<KShortInfoSize> info; info.Format(KInfoOnError,aErrorCode); iLog.Write(info); } }
// ----------------------------------------------------------------------------- // BufferToArrayL // Created buffer will contain <amount of elements:int32, element data1, element data2...> // ----------------------------------------------------------------------------- // LOCAL_C RPointerArray<HBufC8> BufferToArrayL( TDesC8& aBuffer ) { TInt32 count = 0; HBufC8* element = NULL; RPointerArray<HBufC8> array; TInt size = aBuffer.Size(); RMemReadStream stream( (TAny*)( aBuffer.Ptr() ), size ); CleanupClosePushL( stream ); CleanupResetAndDestroyPushL( array ); // amount of elements count = stream.ReadInt32L(); // for each in RPointerArray for ( TInt i = 0; i < count; i++ ) { // Read the element and append it to array element = HBufC8::NewLC( stream, KMaxElementLength ); array.AppendL( element ); CleanupStack::Pop( element ); } CleanupStack::Pop( &array ); CleanupStack::PopAndDestroy( &stream ); return array; }
void pcdata_s::SetDataL( const TDesC8& aData ) { FreeContent(); length = aData.Length(); content = User::AllocL(length); Mem::Copy(content, aData.Ptr(), length); }
TPtrC8 CAknKeyLockNotifierSubject::StartL(const TDesC8& aBuffer) { SAknNotifierPackage<SAknKeyLockNotifierParams>* params = ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); if ( aBuffer.Length() < 0 || (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || params->iSignature != KAKNNOTIFIERSIGNATURE ) { User::Leave( KErrArgument ); } switch (params->iParamData.iReason) { case ELockEnabled: case ELockDisabled: case EAllowNotifications: case EStopNotifications: case EOfferKeylock: case ECancelAllNotifications: case EEnableAutoLockEmulation: case EDisableWithoutNote: case EEnableWithoutNote: break; case EInquire: { iRetPckg().iEnabled = IsKeyLockEnabled(); } default: break; } return iRetPckg; }
// --------------------------------------------------------------------------- // From class ?base_class. // ?implementation_description // --------------------------------------------------------------------------- // EXPORT_C void CAlfBrushHandler::HandleCmdL( TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse) { switch (aCommandId) { case EAlfBrushGetOpacity: { TAlfTimedValue opacity; AlfTimedValueUtility::CopyTimedValue(iBrush->iOpacity, opacity); TPckg<TAlfTimedValue> resultPckg(opacity); aResponse = resultPckg; // awkward break; } case EAlfBrushSetOpacity: { TAlfTimedValue* opacity = (TAlfTimedValue*) aInputBuffer.Ptr() ; AlfTimedValueUtility::CopyTimedValue(*opacity, iBrush->iOpacity, iResolver); break; } case EAlfBrushSetLayer: { THuiBrushLayer* layer = (THuiBrushLayer*) aInputBuffer.Ptr() ; iBrush->SetLayer( *layer ); break; } case EAlfBrushClipToVisual: { TBool clip = iBrush->ClipToVisual(); TPckg<TBool> resultPckg(clip); aResponse = resultPckg; // awkward break; } case EAlfBrushSetClipToVisual: { TBool* clip = (TBool*) aInputBuffer.Ptr() ; iBrush->SetClipToVisual(*clip); break; } default: User::Leave(KErrNotSupported); } }
// ----------------------------------------------------------------------------- // ReadArrayFromStringL // Reads the array from the string // ----------------------------------------------------------------------------- // LOCAL_C void ReadArrayFromStringL( const TDesC8& aString, RPointerArray<HBufC8>& aArray ) { RMemReadStream inRead( static_cast<const TAny*>( aString.Ptr() ), aString.Size() ); TInt size = 0; HBufC8* addData = NULL; TPtr8 dataBuffer(NULL,0,0); CleanupClosePushL( inRead ); aArray.ResetAndDestroy(); for( TInt i = 0; i < aString.Size();) { // If there is not enough data to read the integer // it means that it's an old version and the whole thing is the // string since in previous versions only one string is stored if(( aString.Size() - i) < sizeof(TInt) ) { aArray.ResetAndDestroy(); addData = aString.AllocLC(); aArray.AppendL( addData ); CleanupStack::Pop(); CleanupStack::PopAndDestroy(); // inRead return; } size = inRead.ReadInt32L(); i += sizeof(TInt); // If the size is negative or the size left is not large enough // it means that it's an old version and the whole thing is the // string since in previous versions only one string is stored. if( size < 0 || size > ( aString.Size() - i ) ) { aArray.ResetAndDestroy(); addData = aString.AllocLC(); aArray.AppendL( addData ); CleanupStack::Pop(); CleanupStack::PopAndDestroy(); // inRead return; } addData = HBufC8::NewMaxLC( size ); // Set the read buffer: dataBuffer.Set(const_cast<TUint8*>(addData->Ptr()), 0, size); // Read the data: inRead.ReadL( dataBuffer ); aArray.AppendL( addData ); CleanupStack::Pop( addData ); i += size; } CleanupStack::PopAndDestroy(); return; }
/** Writes data from the specified descriptor into this stream buffer. This function is called by WriteL(const TDesC8&,TInt,TRequestStatus&). This implementation deals with the request synchronously, and completes the request with KErrNone. Other implementations may choose to deal with this in a true asynchronous manner. In addition, the write operation itself uses the DoWriteL(TAny*,TInt) variant. @param aDes The source descriptor for the data to be written into the stream buffer. @param aMaxLength The number of bytes to be written. This value must not be greater than the maximum length of the descriptor, otherwise the function raises a STORE-Stream 6 panic. @param aStatus The request status that indicates the completion status of this asynchronous request. @return The maximum number of bytes to be written, as used in this request. This implementation uses, and returns, the value supplied in aMaxLength. Other implementations may choose to use a different value. @see MStreamBuf::WriteL() */ EXPORT_C TInt MStreamBuf::DoWriteL(const TDesC8& aDes,TInt aMaxLength,TRequestStatus& aStatus) { __ASSERT_DEBUG(aMaxLength<=aDes.Length(),Panic(EStreamWriteBeyondEnd)); DoWriteL(aDes.Ptr(),aMaxLength); TRequestStatus* stat=&aStatus; User::RequestComplete(stat,KErrNone); return aMaxLength; }
/** Handles message between client and Twsgraphs test call. @param TDesc8 Descriptor values passed between client and plugin */ void CGraphicTestFrameRate::HandleMessage(const TDesC8& aData) { if (aData.Size()>1) { Mem::Copy(iCount, aData.Ptr(),(aData.Size())); } iCallBack.CallBack(); }
TPtrC8 CMD4Impl::Hash(const TDesC8& aMessage) { DoUpdate(aMessage.Ptr(),aMessage.Size()); StoreState(); DoFinal(); RestoreState(); return iHash; }
TUint CRFCommPortAttrib::GetUint(const TDesC8& aData) { switch(aData.Length()) { case 0: return 0; case 1: return aData[0]; case 2: return BigEndian::Get16(aData.Ptr()); case 4: return BigEndian::Get32(aData.Ptr()); default: //ParsePanic(EGetUintBadDescriptorLength); //FIXME return 0; } }
TInt CBulkOnlyTransport::SendDataTxCmdL(const MClientCommandServiceReq* aCommand, TDesC8& aData, TUint aPos, TInt& aLen) { __MSFNLOG TInt r = KErrNone; SendCbwL(aCommand, TBotCbw::EDataOut, aLen); TInt len = aLen; TInt length = 0; iBulkDataTd.SetZlpStatus(RUsbTransferDescriptor::ESuppressZlp); while (len) { TPtr8 senddata = iBulkDataTd.WritableBuffer(); senddata.Append(aData.Ptr() + length + aPos, len > KResponsePacketSize? KResponsePacketSize : len); iBulkDataTd.SaveData(senddata.Length()); iBulkPipeOut.Transfer(iBulkDataTd, iStatus); User::WaitForRequest(iStatus); if (iStatus.Int() != KErrNone) { if (iStatus.Int() == KErrUsbStalled) { __BOTPRINT(_L("SendDataTxCmdL ClearRemoteStall")); iBulkPipeOut.ClearRemoteStall(); #ifdef MASSSTORAGE_PUBLISHER TMsPublisher publisher(TMsPublisher::KStallProperty); #endif break; } DoResetRecovery(); __BOTPRINT1(_L("Usb transfer error %d"), r); User::Leave(KErrGeneral); } if(len > KResponsePacketSize) { len -= KResponsePacketSize; length += KResponsePacketSize; } else { length += len; len = 0; } } ReceiveCswL(); TUint32 lenSent = 0; r = ProcessOutTransferL(lenSent); aLen = lenSent; return r; }
TInt CTlsEncrypt::DecryptAndVerifyL(const TDesC8& aInput,HBufC8*& aOutput, TInt64& aSeqNumber, TRecordProtocol& aType) { if(!aInput.Length()) return KErrBadDescriptor; TLSPROV_LOG2(_L("Before Decryption...RecordType: %d"),(TInt)aType) TLSPROV_LOG_HEX(aInput.Ptr(),aInput.Size() ) TInt nAlloc = iCryptos.iDecryptor->MaxFinalOutputLength(aInput.Size()) + 24; if ( !aOutput || aOutput->Des().MaxLength() < nAlloc ) { delete aOutput; aOutput = NULL; aOutput = HBufC8::NewL( nAlloc ); } TPtr8 DecOutput = aOutput->Des(); DecOutput.Zero(); TRAP_IGNORE(iCryptos.iDecryptor->ProcessFinalL(aInput,DecOutput)); TUint HashSize = KSetOfTLSCipherSuites[iCipherIndex].iHashSize; if(DecOutput.Length() < HashSize) { return KErrSSLAlertDecryptError; } //set ptr to MAC TPtrC8 ReceivedMac = DecOutput.Mid(DecOutput.Length()-HashSize,HashSize); //& set length to trim MAC DecOutput.SetLength( DecOutput.Length()-HashSize ); TBuf8<64> CalculatedMac; ComputeMacL(CalculatedMac,DecOutput,ETrue,aSeqNumber,aType); TInt err = KErrBadMAC; if(ReceivedMac.Compare(CalculatedMac) == 0) { err = KErrNone; } else { TLSPROV_LOG(_L("Decryption: Received MAC error")) err = KErrSSLAlertBadRecordMac; } TLSPROV_LOG(_L("After Decryption , no mac")) TLSPROV_LOG_HEX(aOutput->Ptr(),aOutput->Size() ) return err; }
void CNav2Connect:: WriteBluetoothData(const TDesC8 &aBytes, TInt aLength ) { const TUint8* data = aBytes.Ptr(); TUint16 length = aBytes.Length(); if(iBtChannel!=NULL) iBtChannel->writeData( data, length ); }