FreeCalypso > hg > fc-magnetite
annotate src/ui3/mfw/mfw_mp3test.h @ 516:1ed9de6c90bd
src/g23m-gsm/sms/sms_for.c: bogus malloc removed
The new error handling code that was not present in TCS211 blob version
contains a malloc call that is bogus for 3 reasons:
1) The memory allocation in question is not needed in the first place;
2) libc malloc is used instead of one of the firmware's proper ways;
3) The memory allocation is made inside a function and then never freed,
i.e., a memory leak.
This bug was caught in gcc-built FreeCalypso fw projects (Citrine
and Selenite) because our gcc environment does not allow any use of
libc malloc (any reference to malloc produces a link failure),
but this code from TCS3.2 is wrong even for Magnetite: if this code
path is executed repeatedly over a long time, the many small allocations
made by this malloc call without a subsequent free will eventually
exhaust the malloc heap provided by the TMS470 environment, malloc will
start returning NULL, and the bogus code will treat it as an error.
Because the memory allocation in question is not needed at all,
the fix entails simply removing it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 22 Jul 2018 06:04:49 +0000 |
parents | e8ddbb0837ed |
children |
rev | line source |
---|---|
420
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +--------------------------------------------------------------------+ |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_mp3test.h $| |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | $Author:: NDH $Revision:: 1 $| |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | CREATED: 21.05.04 $Modtime:: 21.05.04 $| |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | STATE : code | |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 +--------------------------------------------------------------------+ |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 MODULE : MFW_MP3TEST |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 PURPOSE : This module contains the definitions for the Midi Riveria Interface. |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 HISTORY : |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 Sep 11, 2006 DR: OMAPS00094182 xrashmic |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 Solution: Populate files on accessing the "browse files" list |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 Jun 02,2006 REF: DR OMAPS00079746 x0039928 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 Bug:MMI displays 'Playing' when trying to play a wrong file |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 Fix: MP3 playback error is handled. |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 Nov 16,2005 REF: DR OMAPS00049192 x0039928 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 Bug:MP3: The screen is not refreshed after the mp3 file completes playing |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 Fix: The AUDIO_OK event recieved after mp3 file play completes is now handled |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 in mfw_mp3_test_start_cb() |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 Nov 14, 2005 REF: OMAPS00044445 xdeepadh |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 Description: Implementation of Test Menu for AAC |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 Solution: The existing MP3 test Application has been enhanced to support the AAC file testing. |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 The interfaces have been made generic to support both MP3 and AAC files. |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 */ |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /* |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ** Midi Test Return Values |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 */ |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #define MFW_PLAYER_MP3 0 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 #define MFW_PLAYER_AAC 1 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #define MFW_PLAYER_TEST_OK (0) |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 #define MFW_PLAYER_TEST_RIVIERA_FAILED (-1) |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #define MFW_PLAYER_TEST_MEM_FULL (-2) |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #define MFW_PLAYER_TEST_MEM_EMPTY (-3) |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 // Nov 16,2005 REF: DR OMAPS00049192 x0039928 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 // Jun 02,2006 REF: DR OMAPS00079746 x0039928 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 // Fix: Added a new parameter to the callback function. |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 typedef struct |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 { |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 T_MFW_HND focus_win; |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 void (*callback)(T_MFW_HND, SHORT); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 } MMI_RETURN_PATH; |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 /* |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 ** Midi Test Functions Prototypes |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 */ |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 SHORT mfw_audio_player_set_channel_mono(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 SHORT mfw_audio_player_set_channel_stereo(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 SHORT mfw_audio_player_play(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 char* mfw_audio_player_return_file_name(int index); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 int mfw_audio_player_return_file_number(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 SHORT mfw_audio_player_save_selected_file_idx(int index); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 SHORT mfw_audio_player_play(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 SHORT mfw_audio_player_pause(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 SHORT mfw_audio_player_resume(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 SHORT mfw_audio_player_stop(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 void mfw_audio_player_init(void); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 char *mfw_audio_player_GetExtension(char *src); |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 void mfw_audio_player_unpopulate_files(void);//Sep 11, 2006 DR: OMAPS00094182 xrashmic |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |