diff src/ui/bmi/mmiBookServices.c @ 142:ec9f955fc487

mmiBook*.c: bogotab fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 Nov 2020 08:43:59 +0000
parents c0052fe355d3
children
line wrap: on
line diff
--- a/src/ui/bmi/mmiBookServices.c	Sat Nov 14 04:29:03 2020 +0000
+++ b/src/ui/bmi/mmiBookServices.c	Sat Nov 14 08:43:59 2020 +0000
@@ -11,12 +11,12 @@
 
  $Project name: Basic MMI
  $Project code: BMI (6349)
- $Module:   PhoneBook
- $File:       MmiBookServices.c
- $Revision:   1.0
+ $Module:       PhoneBook
+ $File:         MmiBookServices.c
+ $Revision:     1.0
 
- $Author:   Condat(UK)
- $Date:       25/10/00
+ $Author:       Condat(UK)
+ $Date:         25/10/00
 
 ********************************************************************************
 
@@ -29,59 +29,59 @@
  $History: MmiBookServices.c
 
        Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat)
-	Bug:PhoneBook: Wrong confirmation message in Phonebook storage when copying/moving a contact
-	                         after adding one or making a change
- 	Fix: ACI shall not send rAT_OK for entry addition / entry change operations in Internal PHB
- 	      Hence, the "addname_flag" and "changename_flag" are immdtly reset incase of Internal PHB
+    Bug:PhoneBook: Wrong confirmation message in Phonebook storage when copying/moving a contact
+                             after adding one or making a change
+    Fix: ACI shall not send rAT_OK for entry addition / entry change operations in Internal PHB
+          Hence, the "addname_flag" and "changename_flag" are immdtly reset incase of Internal PHB
 
     June 22, 2006    REF: DRT OMAPS00081761  x0012849 : Jagannatha
     Description:Handset crash when adding new entry with more then 20 digits to phonebook SIM card
     Solution: Number editor will be restricted to 20 characters when EXT1 is not supported.
 
        June 14, 2006 REF: OMAPS00079308  x0039928
-	Bug:Validation and Optimization of Memory consumption
- 	Fix: Memory optimization is done in bookFindNameInSpecificPhonebook to save around 450 bytes of memory.
+    Bug:Validation and Optimization of Memory consumption
+    Fix: Memory optimization is done in bookFindNameInSpecificPhonebook to save around 450 bytes of memory.
 
     May 29, 2006 DR: OMAPS00079431 - xreddymn
     Description: Name field is not limited to 14 bytes in case of SIM phonebook.
     Solution: In bookInputStartNameEditor, limit the number of characters after
     checking if SIM or ME phonebook is being used.
 
-	Jan 22, 2006 REF: OMAPS00061930  x0039928
-	Bug:PhoneBook -Change entry and view entry through Change option-failed
- 	Fix: Phonebook is populated with phone numbers after some time and not immediately while saving the changed entries.
+    Jan 22, 2006 REF: OMAPS00061930  x0039928
+    Bug:PhoneBook -Change entry and view entry through Change option-failed
+    Fix: Phonebook is populated with phone numbers after some time and not immediately while saving the changed entries.
 
-     	June 07,  2005   REF: CRR MMI-FIX-31545 x0021334
-    	Issue description: SIM: wrong behavior when FDN is not allocated in SST
-   	Solution: Before displaying the FDN options, a check is made if FDN is allocated. Only if
-                  	FDN is allocated, the options are displayed.
+        June 07,  2005   REF: CRR MMI-FIX-31545 x0021334
+        Issue description: SIM: wrong behavior when FDN is not allocated in SST
+    Solution: Before displaying the FDN options, a check is made if FDN is allocated. Only if
+                    FDN is allocated, the options are displayed.
 
-  	Sep 29, 2004        REF: CRR 25041  xvilliva
-	Bug:		add new entry in the FDN , phone gets rebooted.
-	Fix:		The bookMenuStart() is called with the window data->phbk->win,
-			similar to the function bookFDNMenu() to avoid crash. The menu
-			window thus created is stored, which will be deleted while
-			phonebook menu is destroyed.
+    Sep 29, 2004        REF: CRR 25041  xvilliva
+    Bug:        add new entry in the FDN , phone gets rebooted.
+    Fix:        The bookMenuStart() is called with the window data->phbk->win,
+            similar to the function bookFDNMenu() to avoid crash. The menu
+            window thus created is stored, which will be deleted while
+            phonebook menu is destroyed.
 
-	Jul 29, 2004        REF: CRR 20888  Deepa M.D
-	Bug:Message received not showing with name, name stored in phonebook
-	Fix:Memset the structure(p_pszNumberText.data) to 0 and then memcpy.
+    Jul 29, 2004        REF: CRR 20888  Deepa M.D
+    Bug:Message received not showing with name, name stored in phonebook
+    Fix:Memset the structure(p_pszNumberText.data) to 0 and then memcpy.
 
- 	Jul 28, 2004       	REF: CRR:20887 xrashmic - SASKEN
-	Description: Current state of FDN not highlighted
-	Fix: Instead of showing the submenu directly we call this function
-	where we set the menu and also higlight the previously selected menu item
+    Jul 28, 2004        REF: CRR:20887 xrashmic - SASKEN
+    Description: Current state of FDN not highlighted
+    Fix: Instead of showing the submenu directly we call this function
+    where we set the menu and also higlight the previously selected menu item
 
-  	June 25, 2004        REF: CRR 21547  xvilliva
-	Bug:	Taking blank entries in phonebook if select book is either SIM or Phone.
-	Fix:	 We check for presence of either phone number or name before add/modify.
+    June 25, 2004        REF: CRR 21547  xvilliva
+    Bug:    Taking blank entries in phonebook if select book is either SIM or Phone.
+    Fix:     We check for presence of either phone number or name before add/modify.
 
- 	Jun 23, 2004        	REF: CRR MMI-SPR-21636  Rashmi C N(Sasken)
-	Description:		The confirmation for deleting entry from address book was a timed confirmation
-  					screen.
-  	Solution:			Now the time is set to 'FOREVER' from 'TEN_SECS'
+    Jun 23, 2004            REF: CRR MMI-SPR-21636  Rashmi C N(Sasken)
+    Description:        The confirmation for deleting entry from address book was a timed confirmation
+                    screen.
+    Solution:           Now the time is set to 'FOREVER' from 'TEN_SECS'
 
-	Issue Number : SPR#12722 on 29/03/04 by Deepa M.D
+    Issue Number : SPR#12722 on 29/03/04 by Deepa M.D
 
 
   25/10/00      Original Condat(UK) BMI version.
@@ -92,7 +92,6 @@
 
 
 
