loggingservices/rfilelogger/Logger/Src/Server.Cpp
branchRCL_3
changeset 11 667e88a979d7
parent 0 08ec8eefde2f
child 29 cce6680bbf1c
equal deleted inserted replaced
10:fa9941cf3867 11:667e88a979d7
   367 		// Filename 	- aFilename
   367 		// Filename 	- aFilename
   368 		// Linenumber 	- aLinenumber
   368 		// Linenumber 	- aLinenumber
   369 		// Text 		- aText
   369 		// Text 		- aText
   370 		
   370 		
   371 		// Start of string retrive/deformating 
   371 		// Start of string retrive/deformating 
   372 		HBufC8* pBuf1 = HBufC8::NewL(KMaxLoggerLineLength*2); //(aDes.Length()+200);
   372 		HBufC8* pBuf1 = HBufC8::New(KMaxLoggerLineLength*2); //(aDes.Length()+200);
   373 		if(!pBuf1)
   373 		if(!pBuf1)
   374 			{
   374 			{
   375 			return; // no memory 
   375 			return; // no memory 
   376 			}
   376 			}
   377 		TPtr8 aPtr(pBuf1->Des());  // used for searching
   377 		TPtr8 aPtr(pBuf1->Des());  // used for searching
   387 		for(TInt i = 1; i<6; i++)
   387 		for(TInt i = 1; i<6; i++)
   388 			{
   388 			{
   389 			SearchBuf.Set(aPtr.Mid(posI));
   389 			SearchBuf.Set(aPtr.Mid(posI));
   390 			aCount[i]=SearchBuf.Find(KSeperation8)+posI;
   390 			aCount[i]=SearchBuf.Find(KSeperation8)+posI;
   391 			posI=aCount[i]+3;
   391 			posI=aCount[i]+3;
   392 			if(aCount[i]<aCount[i-1])	return; // wrong format string from client
   392 			if(aCount[i]<aCount[i-1])	
       
   393         {
       
   394         delete pBuf1;
       
   395         return; // wrong format string from client
       
   396         }
   393 			}
   397 			}
   394 		// seperating common log message and extra log fields will be easy for future maintaince.
   398 		// seperating common log message and extra log fields will be easy for future maintaince.
   395 		TLogField8* alogField = new TLogField8[6];  // the common part of log message for both 
   399 		TLogField8* alogField = new TLogField8[6];  // the common part of log message for both 
   396 								  					// with and without extra log fields
   400 								  					// with and without extra log fields
   397 		if(!alogField) return; // no memory
   401 		if(!alogField) 
       
   402       {
       
   403       delete pBuf1;
       
   404       return; // no memory
       
   405       }
   398 
   406 
   399 		TLogField8* extralogField=NULL; // only applied to extra log fields
   407 		TLogField8* extralogField=NULL; // only applied to extra log fields
   400 
   408 
   401 		TInt alength=0;  // a length of array of extra log fields
   409 		TInt alength=0;  // a length of array of extra log fields
   402 
   410 
   429 			TInt err=lex.Val(alength); 
   437 			TInt err=lex.Val(alength); 
   430 			if (err)	alength=0; // ignor the extra log fields. Let the log go
   438 			if (err)	alength=0; // ignor the extra log fields. Let the log go
   431 
   439 
   432 			// Retrive the extra log fields
   440 			// Retrive the extra log fields
   433 			extralogField = new TLogField8[alength];
   441 			extralogField = new TLogField8[alength];
   434 			if(!extralogField) return; // no memory
   442 			if(!extralogField)
       
   443         {
       
   444         delete pBuf1; 
       
   445         return; // no memory
       
   446         }
   435 			for(TInt i=0; i<alength; i++)
   447 			for(TInt i=0; i<alength; i++)
   436 				{
   448 				{
   437 				aCount[6]=aCount[7]+2;
   449 				aCount[6]=aCount[7]+2;
   438 				SearchBuf.Set(aPtr.Mid(aCount[6]));
   450 				SearchBuf.Set(aPtr.Mid(aCount[6]));
   439 				aCount[7]=SearchBuf.Find(_L8("\t"))+aCount[6];
   451 				aCount[7]=SearchBuf.Find(_L8("\t"))+aCount[6];