comparison src/ui/mfw/mfw_mfw.c @ 188:92abb46dc1ba

src/ui/mfw/*.[ch]: rm trailing white space
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 19 Jan 2021 06:10:27 +0000
parents 67bfe9f274f6
children
comparison
equal deleted inserted replaced
187:a33dd8a5dcc9 188:92abb46dc1ba
14 14
15 TO DO : 15 TO DO :
16 16
17 $History:: mfw_mfw.c $ 17 $History:: mfw_mfw.c $
18 Sep 14, 2007 REF: OMAPS00145866 Adrian Salido 18 Sep 14, 2007 REF: OMAPS00145866 Adrian Salido
19 Description: FT - MMI: Wrong trace class 19 Description: FT - MMI: Wrong trace class
20 Solution: changed event traces to function traces because the information content of 20 Solution: changed event traces to function traces because the information content of
21 this is low for non-MMI people and against TI coding convention. 21 this is low for non-MMI people and against TI coding convention.
22 22
23 Nov 05, 2005 REF: OMAPS00049571 Sumanth Kumar. C 23 Nov 05, 2005 REF: OMAPS00049571 Sumanth Kumar. C
24 Description: eZi Text function is not working 24 Description: eZi Text function is not working
25 Solution: current_mfw_elem variable is updated when any of the elements 25 Solution: current_mfw_elem variable is updated when any of the elements
26 such as window, keyboard, timer, etc., are deleted so that the 26 such as window, keyboard, timer, etc., are deleted so that the
27 current_mfw_element does not point to element that has already been freed. 27 current_mfw_element does not point to element that has already been freed.
28 28
29 Feb 28, 2004 REF: CRR 25608 Deepa M.D 29 Feb 28, 2004 REF: CRR 25608 Deepa M.D
30 The mfwEorc is made const.The changes will be present both in Color and Golite build . 30 The mfwEorc is made const.The changes will be present both in Color and Golite build .
31 31
32 Jan 27, 2005 REF: CRR MMI-SPR-28300 xnkulkar 32 Jan 27, 2005 REF: CRR MMI-SPR-28300 xnkulkar
33 Description: BMI: memory leak in mfwFree/mfwAlloc ?? 33 Description: BMI: memory leak in mfwFree/mfwAlloc ??
34 Solution: Trace output to print memory address and size freed 34 Solution: Trace output to print memory address and size freed
35 modified in function mfwFree() 35 modified in function mfwFree()
36 36
37 Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar 37 Dec 22, 2004 REF: CRR MFW-SPR-27847 xnkulkar
38 Description: MFW memory size variable changed from U16 -> U32 38 Description: MFW memory size variable changed from U16 -> U32
39 Solution: The use of variable U16 has been replaced with U32 39 Solution: The use of variable U16 has been replaced with U32
40 40
41 Oct 06, 2004 REF: CRR 25608 Deepa M.D 41 Oct 06, 2004 REF: CRR 25608 Deepa M.D
152 static U32 mfwMemLeft; /* space left in pool */ 152 static U32 mfwMemLeft; /* space left in pool */
153 153
154 //Feb 28, 2005 REF: CRR 25608 Deepa M.D 154 //Feb 28, 2005 REF: CRR 25608 Deepa M.D
155 //The mfwEorc is made const.The changes will be present both in Color and Golite build 155 //The mfwEorc is made const.The changes will be present both in Color and Golite build
156 static const MfwHdr mfwEorc = {0, MfwTypMax, 0}; /* end of root chain */ 156 static const MfwHdr mfwEorc = {0, MfwTypMax, 0}; /* end of root chain */
157 157
158 158
159 /***************************Go-lite Optimization changes end***********************/ 159 /***************************Go-lite Optimization changes end***********************/
160 160
161 U8 mfwSignallingMethod = 0; /* default is focus+root */ 161 U8 mfwSignallingMethod = 0; /* default is focus+root */
162 162
188 mfwSetFocus(0); /* initially no focus */ 188 mfwSetFocus(0); /* initially no focus */
189 dynMemSize &= ~(sizeof(MfwMemHdr)-1); /* align to header size */ 189 dynMemSize &= ~(sizeof(MfwMemHdr)-1); /* align to header size */
190 mfwMemDynTotal = dynMemSize; 190 mfwMemDynTotal = dynMemSize;
191 if (dynMemSize) 191 if (dynMemSize)
192 { 192 {
193 193
194 /***************************Go-lite Optimization changes start***********************/ 194 /***************************Go-lite Optimization changes start***********************/
195 mfwRoot = (MfwHdr *)&mfwEorc; /* points to end of chain */ 195 mfwRoot = (MfwHdr *)&mfwEorc; /* points to end of chain */
196 196
197 /***************************Go-lite Optimization changes end***********************/ 197 /***************************Go-lite Optimization changes end***********************/
198 mfwMemBase = (U8 *) externalRoot; /* setup memory handler */ 198 mfwMemBase = (U8 *) externalRoot; /* setup memory handler */
199 mfwMemEnd = (U8 *) externalRoot + dynMemSize; 199 mfwMemEnd = (U8 *) externalRoot + dynMemSize;
200 mfwMem.next = 0; 200 mfwMem.next = 0;
201 mfwMem.len = 0; 201 mfwMem.len = 0;
206 dynMemSize-sizeof(MfwMemHdr)); 206 dynMemSize-sizeof(MfwMemHdr));
207 } 207 }
208 else 208 else
209 { 209 {
210 mfwRoot = (MfwHdr *) externalRoot; /* setup root pointer */ 210 mfwRoot = (MfwHdr *) externalRoot; /* setup root pointer */
211 211
212 /***************************Go-lite Optimization changes start***********************/ 212 /***************************Go-lite Optimization changes start***********************/
213 if (!mfwRoot) 213 if (!mfwRoot)
214 mfwRoot = (MfwHdr *)&mfwEorc; /* points to end of chain */ 214 mfwRoot = (MfwHdr *)&mfwEorc; /* points to end of chain */
215 215
216 /***************************Go-lite Optimization changes end***********************/ 216 /***************************Go-lite Optimization changes end***********************/
217 mfwMemBase = 0; 217 mfwMemBase = 0;
218 mfwMemEnd = 0; 218 mfwMemEnd = 0;
219 mfwMem.next = 0; 219 mfwMem.next = 0;
220 mfwMem.len = 0; 220 mfwMem.len = 0;
423 { 423 {
424 *rp = e->next; 424 *rp = e->next;
425 if (mfwFocus == e) /* first element of window */ 425 if (mfwFocus == e) /* first element of window */
426 mfwSetFocus(e->next); 426 mfwSetFocus(e->next);
427 /* Nov 05, 2005 REF: OMAPS00049571 Sumanth Kumar. C 427 /* Nov 05, 2005 REF: OMAPS00049571 Sumanth Kumar. C
428 * Solution: current_mfw_elem variable is updated when any of the elements 428 * Solution: current_mfw_elem variable is updated when any of the elements
429 * such as window, keyboard, timer, etc., are deleted so that the 429 * such as window, keyboard, timer, etc., are deleted so that the
430 * current_mfw_element does not point to element that has already been freed. 430 * current_mfw_element does not point to element that has already been freed.
431 */ 431 */
432 if(e->type == MfwTypWin || e->type == MfwTypKbd ||e->type == MfwTypTim || 432 if(e->type == MfwTypWin || e->type == MfwTypKbd ||e->type == MfwTypTim ||
433 e->type == MfwTypEdt || e->type == MfwTypMnu || e->type == MfwTypIcn) 433 e->type == MfwTypEdt || e->type == MfwTypMnu || e->type == MfwTypIcn)
434 current_mfw_elem = e->next; 434 current_mfw_elem = e->next;
435 return rpr; 435 return rpr;
436 } 436 }
531 if (!size) 531 if (!size)
532 { 532 {
533 TRACE_ERROR("mfwAlloc(): invalid memory request"); 533 TRACE_ERROR("mfwAlloc(): invalid memory request");
534 return 0; 534 return 0;
535 } 535 }
536 536
537 #ifdef SENTINAL_CHECK 537 #ifdef SENTINAL_CHECK
538 if (!mfwMemBase) 538 if (!mfwMemBase)
539 { 539 {
540 size += (SENTINEL_SIZE*2); 540 size += (SENTINEL_SIZE*2);
541 data_ptr = (U8 *) sysAlloc(size); 541 data_ptr = (U8 *) sysAlloc(size);
550 if (size >= mfwMemLeft) 550 if (size >= mfwMemLeft)
551 { 551 {
552 TRACE_ERROR("mfwAlloc(): no memory"); 552 TRACE_ERROR("mfwAlloc(): no memory");
553 return 0; 553 return 0;
554 } 554 }
555 555
556 if (mfwMemBase + mfwMem.next > mfwMemEnd 556 if (mfwMemBase + mfwMem.next > mfwMemEnd
557 || mfwMemBase + mfwMem.next < mfwMemBase) 557 || mfwMemBase + mfwMem.next < mfwMemBase)
558 { 558 {
559 TRACE_ERROR("mfwAlloc(): corrupted memory"); 559 TRACE_ERROR("mfwAlloc(): corrupted memory");
560 return 0; 560 return 0;
625 if (size >= mfwMemLeft) 625 if (size >= mfwMemLeft)
626 { 626 {
627 TRACE_ERROR("mfwAlloc(): no memory"); 627 TRACE_ERROR("mfwAlloc(): no memory");
628 return 0; 628 return 0;
629 } 629 }
630 630
631 if (mfwMemBase + mfwMem.next > mfwMemEnd 631 if (mfwMemBase + mfwMem.next > mfwMemEnd
632 || mfwMemBase + mfwMem.next < mfwMemBase) 632 || mfwMemBase + mfwMem.next < mfwMemBase)
633 { 633 {
634 TRACE_ERROR("mfwAlloc(): corrupted memory"); 634 TRACE_ERROR("mfwAlloc(): corrupted memory");
635 return 0; 635 return 0;
730 #endif 730 #endif
731 731
732 #ifdef TRACE_MEMORY_CHECK 732 #ifdef TRACE_MEMORY_CHECK
733 // Jan 27, 2005 REF: CRR MMI-SPR-28300 xnkulkar 733 // Jan 27, 2005 REF: CRR MMI-SPR-28300 xnkulkar
734 // Description: BMI: memory leak in mfwFree/mfwAlloc ?? 734 // Description: BMI: memory leak in mfwFree/mfwAlloc ??
735 // Solution: Trace output to print memory address and size freed modified 735 // Solution: Trace output to print memory address and size freed modified
736 /* x0083025 on Sep 14, 2007 for OMAPS00145866 (adrian) */ 736 /* x0083025 on Sep 14, 2007 for OMAPS00145866 (adrian) */
737 MMI_TRACE_EVENT_P2("MFWFree address = %p, size : %d bytes",mem,size); 737 MMI_TRACE_EVENT_P2("MFWFree address = %p, size : %d bytes",mem,size);
738 #endif 738 #endif
739 739
740 if (!mfwMemBase) 740 if (!mfwMemBase)
741 { 741 {
742 void *m = mem; 742 void *m = mem;
743 743
744 #ifdef SENTINAL_CHECK 744 #ifdef SENTINAL_CHECK
745 /* 745 /*
746 ** Check the SENTINEL_SIZE last bytes to ensure they haven't been changed 746 ** Check the SENTINEL_SIZE last bytes to ensure they haven't been changed
747 */ 747 */
748 if (memcmp(mem + size + SENTINEL_SIZE, &check_val, SENTINEL_SIZE) != 0) 748 if (memcmp(mem + size + SENTINEL_SIZE, &check_val, SENTINEL_SIZE) != 0)
792 } 792 }
793 793
794 /* 794 /*
795 ** Memory not already free 795 ** Memory not already free
796 */ 796 */
797 797
798 #ifdef SENTINAL_CHECK 798 #ifdef SENTINAL_CHECK
799 /* 799 /*
800 ** Check the 4 last bytes to ensure they haven't been changed 800 ** Check the 4 last bytes to ensure they haven't been changed
801 */ 801 */
802 if (memcmp(mem + size - SENTINEL_SIZE, &check_val, SENTINEL_SIZE) != 0) 802 if (memcmp(mem + size - SENTINEL_SIZE, &check_val, SENTINEL_SIZE) != 0)
845 return mfwMemLeft; 845 return mfwMemLeft;
846 } 846 }
847 847
848 /* 848 /*
849 ** This function gives the bounds safety of strncpy, but NULL terminates the string like strcpy 849 ** This function gives the bounds safety of strncpy, but NULL terminates the string like strcpy
850 ** 850 **
851 ** parameters : cpyto : the pointer to the destination string 851 ** parameters : cpyto : the pointer to the destination string
852 ** : cpyfrm : the pointer to the source string 852 ** : cpyfrm : the pointer to the source string
853 ** : len : the maximum length of the destination string including the NULL terminator 853 ** : len : the maximum length of the destination string including the NULL terminator
854 ** 854 **
855 ** returns : A character pointer to the destination string if successful, otherwise NULL 855 ** returns : A character pointer to the destination string if successful, otherwise NULL