-
 /*******************************************************************************
 
                                 Include Files
@@ -143,13 +142,13 @@
 #include "mfw_mme.h"
 #include "mfw_sat.h"
 #include "mfw_sms.h"
-#include "mfw_cnvt.h"	//GW Added for 'mfw_SIM2GsmStr'
+#include "mfw_cnvt.h"   //GW Added for 'mfw_SIM2GsmStr'
 
 #include "dspl.h"
 
 #include "ksd.h"
 #include "psa.h"
-#include "psa_sim.h" 	// June 07,  2005	REF: CRR MMI-FIX-31545 x0021334
+#include "psa_sim.h"    // June 07,  2005   REF: CRR MMI-FIX-31545 x0021334
 
 #include "MmiMain.h"
 #include "MmiBookController.h"
@@ -158,7 +157,6 @@
 #include "MmiLists.h"
 
 
-
 #include "MmiMenu.h"
 #include "mmiCall.h"
 #include "Mmiicons.h"
@@ -218,7 +216,7 @@
 # define PB_MAX_FIND_ENTRIES   4
 #endif
 
-// Jul 28, 2004       	REF: CRR:20887 xrashmic - SASKEN
+// Jul 28, 2004         REF: CRR:20887 xrashmic - SASKEN
 
 #define FIRSTMENUITEM 0
 #define SECONDMENUITEM 1
@@ -264,7 +262,7 @@
     tBookStandard   *data       = (tBookStandard *) win_data->user;
     T_phbk          *Phbk       = data->phbk;
 
-	TRACE_EVENT_P1("bookDeleteEntryCB index %d", Phbk->current.entry[Phbk->current.selectedName].index);
+    TRACE_EVENT_P1("bookDeleteEntryCB index %d", Phbk->current.entry[Phbk->current.selectedName].index);
 
     /* This call back is invoked from the delete entry dialog confirmation
        screen, and will only respond to the left key (OK) being selected.
@@ -274,7 +272,7 @@
     case INFO_KCD_LEFT:
         {
       if  (( Phbk->current.status.book == PHB_UPN) ||
-      			(Phbk->current.status.book == PHB_FDN ))
+                (Phbk->current.status.book == PHB_FDN ))
             deleteFromFile( Phbk, Phbk->current.status.book );
       else
         deleteFromFile( Phbk, bookActiveBook(WRITE) );
@@ -297,12 +295,6 @@
 }
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
                                 Public Methods
@@ -310,12 +302,6 @@
 *******************************************************************************/
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookInitialise
@@ -335,7 +321,7 @@
 
   /* SPR#1112 - SH - Added E_PHB_READY and E_PHB_BUSY */
   phb  = phb_create( 0, (MfwEvt) (E_PHB_UPN_LIST | E_PHB_ERROR | E_PHB_STATUS
-  	| E_PHB_READY | E_PHB_BUSY), (MfwCb) bookEvent );
+    | E_PHB_READY | E_PHB_BUSY), (MfwCb) bookEvent );
 
 }
 
@@ -357,109 +343,107 @@
 
 void bookInitInternal( void )
 {
-	UBYTE intphonebook;
-	T_MFW ret;
+    UBYTE intphonebook;
+    T_MFW ret;
 
-	ret = GI_pb_GetPhonebook(&intphonebook);
+    ret = GI_pb_GetPhonebook(&intphonebook);
 
-	if (ret==MFW_PHB_OK)
-	{
-		bookSetBookAvailable(TRUE);
-		GI_pb_Initialise();
-		if (intphonebook)
-		{
-			bookSetBookSelected(TRUE);
-		}
-		else
-			bookSetBookSelected(FALSE);
-	}
-	else
-		bookSetBookAvailable(FALSE);
+    if (ret==MFW_PHB_OK)
+    {
+        bookSetBookAvailable(TRUE);
+        GI_pb_Initialise();
+        if (intphonebook)
+        {
+            bookSetBookSelected(TRUE);
+        }
+        else
+            bookSetBookSelected(FALSE);
+    }
+    else
+        bookSetBookAvailable(FALSE);
 
-	return;
+    return;
 }
 
 
 /*******************************************************************************
 
- $Function:		bookGetBookSelected
+ $Function:     bookGetBookSelected
 
- $Description:	Is the internal phonebook selected?
+ $Description:  Is the internal phonebook selected?
 
- $Returns:		TRUE if internal phonebook is selected, FALSE otherwise
+ $Returns:      TRUE if internal phonebook is selected, FALSE otherwise
 
- $Arguments:	none
+ $Arguments:    none
 
 *******************************************************************************/
 
 BOOL bookGetBookSelected()
 {
-	return ipbBookSelected;
+    return ipbBookSelected;
 }
 
 
 /*******************************************************************************
 
- $Function:		bookSetBookSelected
+ $Function:     bookSetBookSelected
 
- $Description:	Select or deselect the internal phonebook
+ $Description:  Select or deselect the internal phonebook
 
- $Returns:		None.
+ $Returns:      None.
 
- $Arguments:	TRUE to select internal phonebook, FALSE to select SIM phonebook
+ $Arguments:    TRUE to select internal phonebook, FALSE to select SIM phonebook
 
 *******************************************************************************/
 
 void bookSetBookSelected(UBYTE bookSelected)
 {
-	ipbBookSelected = bookSelected;
+    ipbBookSelected = bookSelected;
 
-	return;
+    return;
 }
 
 
 /*******************************************************************************
 
- $Function:		bookGetBookAvailable
+ $Function:     bookGetBookAvailable
 
- $Description:	Is the internal phonebook available for use?
+ $Description:  Is the internal phonebook available for use?
 
- $Returns:		TRUE if internal phonebook is available, FALSE otherwise
+ $Returns:      TRUE if internal phonebook is available, FALSE otherwise
 
- $Arguments:	none
+ $Arguments:    none
 
 *******************************************************************************/
 
 BOOL bookGetBookAvailable()
 {
-	return ipbBookAvailable;
+    return ipbBookAvailable;
 }
 
 
 /*******************************************************************************
 
- $Function:		bookSetBookAvailable
+ $Function:     bookSetBookAvailable
 
- $Description:	Indicate whether or not the internal phonebook is available for use
+ $Description:  Indicate whether or not the internal phonebook is available for use
 
- $Returns:		None.
+ $Returns:      None.
 
- $Arguments:	TRUE to if internal phonebook is available, FALSE otherwise
+ $Arguments:    TRUE to if internal phonebook is available, FALSE otherwise
 
 *******************************************************************************/
 
 void bookSetBookAvailable(UBYTE bookAvailable)
 {
-	ipbBookAvailable = bookAvailable;
+    ipbBookAvailable = bookAvailable;
 
-	return;
+    return;
 }
 
 #endif
 
 
-
-
 /*******************************************************************************
 
  $Function:     bookExit
@@ -476,26 +460,20 @@
 void bookExit( void )
 {
     TRACE_FUNCTION( "bookExit()" );
-	phb_delete( phb );
-	/* SPR#1112 - SH - Now redundant */
+    phb_delete( phb );
+    /* SPR#1112 - SH - Now redundant */
    // bookDeletePhoneBook();
 
 /* SPR#1112 - SH - Exit internal phonebook if activated */
 #ifdef INT_PHONEBOOK
-	if (bookGetBookAvailable())
-		GI_pb_Exit();
+    if (bookGetBookAvailable())
+        GI_pb_Exit();
 #endif
 
-	return;
+    return;
 }
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookAddName
@@ -519,7 +497,7 @@
 
 
 /*MC SPR 1257, name strings should use MAX_ALPHA_LEN*/
-  memset( Phbk->edt_buf_name,   0,      MAX_ALPHA_LEN );
+    memset( Phbk->edt_buf_name,   0,      MAX_ALPHA_LEN );
     memcpy( Phbk->edt_buf_number, (char*)number,    PHB_MAX_LEN );
 
     /* Populate the input specifier structure and use it to
@@ -532,12 +510,6 @@
 }
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookShowInformation
@@ -558,7 +530,7 @@
 
     TRACE_FUNCTION( "bookShowInformation()" );
 
-	dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, txtId, TxtNull, COLOUR_BOOK_POPUP);
+    dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, txtId, TxtNull, COLOUR_BOOK_POPUP);
     dlg_initDisplayData_events( &display_info, (T_VOID_FUNC) cb_function, THREE_SECS, KEY_CLEAR );
     display_info.TextString   = text;
 
@@ -584,7 +556,7 @@
 *******************************************************************************/
 
 T_MFW_HND bookShowInfoScreen( MfwHnd parent, int txtId1, int txtId2, T_VOID_FUNC cb_function,
-	USHORT Identifier, ULONG Time)
+    USHORT Identifier, ULONG Time)
 {
     T_DISPLAY_DATA display_info;
 
@@ -593,7 +565,7 @@
     dlg_initDisplayData_TextId(&display_info, TxtNull, TxtNull, txtId1, txtId2, COLOUR_BOOK_POPUP);
     dlg_initDisplayData_events(&display_info, (T_VOID_FUNC)cb_function, Time, KEY_CLEAR);
 
-    display_info.Identifier	= Identifier;
+    display_info.Identifier = Identifier;
 
     /* Call Info Screen
     */
@@ -629,8 +601,6 @@
     int firstNotMatch=0;
 
 
-
-
     TRACE_FUNCTION("bookFindIndexMatchPB()");
 
 #ifdef TRACE_PB_DEBUG
@@ -712,17 +682,14 @@
 }
 
 
