TBool CLinePaginatorTest::ReadTestFile(TPageLine& aLine) { TLex8 lex; TBuf8<128> textBuffer; TBuf8<128> numBuffer; TInt startNum; iTestFile.Read(iFilePos,textBuffer,128); if (textBuffer.Locate('X') != KErrNotFound && textBuffer.Locate('X') < textBuffer.Locate('\r')) { startNum=textBuffer.Locate('\n')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iDocPos); TBuf<254> buf; buf.AppendFormat(_L("%d\tX\n"), aLine.iDocPos); TESTPRINT(buf); return EFalse; } startNum=textBuffer.Locate('\n')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iDocPos); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iLineHeight); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iKeepWithNext); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iStartNewPage); if (textBuffer.Locate('\t')<textBuffer.Locate('\r') && textBuffer.Locate('B')!=KErrNotFound && textBuffer.Locate('B')<textBuffer.Locate('\r')) iTestPageBreak=ETrue; else iTestPageBreak=EFalse; iFilePos+=textBuffer.Locate('\r')+1; return ETrue; }
/** * Convert a string to Hexadecimal * * @param aData String descriptor * @param aDes Descriptor where Hex value is stored * * @return N/A * * @leave System wide error */ void CT_DataVerify::ConvertString2HexL( const TDesC8& aData, TDes8& aDes ) { TBuf8<DataVerify::KCharlength> charBuf; // Check that buffer is even number if( ( aData.Length() % DataVerify::KCharlength ) != 0 ) { User::Leave( KErrBadDescriptor ); } // Go through the data and convert it two characters at a time // buffer overflow does not occur because buffer is checked to be even number first for( TInt i = 0, limit = aData.Length()-DataVerify::KCharlength; i <= limit; i+=DataVerify::KCharlength ) { // Clean char buffer first charBuf.Delete( 0, charBuf.Length() ); // Add KCharlength characters into buffer for ( TInt j = 0; j < DataVerify::KCharlength; j++ ) { charBuf.Append( aData[i+j] ); } TUint number; TLex8 converter = TLex8( charBuf ); // Two characters together represent a hex number in MD5 checksum User::LeaveIfError( converter.Val( number, EHex ) ); aDes.Append( number ); } }
void CLinePaginatorTest::OpenTestFileL() { TBuf8<128> text; TInt err=ifsClient.Connect(); err=iTestFile.Open(ifsClient,TEST_FILE,EFileStream|EFileRead|EFileShareReadersOnly); iTestFile.Read(0,text,128); TInt startNum=text.Locate('<')+1; text.Delete(0,startNum); TLex8 lex=text; TInt pageHeight; lex.Val(pageHeight); iPaginator.SetPageHeight(pageHeight); TBuf<254> buf; buf.AppendFormat(_L("DocPos\tHeight\tKeep\tStart\tHeight of Pages = <%d>\n"), pageHeight); TESTPRINT(buf); }
void CDummyCalendarApp::Add3ReminderAnd1ApptL() { test.Next(_L("Create some entries including day note and delete them")); //Create entries iEntries.ResetAndDestroy(); //create reminder 1 TBuf8<255> buf; buf.Append(_L("GuidId_Reminder_1")); HBufC8* guid = buf.AllocLC(); CCalEntry* reminder1 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0); CleanupStack::Pop(guid); iEntries.AppendL(reminder1); TCalTime starttime; starttime.SetTimeLocalL(TDateTime(2006, EMarch, 5, 0, 0, 0, 0)); reminder1->SetStartAndEndTimeL(starttime, starttime); TBuf<50> summary; RandomText(summary); reminder1->SetSummaryL(summary); //create reminder 2 buf.Delete(buf.Length()-1,1); buf.Append(2); guid = buf.AllocLC(); CCalEntry* reminder2 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0); CleanupStack::Pop(guid); iEntries.AppendL(reminder2); starttime.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0)); reminder2->SetStartAndEndTimeL(starttime, starttime); RandomText(summary); reminder2->SetSummaryL(summary); //create reminder 3 buf.Delete(buf.Length()-1,1); buf.Append(3); guid = buf.AllocLC(); CCalEntry* reminder3 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0); CleanupStack::Pop(guid); iEntries.AppendL(reminder3); starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 0, 0, 0, 0)); reminder3->SetStartAndEndTimeL(starttime, starttime); RandomText(summary); reminder3->SetSummaryL(summary); //Create appt buf.Zero(); buf.Append(_L("GuidId_Appt")); guid = buf.AllocLC(); CCalEntry* appt = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodAdd, 0); CleanupStack::Pop(guid); iEntries.AppendL(appt); starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 14, 0, 0, 0)); TTime endtimetime(TDateTime(2006, EMarch, 7, 14, 0, 0, 0)); endtimetime +=TTimeIntervalHours(1); TCalTime endtime; endtime.SetTimeLocalL(endtimetime); appt->SetStartAndEndTimeL(starttime, endtime); RandomText(summary); appt->SetSummaryL(summary); //store 4 entries TInt entriesStored(0); SynCGetEntryViewL().StoreL(iEntries, entriesStored); test(entriesStored == 4); iEntries.ResetAndDestroy(); }
void CRawIP2Flow::StartFlowL() /** * Starts the Flow up. This process involves connecting to the BCA. * * Called in response to corresponding SCPR message. * * @return Allways KErrNone */ { ASSERT(iStarting==EFalse); iStarting = ETrue; OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_STARTFLOWL_1, "CRawIP2Flow %08x:\tStartFlowL()", this); // If there were any errors during earlier processing of the ProvisionConfig message // then send an Error message in response to the StartFlow (because ProvisionConfig // does not have a response code). if (iProvisionError != KErrNone) { User::Leave(iProvisionError); } // Retrieve Agent provisioned information only available at StartFlow time DynamicProvisionConfigL(); InitialiseL(); // associate the binder object with the lowersender iBinder->SetSender(&(iBcaController->Bca()->GetSender())); //the name calculation should be done only if logging is enabled #if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) const TUint KModemNameLen = KCommsDbSvrMaxColumnNameLength + 10; // need enough for ppp-XXX.txt - e.g. ppp-comm-1.txt, ppp-btcomm-10.txt etc TBuf8<KModemNameLen> modemName; _LIT8(KDoubleColon, "::"); modemName.Copy(iBCAProvisionConfig->GetPortName()); const TInt pos = modemName.FindC((const TDesC8&)KDoubleColon); if(pos != KErrNotFound) { modemName.Delete(pos, 2); } //append time stamp const TUint KTimeStampLen = 8; TBuf8<KTimeStampLen> logFileName; _LIT8(KTimeFormat, "%08X"); TUint32 counter = User::FastCounter(); logFileName.Format(KTimeFormat, counter); const TUint KLogTextLen = KModemNameLen+KTimeStampLen+30; TBuf8<KLogTextLen> logText; _LIT8(KLogTimeText, "TcpDump log file time stamp:"); _LIT8(KLogModemText, " for modem:"); logText.Append(KLogTimeText); logText.Append(logFileName); logText.Append(KLogModemText); logText.Append(modemName); OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CRAWIP2FLOW_STARTFLOWL_3, logText); #endif }