-
-
-
 /*******************************************************************************
 
  $Function:     bookFindNameInPhonebook
 
  $Description:  SPR#1112 - Modified function to search in alternate phonebook.
- 			  Locates the name in the current phonebook.  If the current phonebook is
- 			  the internal phonebook and no result is found, the SIM phonebook is also
- 			  searched.
+              Locates the name in the current phonebook.  If the current phonebook is
+              the internal phonebook and no result is found, the SIM phonebook is also
+              searched.
 
  $Returns:      0 if error, 1 if successful
 
@@ -751,9 +718,9 @@
 
   if (!result && bookGetBookAvailable() && bookGetBookSelected())
   {
-  	bookSetBookSelected(FALSE);
-  	result = bookFindNameInSpecificPhonebook(p_pszNumber, p_pEntry);
-  	bookSetBookSelected(TRUE);
+    bookSetBookSelected(FALSE);
+    result = bookFindNameInSpecificPhonebook(p_pszNumber, p_pEntry);
+    bookSetBookSelected(TRUE);
   }
   #endif
 
@@ -766,7 +733,7 @@
  $Function:     bookFindNameInSpecificPhonebook
 
  $Description:  Locates the name in a specified phone book
-			  SPR#1112 - SH - Separate this part of function, so we can call it twice
+              SPR#1112 - SH - Separate this part of function, so we can call it twice
  $Returns:      0 if error, 1 if successful
 
  $Arguments:  p_pszNumber, pointer to pattern to match, p_pEntry, pointer
@@ -779,7 +746,7 @@
 int bookFindNameInSpecificPhonebook( const char *p_pszNumber, T_MFW_PHB_ENTRY *p_pEntry )
 {
 #ifdef NO_ASCIIZ
-	T_MFW_PHB_TEXT p_pszNumberText;
+    T_MFW_PHB_TEXT p_pszNumberText;
 #endif
 
   T_MFW_PHB_LIST  phb_list;    //, new_list;  // RAVI
@@ -807,7 +774,7 @@
     return (0);
 
   if (strlen(p_pszNumber) < 1)
-	return (0);
+    return (0);
 
   memset( p_pEntry,  0, sizeof(T_MFW_PHB_ENTRY) );
   memset( &phb_list, 0, sizeof(phb_list) );
@@ -834,29 +801,29 @@
   memcpy( (char*)p_pszNumberText.data, p_pszNumber , p_pszNumberText.len );
 
   ret = phb_find_entries(
-	  bookActiveBook(READ),   /* phonebook                */
-	  &phb_index,				/* returns index in phb     */
-	  MFW_PHB_NUMBER,			/* searching for number     */
-	  PB_MAX_FIND_ENTRIES,						/* return max. four entry    */
-	  &p_pszNumberText,  /* search this pattern      */
-	  &phb_list				/* return structure         */
-	  );
+      bookActiveBook(READ),   /* phonebook                */
+      &phb_index,               /* returns index in phb     */
+      MFW_PHB_NUMBER,           /* searching for number     */
+      PB_MAX_FIND_ENTRIES,                      /* return max. four entry    */
+      &p_pszNumberText,  /* search this pattern      */
+      &phb_list             /* return structure         */
+      );
 
 #else
   ret = phb_find_entries(
-	  bookActiveBook(READ),   /* phonebook                */
-	  &phb_index,				/* returns index in phb     */
-	  MFW_PHB_NUMBER,			/* searching for number     */
-	  PB_MAX_FIND_ENTRIES,						/* return max. four entry    */
-	  (char *)p_pszNumber,  /* search this pattern      */
-	  &phb_list       /* return structure         */
-	  );
+      bookActiveBook(READ),   /* phonebook                */
+      &phb_index,               /* returns index in phb     */
+      MFW_PHB_NUMBER,           /* searching for number     */
+      PB_MAX_FIND_ENTRIES,                      /* return max. four entry    */
+      (char *)p_pszNumber,  /* search this pattern      */
+      &phb_list       /* return structure         */
+      );
 #endif //NO_ASCIIZ
 
     //Check return from phb_find_entries
     if (ret == MFW_PHB_FAIL)
     {
-		return (0);
+        return (0);
     }
 
 
@@ -886,52 +853,52 @@
 
     /* Convert name into appropriate format */
 #ifdef NO_ASCIIZ
-	/*MC SPR 1319*/
+    /*MC SPR 1319*/
 #ifdef EASY_TEXT_ENABLED
 #ifndef FF_MMI_PB_OPTIM
-	for (k=0;k<p_pEntry->name.len; k++)
-	{
-	    if (p_pEntry->name.data[k]==0 )
-	    {
-		  debug[k] = '0';
-	    }
-	    else
-	    {
-	        debug[k] = p_pEntry->name.data[k];
-	    }
-	}
-	TRACE_EVENT_P1("BFNIP: %s ", debug);
+    for (k=0;k<p_pEntry->name.len; k++)
+    {
+        if (p_pEntry->name.data[k]==0 )
+        {
+          debug[k] = '0';
+        }
+        else
+        {
+            debug[k] = p_pEntry->name.data[k];
+        }
+    }
+    TRACE_EVENT_P1("BFNIP: %s ", debug);
 #endif
 
-	/*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
-	if (p_pEntry->name.data[0] == 0x80) /* Unicode 0x80 style */
-	{
-	       /*MC, removed var "actual_length*/
-		int i;
+    /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
+    if (p_pEntry->name.data[0] == 0x80) /* Unicode 0x80 style */
+    {
+           /*MC, removed var "actual_length*/
+        int i;
              for (i=1; i<MAX_ALPHA_LEN; i+=1)
-        	{
-        		l_name[i+1] = p_pEntry->name.data[i];
+            {
+                l_name[i+1] = p_pEntry->name.data[i];
 
-        	}
-	       l_name[0] =	p_pEntry->name.data[0];
-	       l_name[1] = MAX_ALPHA_LEN;
+            }
+           l_name[0] =  p_pEntry->name.data[0];
+           l_name[1] = MAX_ALPHA_LEN;
 
-		memcpy( p_pEntry->name.data, (char*)l_name, MAX_ALPHA_LEN );
+        memcpy( p_pEntry->name.data, (char*)l_name, MAX_ALPHA_LEN );
 
-	      if (p_pEntry->name.len%2 == 1)/*if length of string odd*/
-	      {
-   		    p_pEntry->name.len++; /*MC we have to increase the length by one as we've shifted the string up*/
-	      }
+          if (p_pEntry->name.len%2 == 1)/*if length of string odd*/
+          {
+            p_pEntry->name.len++; /*MC we have to increase the length by one as we've shifted the string up*/
+          }
 
-   	      /*MC, ensure all the chars in the string after string length are 0*/
-  	     for (i=p_pEntry->name.len; i<MAX_ALPHA_LEN; i++)
-  	     {
-   	          p_pEntry->name.data[i]= 0;
-  	     }
+          /*MC, ensure all the chars in the string after string length are 0*/
+         for (i=p_pEntry->name.len; i<MAX_ALPHA_LEN; i++)
+         {
+              p_pEntry->name.data[i]= 0;
+         }
 
 #ifndef FF_MMI_PB_OPTIM
-	     for (k=0;k<p_pEntry->name.len; k++)
-	     {
+         for (k=0;k<p_pEntry->name.len; k++)
+         {
                 if (p_pEntry->name.data[k]==0 )
                 {
                     debug[k] = '0';
@@ -940,57 +907,55 @@
                 {
                     debug[k] = p_pEntry->name.data[k];
                 }
-	     }
+         }
 
             TRACE_EVENT_P1("BNFIP conv: %s", debug);
 
-	      sprintf(debug, "Length of phonebook entry:%d", p_pEntry->name.len);
+          sprintf(debug, "Length of phonebook entry:%d", p_pEntry->name.len);
 #endif
 
-	}
+    }
        else
 #endif /* EASY_TEXT_ENABLED */
-	/* Marcus: Issue 963: 11/09/2002: Start */
-	{
-	    /*
-	     * bookGsm2Alpha requires ASCIIZ string - make sure it is.
-	     * This also will help calling functions that may assume ASCIIZ.
-	     */
-	    if (sizeof(p_pEntry->name.data) > p_pEntry->name.len)
-	    {
-	        p_pEntry->name.data[p_pEntry->name.len] = '\0';
-	    }
+    /* Marcus: Issue 963: 11/09/2002: Start */
+    {
+        /*
+         * bookGsm2Alpha requires ASCIIZ string - make sure it is.
+         * This also will help calling functions that may assume ASCIIZ.
+         */
+        if (sizeof(p_pEntry->name.data) > p_pEntry->name.len)
+        {
+            p_pEntry->name.data[p_pEntry->name.len] = '\0';
+        }
 /*SPR2175, use new function to convert from GSM to ASCII*/
-		{
+        {
 
-			TRACE_EVENT_P1("Converting name from 8-bit to ASCII, dcs: %d", p_pEntry->name.dcs);
-			ATB_convert_String((char*)p_pEntry->name.data, MFW_DCS_8bits, p_pEntry->name.len, (char*)l_name, MFW_ASCII, MAX_ALPHA_LEN, FALSE);
-	    	p_pEntry->name.dcs = MFW_ASCII;
-	    	memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN);
-	    }
+            TRACE_EVENT_P1("Converting name from 8-bit to ASCII, dcs: %d", p_pEntry->name.dcs);
+            ATB_convert_String((char*)p_pEntry->name.data, MFW_DCS_8bits, p_pEntry->name.len, (char*)l_name, MFW_ASCII, MAX_ALPHA_LEN, FALSE);
+            p_pEntry->name.dcs = MFW_ASCII;
+            memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN);
+        }
 
-	}
-	/* Marcus: Issue 963: 11/09/2002: End */
+    }
+    /* Marcus: Issue 963: 11/09/2002: End */
 /*MC end*/
 #else
-  	bookGsm2Alpha( (UBYTE *) p_pEntry->name );
+    bookGsm2Alpha( (UBYTE *) p_pEntry->name );
 #endif /* NO_ASCIIZ */
 
   return (1);
 }
 
 
-
-
 /*******************************************************************************
 
- $Function:    	bookFindNumberByPosition
+ $Function:     bookFindNumberByPosition
 
- $Description:	locate a number given the index
+ $Description:  locate a number given the index
 
- $Returns:		0 if failure, 1 otherwise
+ $Returns:      0 if failure, 1 otherwise
 
- $Arguments:	index of the number to find, p_pentry, return structure
+ $Arguments:    index of the number to find, p_pentry, return structure
 
 *******************************************************************************/
 
@@ -1027,34 +992,34 @@
     */
 #ifdef NO_ASCIIZ
 
-	{
-	#ifdef EASY_TEXT_ENABLED
-		/*MC SPR 1257, name strings should use MAX_ALPHA_LEN*/
-		int i;
-		if (p_pEntry->name.data[0] == 0x80 ||p_pEntry->name.data[0]== 0x00)
-			{	for (i=1; i<MAX_ALPHA_LEN; i+=1)
-				{
-					l_name[i+1] = p_pEntry->name.data[i];
+    {
+    #ifdef EASY_TEXT_ENABLED
+        /*MC SPR 1257, name strings should use MAX_ALPHA_LEN*/
+        int i;
+        if (p_pEntry->name.data[0] == 0x80 ||p_pEntry->name.data[0]== 0x00)
+            {   for (i=1; i<MAX_ALPHA_LEN; i+=1)
+                {
+                    l_name[i+1] = p_pEntry->name.data[i];
 
-				}
-	       	 	l_name[0] =	p_pEntry->name.data[0];
-	       		l_name[1] = MAX_ALPHA_LEN;
+                }
+                l_name[0] = p_pEntry->name.data[0];
+                l_name[1] = MAX_ALPHA_LEN;
 
-				memcpy( p_pEntry->name.data, (char*)l_name, MAX_ALPHA_LEN );
+                memcpy( p_pEntry->name.data, (char*)l_name, MAX_ALPHA_LEN );
 
-   		 		p_pEntry->name.len++;/* = actual_length;*/
+                p_pEntry->name.len++;/* = actual_length;*/
 
-			}
-		else
-	#endif
+            }
+        else
+    #endif
 
-	/*SPR2175, use new function to convert from GSM to ASCII*/
-	if (p_pEntry->name.dcs == MFW_DCS_8bits && p_pEntry->name.data[0] != 0x80)
-	{
-		ATB_convert_String((char*)p_pEntry->name.data, MFW_DCS_8bits, p_pEntry->name.len, (char*)l_name, MFW_ASCII, MAX_ALPHA_LEN, FALSE);
-		p_pEntry->name.dcs = MFW_ASCII;
-		memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN);
-	}
+    /*SPR2175, use new function to convert from GSM to ASCII*/
+    if (p_pEntry->name.dcs == MFW_DCS_8bits && p_pEntry->name.data[0] != 0x80)
+    {
+        ATB_convert_String((char*)p_pEntry->name.data, MFW_DCS_8bits, p_pEntry->name.len, (char*)l_name, MFW_ASCII, MAX_ALPHA_LEN, FALSE);
+        p_pEntry->name.dcs = MFW_ASCII;
+        memcpy(p_pEntry->name.data, l_name, MAX_ALPHA_LEN);
+    }
 }
 #else
 
@@ -1069,12 +1034,6 @@
 }
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookCallIndex
@@ -1106,15 +1065,6 @@
 }
 
 
-
-
-
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookGsm2Alpha
@@ -1148,8 +1098,6 @@
 }
 
 
-
-
 /*******************************************************************************
 
  $Function:     bookActiveBook
@@ -1168,30 +1116,29 @@
 
 /* SPR#1112 - SH - Return internal phonebook ID when appropriate */
 // May 3, 2004        REF: CRR MMI-SPR-18555  Rashmi C N(Sasken)
-//	To get FDN book, when FDN is disabled, but only when accessing from FDM menu and not while we are in active call
+//  To get FDN book, when FDN is disabled, but only when accessing from FDM menu and not while we are in active call
 
-	if(menuFDN && (call_data.calls.numCalls==0))
-	{
-		return  PHB_FDN;
-	}
+    if(menuFDN && (call_data.calls.numCalls==0))
+    {
+        return  PHB_FDN;
+    }
 
 #ifdef INT_PHONEBOOK
   if (bookGetBookAvailable() && bookGetBookSelected())
-  	return PHB_IPB;
+    return PHB_IPB;
 #endif
 // May 3, 2004        REF: CRR MMI-SPR-18555  Rashmi C N(Sasken)
-//	When FDN is disabled we need to display only ADN entries in the phonebook menu.
-//	We now return PHB_ADN instead of PHB_ADN_FDN.
+//  When FDN is disabled we need to display only ADN entries in the phonebook menu.
+//  We now return PHB_ADN instead of PHB_ADN_FDN.
 
   if(process == READ)
     return ( phb_get_mode() == PHB_RESTRICTED ) ? PHB_FDN : PHB_ADN;
   else if(process == WRITE)
-  	return ( phb_get_mode() == PHB_RESTRICTED ) ? PHB_FDN : PHB_ADN;
+    return ( phb_get_mode() == PHB_RESTRICTED ) ? PHB_FDN : PHB_ADN;
   return PHB_NONE; /*a0393213 warnings removal-added return statement*/
 }
 
 
-
 /*******************************************************************************
 
  $Function:     bookMemoryView
@@ -1209,8 +1156,8 @@
     T_MFW_HND       win         = mfwParent( mfw_header() );
     T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
     tBookStandard   *data       = (tBookStandard *) win_data->user;
-  char            Buffer[16];
-  int TxtToShow;
+    char            Buffer[16];
+    int TxtToShow;
 
 
     /* Determine which book we are currently using
@@ -1220,17 +1167,17 @@
     /* retrieve he status of the book, and create a string for output
        based on the status
     */
-   #if(BOARD!=61)
+    #if(BOARD!=61)
       Buffer[0] = '\0';   // OMAPS00042166 - RAVI /*a0393213 warnings removal-== changed to =*/
     #endif
     if ( bookGetCurrentStatus( &data->phbk->current.status ) == MFW_PHB_OK )
   {
   /* SPR#1112 - Internal phonebook - show the current selected phonebook*/
 #ifdef INT_PHONEBOOK
-	if (bookGetBookAvailable() && bookGetBookSelected())
-		TxtToShow = TxtPhone;
-	else
-		TxtToShow = TxtSIM;
+    if (bookGetBookAvailable() && bookGetBookSelected())
+        TxtToShow = TxtPhone;
+    else
+        TxtToShow = TxtSIM;
 #else
     TxtToShow = TxtUsed;
 #endif
@@ -1242,27 +1189,21 @@
     TxtToShow = TxtReadError;
 
 
-	{
-	    T_DISPLAY_DATA display_info;
+    {
+        T_DISPLAY_DATA display_info;
 
-		dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtToShow, TxtNull , COLOUR_STATUS);
-		dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR );
-	    display_info.TextString2  = Buffer;
+        dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtToShow, TxtNull , COLOUR_STATUS);
+        dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR );
+        display_info.TextString2  = Buffer;
 
-	    /* Call Info Screen
-	    */
-	    info_dialog( win, &display_info );
-	}
+        /* Call Info Screen
+        */
+        info_dialog( win, &display_info );
+    }
 
 }
 
 
-
-
-
-
-
-
 /*******************************************************************************
 
  $Function:     bookDeleteEntry
@@ -1284,43 +1225,43 @@
 
     /* Initialise the dialog control block with default information
   */
-	dlg_initDisplayData_TextId( &Dialog, TxtSoftOK, TxtCancel, TxtPressOk, TxtDelete, COLOUR_STATUS);
+    dlg_initDisplayData_TextId( &Dialog, TxtSoftOK, TxtCancel, TxtPressOk, TxtDelete, COLOUR_STATUS);
 
-//  	Jun 23, 2004        	REF: CRR MMI-SPR-21636  Rashmi C N(Sasken)
-//	Description:		The confirmation for deleting entry from address book was a timed confirmation
-//  					screen.
-// 	Solution:			Now the time is set to 'FOREVER' from 'TEN_SECS'
-	dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)bookDeleteEntryCB, FOREVER, KEY_CLEAR | KEY_LEFT | KEY_RIGHT );
+//      Jun 23, 2004            REF: CRR MMI-SPR-21636  Rashmi C N(Sasken)
+//  Description:        The confirmation for deleting entry from address book was a timed confirmation
+//                      screen.
+//  Solution:           Now the time is set to 'FOREVER' from 'TEN_SECS'
+    dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)bookDeleteEntryCB, FOREVER, KEY_CLEAR | KEY_LEFT | KEY_RIGHT );
 
   /* Show the dialog
   */
-  	info_dialog( Window, &Dialog );
+    info_dialog( Window, &Dialog );
 }
 
 /*******************************************************************************
 
- $Function:    	bookActivateFDN
+ $Function:     bookActivateFDN
 
- $Description:	information screen to tell user to activate FDN
+ $Description:  information screen to tell user to activate FDN
 
- $Returns:		None
+ $Returns:      None
 
- $Arguments:	None
+ $Arguments:    None
 
 *******************************************************************************/
 
 void bookActivateFDN( T_MFW_HND window )
 {
-	tBookDialogData Dialog;
+    tBookDialogData Dialog;
 
     /* Initialise the dialog control block with default information
-	*/
-	dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TxtPlease, TxtActivateFDN, COLOUR_STATUS);
-	dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)NULL, FOUR_SECS, KEY_CLEAR | KEY_LEFT | KEY_RIGHT );
+    */
+    dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TxtPlease, TxtActivateFDN, COLOUR_STATUS);
+    dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)NULL, FOUR_SECS, KEY_CLEAR | KEY_LEFT | KEY_RIGHT );
 
-	/* Show the dialog
-	*/
-	info_dialog( window, &Dialog );
+    /* Show the dialog
+    */
+    info_dialog( window, &Dialog );
 }
 
 /* SPR#1428 - SH - New Editor: moved the following two functions
@@ -1329,21 +1270,21 @@
 
 /*******************************************************************************
 
- $Function:		bookInputStartNumberEditor
+ $Function:     bookInputStartNumberEditor
 
- $Description:	Start the input handler using default properties
+ $Description:  Start the input handler using default properties
 
- $Returns:		Handle of newly created window, or NULL if failure
+ $Returns:      Handle of newly created window, or NULL if failure
 
- $Arguments:	parent, parent window handle, buffer, input buffer
+ $Arguments:    parent, parent window handle, buffer, input buffer
 
 *******************************************************************************/
 
 MfwHnd bookInputStartNumberEditor( MfwHnd parent, void *buffer )
 {
-	T_AUI_EDITOR_DATA editor_data;
+    T_AUI_EDITOR_DATA editor_data;
     U16 editor_num_length = NUMBER_LENGTH;;
-	TRACE_FUNCTION ("bookInputStartNumberEditor()");
+    TRACE_FUNCTION ("bookInputStartNumberEditor()");
 
     // June 22, 2006 REF: DRT OMAPS00081761  x0012849
     // Number length can be upto 41 when EXT1 is allocated and activated in SIM service table
@@ -1395,145 +1336,143 @@
     }
 
     TRACE_EVENT_P1 ("Number length = %d ",editor_num_length);
-	AUI_edit_SetDefault(&editor_data);
-	AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
-	AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNumberCB);
-	// Change by Sasken ( Deepa M.d) on March 29th 2004
-	// Issue Number : MMI-SPR-12722
-	// Subject: Right softkey should be "Back" when the editor is empty
-	// Bug : Right softkey should be "Back" when the editor is empty
-	// Solution : Added alternative string for the right softkey tobe displayed when the editor is empty
+    AUI_edit_SetDefault(&editor_data);
+    AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
+    AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNumberCB);
+    // Change by Sasken ( Deepa M.d) on March 29th 2004
+    // Issue Number : MMI-SPR-12722
+    // Subject: Right softkey should be "Back" when the editor is empty
+    // Bug : Right softkey should be "Back" when the editor is empty
+    // Solution : Added alternative string for the right softkey tobe displayed when the editor is empty
 
-	AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterNumber, NULL);
-	AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
+    AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterNumber, NULL);
+    AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
      // June 22, 2006 REF: DRT OMAPS00081761  x0012849
     // Changed the limit frommm NUMBER_LENGTH to editor_num_length.
-	AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_num_length);
-	AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
+    AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_num_length);
+    AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
 
-	return AUI_edit_Start(parent, &editor_data);
+    return AUI_edit_Start(parent, &editor_data);
 }
 
 
-
 /*******************************************************************************
 
- $Function:		bookInputStartNameEditor
+ $Function:     bookInputStartNameEditor
 
- $Description:	Start the input handler using default properties
+ $Description:  Start the input handler using default properties
 
- $Returns:		Handle of newly created window, or NULL if failure
+ $Returns:      Handle of newly created window, or NULL if failure
 
- $Arguments:	parent, parent window handle, buffer, input buffer
+ $Arguments:    parent, parent window handle, buffer, input buffer
 
 *******************************************************************************/
 
 MfwHnd bookInputStartNameEditor( MfwHnd parent, void *buffer )
 {
-	T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) parent )->data;
-	tBookStandard   *data       = (tBookStandard *) win_data->user;
-	T_phbk          *Phbk       = data->phbk;
-	T_AUI_EDITOR_DATA editor_data;
-	U16             editor_length;
+    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) parent )->data;
+    tBookStandard   *data       = (tBookStandard *) win_data->user;
+    T_phbk          *Phbk       = data->phbk;
+    T_AUI_EDITOR_DATA editor_data;
+    U16             editor_length;
 
-	TRACE_FUNCTION ("bookInputStartNameEditor()");
+    TRACE_FUNCTION ("bookInputStartNameEditor()");
 
-	/* xreddymn OMAPS00079431 May-29-2006
-	 * Restrict the number of characters that the user can input for name
-	 * based on which phonebook is selected.
-	 */
-	if(bookGetBookSelected() == TRUE)
-	{
-		/* For ME phonebook use MAX_ALPHA_LEN */
-		editor_length = MAX_ALPHA_LEN;
-	}
-	else
-	{
-		/* For SIM phonebook, restrict length to 14 */
-		editor_length = 15;
-	}
+    /* xreddymn OMAPS00079431 May-29-2006
+     * Restrict the number of characters that the user can input for name
+     * based on which phonebook is selected.
+     */
+    if(bookGetBookSelected() == TRUE)
+    {
+        /* For ME phonebook use MAX_ALPHA_LEN */
+        editor_length = MAX_ALPHA_LEN;
+    }
+    else
+    {
+        /* For SIM phonebook, restrict length to 14 */
+        editor_length = 15;
+    }
 
     /* Set up the default parameters for the input window */
 
 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED)
-	/*MC, the chinese editor MUST have a unicode string as input*/
-	/*MC , SPR 1242 merged in from b-sample build*/
-	if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
-	{
-		T_CHINESE_DATA chinese_data;
-		chinese_data.TextString = (char*) Phbk->edt_buf_name;
-		if (chinese_data.TextString[0]== 0)//if, empty string
-		{
-			chinese_data.TextString[0] = (char)0x80;//give string Unicode tag /*a0393213 lint warnings removal-typecast done*/
-			chinese_data.TextString[1] = 0x7F;
-		}
-		else
-		{
-			if (chinese_data.TextString[0]!= (char)0x80)/*If ASCII string*//*a0393213 lint warnings removal-typecast done*/
-			{
+    /*MC, the chinese editor MUST have a unicode string as input*/
+    /*MC , SPR 1242 merged in from b-sample build*/
+    if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
+    {
+        T_CHINESE_DATA chinese_data;
+        chinese_data.TextString = (char*) Phbk->edt_buf_name;
+        if (chinese_data.TextString[0]== 0)//if, empty string
+        {
+            chinese_data.TextString[0] = (char)0x80;//give string Unicode tag /*a0393213 lint warnings removal-typecast done*/
+            chinese_data.TextString[1] = 0x7F;
+        }
+        else
+        {
+            if (chinese_data.TextString[0]!= (char)0x80)/*If ASCII string*//*a0393213 lint warnings removal-typecast done*/
+            {
 
-			/*SPR 1752, if ASCII string, use a latin editor*/
-				AUI_edit_SetDefault(&editor_data);
-				AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
-				AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNameCB);
-				AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterName, NULL);
-				/* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
-				AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_length);
-				AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_BAR);
+            /*SPR 1752, if ASCII string, use a latin editor*/
+                AUI_edit_SetDefault(&editor_data);
+                AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
+                AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNameCB);
+                AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterName, NULL);
+                /* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
+                AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_length);
+                AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_BAR);
 
-				return AUI_edit_Start(parent, &editor_data);
-			}
-		}
-		/*MC end*/
-		chinese_data.Callback = (T_AUI_EDIT_CB)bookAddNameCB;
-		chinese_data.Identifier = INPUT_LEFT ;
-		chinese_data.LeftSoftKey = TxtSave;
-		chinese_data.DestroyEditor = TRUE;
-		/* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
-		chinese_data.EditorSize = (USHORT)((editor_length-4)/2);//i.e.8
-		return chinese_input(parent, &chinese_data);
-	}
-	else
+                return AUI_edit_Start(parent, &editor_data);
+            }
+        }
+        /*MC end*/
+        chinese_data.Callback = (T_AUI_EDIT_CB)bookAddNameCB;
+        chinese_data.Identifier = INPUT_LEFT ;
+        chinese_data.LeftSoftKey = TxtSave;
+        chinese_data.DestroyEditor = TRUE;
+        /* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
+        chinese_data.EditorSize = (USHORT)((editor_length-4)/2);//i.e.8
+        return chinese_input(parent, &chinese_data);
+    }
+    else
 #endif /* CHINESE_MMI && EASY_TEXT_ENABLED */
-	{
-		AUI_edit_SetDefault(&editor_data);
-		AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
-		AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNameCB);
-		AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterName, NULL);
+    {
+        AUI_edit_SetDefault(&editor_data);
+        AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
+        AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)bookAddNameCB);
+        AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterName, NULL);
 /*SPR 1752*/
 #ifdef NO_ASCIIZ
-		if (Phbk->edt_buf_name[0] ==0x80)
-			/* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
-			AUI_edit_SetBuffer(&editor_data, ATB_DCS_UNICODE, &Phbk->edt_buf_name[2], editor_length/2 -2);
-		else
+        if (Phbk->edt_buf_name[0] ==0x80)
+            /* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
+            AUI_edit_SetBuffer(&editor_data, ATB_DCS_UNICODE, &Phbk->edt_buf_name[2], editor_length/2 -2);
+        else
 #endif
-			/* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
-			AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_length);
-		AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_BAR);
+            /* xreddymn OMAPS00079431 May-29-2006: Length changes based on selected phonebook */
+            AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, editor_length);
+        AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_BAR);
 
-		return AUI_edit_Start(parent, &editor_data);
-	}
+        return AUI_edit_Start(parent, &editor_data);
+    }
 }
 
 
-
 /*******************************************************************************
 
- $Function:		bookInputDestroy
+ $Function:     bookInputDestroy
 
- $Description:	Destroy Input Window
+ $Description:  Destroy Input Window
 
- $Returns:		None
+ $Returns:      None
 
- $Arguments:	Handle of window to be destroyed
+ $Arguments:    Handle of window to be destroyed
 
 *******************************************************************************/
 
 void bookInputDestroy( MfwHnd window )
 {
-	TRACE_FUNCTION ("bookInputDestroy()");
-	/*MC SPR 1752, send destroy event to window*/
-	SEND_EVENT( window, E_ED_DESTROY, 0, 0 );
+    TRACE_FUNCTION ("bookInputDestroy()");
+    /*MC SPR 1752, send destroy event to window*/
+    SEND_EVENT( window, E_ED_DESTROY, 0, 0 );
 
 }
 
@@ -1552,84 +1491,82 @@
 
 void bookAddNameCB( T_MFW_HND win, USHORT Identifier, SHORT reason )
 {
-
-
     T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
     tBookStandard   *data       = (tBookStandard *) win_data->user;
     T_phbk          *Phbk       = data->phbk;
 
-	TRACE_FUNCTION("bookAddNameCB");
+    TRACE_FUNCTION("bookAddNameCB");
 
-	switch (reason)
+    switch (reason)
     {
-		case INFO_KCD_LEFT:
+        case INFO_KCD_LEFT:
         {
             /* Construct a new entry to be written to the phone book
             */
 
-			/*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
-			if (Phbk->edt_buf_name[0] == 0x80 )//MC, if unicode
-			{	//MC, if empty string, remove 0x80 at beginning
-				if (Phbk->edt_buf_name[2]==0x00 &&  Phbk->edt_buf_name[3] == 0x00)
-					memset(Phbk->edt_buf_name, 0, MAX_ALPHA_LEN);
-			}
+            /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
+            if (Phbk->edt_buf_name[0] == 0x80 )//MC, if unicode
+            {   //MC, if empty string, remove 0x80 at beginning
+                if (Phbk->edt_buf_name[2]==0x00 &&  Phbk->edt_buf_name[3] == 0x00)
+                    memset(Phbk->edt_buf_name, 0, MAX_ALPHA_LEN);
+            }
 
-	// xvilliva SPR21547 We check for presence of either phone number or name.
-	//				    We add or modify the entry and flash an alert correspondingly.
-	if(strlen((char *) Phbk->edt_buf_number)>0 ||  strlen((char *)Phbk->edt_buf_name)>0)
-	{
+    // xvilliva SPR21547 We check for presence of either phone number or name.
+    //                  We add or modify the entry and flash an alert correspondingly.
+    if(strlen((char *) Phbk->edt_buf_number)>0 ||  strlen((char *)Phbk->edt_buf_name)>0)
+    {
             /* Store in the current phone book
             */
             if ( Phbk->UpdateAction == CREATE_ENTRY )
-				storeInFile( Phbk );
+                storeInFile( Phbk );
             else if ( Phbk->UpdateAction == MODIFY_EXISTING )
-				changeInFile( Phbk );
+                changeInFile( Phbk );
             bookShowInformation( win, MmiBookCurrentText(), NULL,NULL );
 
-			/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- Start */
-			mmi_int_phb_store_change_completion();
-			/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- End */
+            /* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- Start */
+            mmi_int_phb_store_change_completion();
+            /* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- End */
 
-	}
-	else
-		bookShowInformation( win, TxtInvalidInput, NULL,NULL );
+    }
+    else
+        bookShowInformation( win, TxtInvalidInput, NULL,NULL );
 
             /* And shut down, clearing the number and name windows as we go
             */
             if ( Phbk->input_number_win )
             {
- 				AUI_edit_Destroy(Phbk->input_number_win);
-    		    Phbk->input_number_win = 0;
-    		}
-			/*SPR 1752, send destroy event rather than calling destroy function*/
-			SEND_EVENT( Phbk->input_name_win, E_ED_DESTROY, 0, 0 );
-    		Phbk->input_name_win = 0;
+                AUI_edit_Destroy(Phbk->input_number_win);
+                Phbk->input_number_win = 0;
+            }
+            /*SPR 1752, send destroy event rather than calling destroy function*/
+            SEND_EVENT( Phbk->input_name_win, E_ED_DESTROY, 0, 0 );
+            Phbk->input_name_win = 0;
 
-		// Jan 22, 2006 REF: OMAPS00061930  x0039928
-		// Fix : Start the phonebook timer in case of trying to modify the existing entry
-		if ( Phbk->UpdateAction == MODIFY_EXISTING )
-			timStart(PhbSearchTim);
+        // Jan 22, 2006 REF: OMAPS00061930  x0039928
+        // Fix : Start the phonebook timer in case of trying to modify the existing entry
+        if ( Phbk->UpdateAction == MODIFY_EXISTING )
+            timStart(PhbSearchTim);
 
-			/*MC-- get rid of search window(and options menu), if just changed a chinese entry
-			(prevent showing scrambled entry)*/
-			if ( Phbk->UpdateAction == MODIFY_EXISTING && Mmi_getCurrentLanguage()==CHINESE_LANGUAGE)
-			{
-				bookMenuDestroy(Phbk->menu_options_win);
-				Phbk->menu_options_win=0;
-				bookSearchDestroy( Phbk->search_win);
-				Phbk->search_win=0;
-			}
+            /*MC-- get rid of search window(and options menu), if just changed a chinese entry
+            (prevent showing scrambled entry)*/
+            if ( Phbk->UpdateAction == MODIFY_EXISTING && Mmi_getCurrentLanguage()==CHINESE_LANGUAGE)
+            {
+                bookMenuDestroy(Phbk->menu_options_win);
+                Phbk->menu_options_win=0;
+                bookSearchDestroy( Phbk->search_win);
+                Phbk->search_win=0;
+            }
         }
-		break;
+        break;
 
         case INFO_KCD_RIGHT:
-		case INFO_KCD_HUP:
+        case INFO_KCD_HUP:
             /* Both right and HUP can do the same task here
             */
             /*SPR 1752, send destroy event rather than calling destroy function*/
             SEND_EVENT( Phbk->input_name_win, E_ED_DESTROY, 0, 0 );
             Phbk->input_name_win = 0;
-		    break;
+            break;
 
         default:
         {
@@ -1657,28 +1594,28 @@
 
 void bookAddNumberCB( T_MFW_HND win, USHORT Identifier, SHORT reason )
 {
-    T_MFW_WIN		*win_data   = ( (T_MFW_HDR *) win )->data;
-    tBookStandard	*data       = (tBookStandard *) win_data->user;
+    T_MFW_WIN       *win_data   = ( (T_MFW_HDR *) win )->data;
+    tBookStandard   *data       = (tBookStandard *) win_data->user;
 
-	switch ( reason )
+    switch ( reason )
     {
         case INFO_KCD_LEFT:
-			data->phbk->input_name_win = bookInputStartNameEditor( data->win, data->phbk->edt_buf_name );
-	    	break;
+            data->phbk->input_name_win = bookInputStartNameEditor( data->win, data->phbk->edt_buf_name );
+            break;
 
-		case INFO_KCD_RIGHT:
-	    case INFO_KCD_HUP:
+        case INFO_KCD_RIGHT:
+        case INFO_KCD_HUP:
             /* Both right and HUP can do the same task here
             */
             AUI_edit_Destroy( data->phbk->input_number_win );
             data->phbk->input_number_win = 0;
-	    	break;
+            break;
 
-		default:
+        default:
             /* otherwise no action to be performed
             */
-			break;
-	}
+            break;
+    }
 }
 
 
@@ -1705,18 +1642,18 @@
   TRACE_FUNCTION("bookAddNameCB");
   switch (reason)
     {
-		case INPUT_LEFT:
+        case INPUT_LEFT:
         {
 
             /* Construct a new entry to be written to the phone book
             */
 #ifdef NO_ASCIIZ
 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
-			if (Phbk->edt_buf_name[0] == 0x80 )//MC, if unicode
-			{	//MC, if empty string, remove 0x80 at beginning
-				if (Phbk->edt_buf_name[2]==0x00 &&  Phbk->edt_buf_name[3] == 0x00)
-					memset(Phbk->edt_buf_name, 0, MAX_ALPHA_LEN);
-			}
+            if (Phbk->edt_buf_name[0] == 0x80 )//MC, if unicode
+            {   //MC, if empty string, remove 0x80 at beginning
+                if (Phbk->edt_buf_name[2]==0x00 &&  Phbk->edt_buf_name[3] == 0x00)
+                    memset(Phbk->edt_buf_name, 0, MAX_ALPHA_LEN);
+            }
 #endif
 
             /* Store in the current phone book
@@ -1729,45 +1666,45 @@
 
             bookShowInformation( win, MmiBookCurrentText(), NULL,NULL );
 
-			/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- Start */
-			mmi_int_phb_store_change_completion();
-			/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- End */
+            /* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- Start */
+            mmi_int_phb_store_change_completion();
+            /* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- End */
 
 
             /* And shut down, clearing the number and name windows as we go
             */
             if ( Phbk->input_number_win )
             {
-		        SEND_EVENT( Phbk->input_number_win, INPUT_DESTROY, 0, 0 );
-    		    Phbk->input_number_win = 0;
-    		}
+                SEND_EVENT( Phbk->input_number_win, INPUT_DESTROY, 0, 0 );
+                Phbk->input_number_win = 0;
+            }
 
 
-			SEND_EVENT( Phbk->input_name_win, INPUT_DESTROY, 0, 0 );
-			Phbk->input_name_win = 0;
+            SEND_EVENT( Phbk->input_name_win, INPUT_DESTROY, 0, 0 );
+            Phbk->input_name_win = 0;
 
 #ifdef NO_ASCIIZ
 /*MC-- get rid of search window(and options menu), if just changed a chinese entry
 (prevent showing scrambled entry)*/
-			if ( Phbk->UpdateAction == MODIFY_EXISTING &&Mmi_getCurrentLanguage()==CHINESE_LANGUAGE)
-			{	bookMenuDestroy(Phbk->menu_options_win);
-				Phbk->menu_options_win=0;
-				bookSearchDestroy( Phbk->search_win);
-				Phbk->search_win=0;
+            if ( Phbk->UpdateAction == MODIFY_EXISTING &&Mmi_getCurrentLanguage()==CHINESE_LANGUAGE)
+            {   bookMenuDestroy(Phbk->menu_options_win);
+                Phbk->menu_options_win=0;
+                bookSearchDestroy( Phbk->search_win);
+                Phbk->search_win=0;
 
-			}
+            }
 #endif
 
 
         }
-		break;
+        break;
 
         case INPUT_RIGHT:
-		case INPUT_CLEAR:
+        case INPUT_CLEAR:
         {
             /* Both right and clear can do the same task here
             */
-			SEND_EVENT( Phbk->input_name_win, INPUT_DESTROY, 0, 0 );
+            SEND_EVENT( Phbk->input_name_win, INPUT_DESTROY, 0, 0 );
             Phbk->input_name_win = 0;
         }
     break;
@@ -1835,8 +1772,8 @@
 
 void fdn_menu_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason)
 {
-	TRACE_EVENT("fdn_menu_cb");
-	menuFDN=0;
+    TRACE_EVENT("fdn_menu_cb");
+    menuFDN=0;
 }
 
 // May 3, 2004        REF: CRR MMI-SPR-18555  Rashmi C N(Sasken)
@@ -1844,25 +1781,23 @@
 
 int bookFDNMenu(MfwMnu* menu, MfwMnuItem* item)
 {
-	T_MFW_HND 		win = mfw_parent(mfw_header());
-	T_MFW_WIN		*win_data	= ((T_MFW_HDR *) win)->data;
-	tBookStandard	*data		= (tBookStandard *) win_data->user;
-
-
+    T_MFW_HND       win = mfw_parent(mfw_header());
+    T_MFW_WIN       *win_data   = ((T_MFW_HDR *) win)->data;
+    tBookStandard   *data       = (tBookStandard *) win_data->user;
 
-	menuFDN=1;
-  	// Sep 29, 2004        REF: CRR 25041  xvilliva
-	// The bookMenuStart() is called with the window data->phbk->win,
-	// similar to the function bookFDNMenu() to avoid crash. The menu window
-	// thus created is stored, which will be deleted while phonebook menu is
-	// destroyed.
-	data->phbk->menu_call_options_win_2 = bookMenuStart( data->phbk->win, bookNameMenuFDNAttributes(),0);
-	SEND_EVENT(data->phbk->menu_call_options_win_2, ADD_CALLBACK, NULL, (void *)fdn_menu_cb);
+    menuFDN=1;
+    // Sep 29, 2004        REF: CRR 25041  xvilliva
+    // The bookMenuStart() is called with the window data->phbk->win,
+    // similar to the function bookFDNMenu() to avoid crash. The menu window
+    // thus created is stored, which will be deleted while phonebook menu is
+    // destroyed.
+    data->phbk->menu_call_options_win_2 = bookMenuStart( data->phbk->win, bookNameMenuFDNAttributes(),0);
+    SEND_EVENT(data->phbk->menu_call_options_win_2, ADD_CALLBACK, NULL, (void *)fdn_menu_cb);
 
       return 0; /* to remove warning Aug - 11 */
 }
 
-// Jul 28, 2004       	REF: CRR:20887 xrashmic - SASKEN
+// Jul 28, 2004         REF: CRR:20887 xrashmic - SASKEN
 // Description: Current state of FDN not highlighted
 // Fix: Instead of showing the submenu directly we call this function
 // where we set the menu and also higlight the previously selected menu item
@@ -1870,22 +1805,20 @@
 extern MfwMnuAttr *FDNMenu(void);
 void settingsFocusFDNCurSel(void)
 {
-	UBYTE			CurSel;  //, state; // RAVI
-
-
+    UBYTE           CurSel;  //, state; // RAVI
 
-	T_MFW_HND 		win = mfw_parent(mfw_header());
-	T_MFW_WIN		*win_data	= ((T_MFW_HDR *) win)->data;
-	tBookStandard	*data		= (tBookStandard *) win_data->user;
+    T_MFW_HND       win = mfw_parent(mfw_header());
+    T_MFW_WIN       *win_data   = ((T_MFW_HDR *) win)->data;
+    tBookStandard   *data       = (tBookStandard *) win_data->user;
 
-  	// Sep 29, 2004        REF: CRR 25041  xvilliva
-	// The bookMenuStart() is called with the window data->phbk->win,
-	// similar to the function bookFDNMenu() to avoid crash. The menu window
-	// thus created is stored, which will be deleted while phonebook menu is
-	// destroyed.
-	data->phbk->menu_options_win_2= bookMenuStart(data->phbk->win, FDNMenu(), 0);
-	CurSel = (phb_get_mode() == PHB_RESTRICTED)?FIRSTMENUITEM:SECONDMENUITEM;
-	SEND_EVENT(data->phbk->menu_options_win_2, DEFAULT_OPTION, NULL, &CurSel);
+    // Sep 29, 2004        REF: CRR 25041  xvilliva
+    // The bookMenuStart() is called with the window data->phbk->win,
+    // similar to the function bookFDNMenu() to avoid crash. The menu window
+    // thus created is stored, which will be deleted while phonebook menu is
+    // destroyed.
+    data->phbk->menu_options_win_2= bookMenuStart(data->phbk->win, FDNMenu(), 0);
+    CurSel = (phb_get_mode() == PHB_RESTRICTED)?FIRSTMENUITEM:SECONDMENUITEM;
+    SEND_EVENT(data->phbk->menu_options_win_2, DEFAULT_OPTION, NULL, &CurSel);
 }
 
 // June 07,  2005         REF: CRR MMI-FIX-31545 x0021334
@@ -1893,28 +1826,26 @@
 // Added this function to check if FDN is allocated
 void checkFDNSupport(void)
 {
-	T_MFW_HND 		win = mfw_parent(mfw_header());
-
+    T_MFW_HND       win = mfw_parent(mfw_header());
 
-
-       UBYTE serv_stat;
-       T_DISPLAY_DATA   display_info;
+    UBYTE serv_stat;
+    T_DISPLAY_DATA   display_info;
 
-	// Check in SIM service table if FDN is allocated. If not allocated, display this info dialog
-	/* x0045876, 14-Aug-2006 (WR - "serv_stat" was set but never used) */
-	serv_stat = sim_serv_table_check(SRV_FDN);
-	/*if ((serv_stat = sim_serv_table_check(SRV_FDN)) EQ NO_ALLOCATED)*/
-	if (serv_stat  EQ NO_ALLOCATED)
-	{
-		dlg_initDisplayData_TextId(&display_info,  TxtSoftOK, NULL, TxtNotSupported, TxtNull, COLOUR_STATUS);
-		dlg_initDisplayData_events(&display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_LEFT | KEY_RIGHT);
-		info_dialog (win, &display_info);
-	}
-	else // Else show the FDN menu and set focus on current selection
-		settingsFocusFDNCurSel();
+    // Check in SIM service table if FDN is allocated. If not allocated, display this info dialog
+    /* x0045876, 14-Aug-2006 (WR - "serv_stat" was set but never used) */
+    serv_stat = sim_serv_table_check(SRV_FDN);
+    /*if ((serv_stat = sim_serv_table_check(SRV_FDN)) EQ NO_ALLOCATED)*/
+    if (serv_stat  EQ NO_ALLOCATED)
+    {
+        dlg_initDisplayData_TextId(&display_info,  TxtSoftOK, NULL, TxtNotSupported, TxtNull, COLOUR_STATUS);
+        dlg_initDisplayData_events(&display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_LEFT | KEY_RIGHT);
+        info_dialog (win, &display_info);
+    }
+    else // Else show the FDN menu and set focus on current selection
+        settingsFocusFDNCurSel();
 }
 
-/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- Start */
+/* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- Start */
 
 /*******************************************************************************
 
@@ -1922,29 +1853,28 @@
 
  $Description:  Reset all flags on adding / editing an Internal PHB Entry
 
- $Returns:    	None
+ $Returns:      None
 
  $Arguments:  None
 
 *******************************************************************************/
 static void mmi_int_phb_store_change_completion()
 {
-	/* Reset the "add" and "change" flags only incase of Internal PHB */
-	if ( bookGetBookSelected() == TRUE )
-	{
-		addname_flag = FALSE;
+    /* Reset the "add" and "change" flags only incase of Internal PHB */
+    if ( bookGetBookSelected() == TRUE )
+    {
+        addname_flag = FALSE;
 
-		changename_flag = FALSE;
-	}
+        changename_flag = FALSE;
+    }
 
-	return;
+    return;
 }
 
-/* Sep 20, 2006 REF: OMAPS00145786	x0080701 (Bharat) -- End */
+/* Sep 20, 2006 REF: OMAPS00145786  x0080701 (Bharat) -- End */
 
 /*******************************************************************************
 
                                 End of File
 
 *******************************************************************************/
-