diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-02-23 23:36:11 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-23 23:36:11 +0100 |
commit | be967515acae6da77b5d550520fc7c2a39a61e2f (patch) | |
tree | 347037ddc92bdbdd270e6bf63a0e6d547684140f | |
parent | 3b7057fdae3cc47b61f0a3b14443a56cd52f4c2e (diff) | |
download | rockbox-be967515acae6da77b5d550520fc7c2a39a61e2f.tar.gz rockbox-be967515acae6da77b5d550520fc7c2a39a61e2f.zip |
hosted: Rename a bit in functions to avoid name clashes with unix headers.
Change-Id: I2baa5532ddcbca8a839c31434309013f02173ed8
-rw-r--r-- | apps/plugins/alarmclock.c | 26 | ||||
-rw-r--r-- | apps/plugins/keybox.c | 9 |
2 files changed, 17 insertions, 18 deletions
diff --git a/apps/plugins/alarmclock.c b/apps/plugins/alarmclock.c index 126b837390..79a676003a 100644 --- a/apps/plugins/alarmclock.c +++ b/apps/plugins/alarmclock.c | |||
@@ -28,7 +28,7 @@ const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; | |||
28 | 28 | ||
29 | static int current = 0; | 29 | static int current = 0; |
30 | static bool tomorrow = false; | 30 | static bool tomorrow = false; |
31 | static int alarm[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24; | 31 | static int alarms[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24; |
32 | static bool quit = false, usb = false, waiting = false, done = false; | 32 | static bool quit = false, usb = false, waiting = false, done = false; |
33 | 33 | ||
34 | static inline int get_button(void) | 34 | static inline int get_button(void) |
@@ -39,8 +39,8 @@ static inline int get_button(void) | |||
39 | 39 | ||
40 | static int rem_seconds(void) | 40 | static int rem_seconds(void) |
41 | { | 41 | { |
42 | int seconds = (((alarm[0] - rb->get_time()->tm_hour) * 3600) | 42 | int seconds = (((alarms[0] - rb->get_time()->tm_hour) * 3600) |
43 | +((alarm[1] - rb->get_time()->tm_min) * 60) | 43 | +((alarms[1] - rb->get_time()->tm_min) * 60) |
44 | -(rb->get_time()->tm_sec)); | 44 | -(rb->get_time()->tm_sec)); |
45 | 45 | ||
46 | /* The tomorrow flag means that the alarm should ring on the next day */ | 46 | /* The tomorrow flag means that the alarm should ring on the next day */ |
@@ -79,12 +79,12 @@ static void draw(struct screen * display) | |||
79 | else { | 79 | else { |
80 | if (current == 0) | 80 | if (current == 0) |
81 | rb->snprintf(info, sizeof(info), "Set alarm at [%02d]:%02d.", | 81 | rb->snprintf(info, sizeof(info), "Set alarm at [%02d]:%02d.", |
82 | alarm[0], | 82 | alarms[0], |
83 | alarm[1]); | 83 | alarms[1]); |
84 | else | 84 | else |
85 | rb->snprintf(info, sizeof(info), "Set alarm at %02d:[%02d].", | 85 | rb->snprintf(info, sizeof(info), "Set alarm at %02d:[%02d].", |
86 | alarm[0], | 86 | alarms[0], |
87 | alarm[1]); | 87 | alarms[1]); |
88 | } | 88 | } |
89 | draw_centered_string(display, info); | 89 | draw_centered_string(display, info); |
90 | } | 90 | } |
@@ -102,7 +102,7 @@ static bool can_play(void) | |||
102 | return false; | 102 | return false; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void play(void) | 105 | static void resume_audio(void) |
106 | { | 106 | { |
107 | int audio_status = rb->audio_status(); | 107 | int audio_status = rb->audio_status(); |
108 | if (!audio_status && rb->global_status->resume_index != -1) { | 108 | if (!audio_status && rb->global_status->resume_index != -1) { |
@@ -116,7 +116,7 @@ static void play(void) | |||
116 | rb->audio_resume(); | 116 | rb->audio_resume(); |
117 | } | 117 | } |
118 | 118 | ||
119 | static void pause(void) | 119 | static void pause_audio(void) |
120 | { | 120 | { |
121 | if (rb->audio_status() & AUDIO_STATUS_PLAY) | 121 | if (rb->audio_status() & AUDIO_STATUS_PLAY) |
122 | rb->audio_pause(); | 122 | rb->audio_pause(); |
@@ -132,7 +132,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
132 | "Play or pause one first."); | 132 | "Play or pause one first."); |
133 | return PLUGIN_ERROR; | 133 | return PLUGIN_ERROR; |
134 | } | 134 | } |
135 | pause(); | 135 | pause_audio(); |
136 | 136 | ||
137 | while(!quit) { | 137 | while(!quit) { |
138 | button = get_button(); | 138 | button = get_button(); |
@@ -146,7 +146,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
146 | if (waiting) { | 146 | if (waiting) { |
147 | if (rem_seconds() <= 0) { | 147 | if (rem_seconds() <= 0) { |
148 | quit = done = true; | 148 | quit = done = true; |
149 | play(); | 149 | resume_audio(); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | else { | 152 | else { |
@@ -157,7 +157,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
157 | case PLA_SCROLL_FWD: | 157 | case PLA_SCROLL_FWD: |
158 | case PLA_SCROLL_FWD_REPEAT: | 158 | case PLA_SCROLL_FWD_REPEAT: |
159 | #endif | 159 | #endif |
160 | alarm[current] = (alarm[current] + 1) % maxval[current]; | 160 | alarms[current] = (alarms[current] + 1) % maxval[current]; |
161 | break; | 161 | break; |
162 | case PLA_DOWN: | 162 | case PLA_DOWN: |
163 | case PLA_DOWN_REPEAT: | 163 | case PLA_DOWN_REPEAT: |
@@ -165,7 +165,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
165 | case PLA_SCROLL_BACK: | 165 | case PLA_SCROLL_BACK: |
166 | case PLA_SCROLL_BACK_REPEAT: | 166 | case PLA_SCROLL_BACK_REPEAT: |
167 | #endif | 167 | #endif |
168 | alarm[current] = (alarm[current] + maxval[current] - 1) | 168 | alarms[current] = (alarms[current] + maxval[current] - 1) |
169 | % maxval[current]; | 169 | % maxval[current]; |
170 | break; | 170 | break; |
171 | 171 | ||
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 570f4e6c76..8dc485ae9a 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -78,7 +78,7 @@ static void decrypt_buffer(char *buf, size_t size, uint32_t *key); | |||
78 | David Wheeler and Roger Needham taken from | 78 | David Wheeler and Roger Needham taken from |
79 | http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm */ | 79 | http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm */ |
80 | 80 | ||
81 | static void encrypt(uint32_t* v, uint32_t* k) | 81 | static void do_encrypt(uint32_t* v, uint32_t* k) |
82 | { | 82 | { |
83 | uint32_t v0=v[0], v1=v[1], sum=0, i; /* set up */ | 83 | uint32_t v0=v[0], v1=v[1], sum=0, i; /* set up */ |
84 | static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ | 84 | static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ |
@@ -91,7 +91,7 @@ static void encrypt(uint32_t* v, uint32_t* k) | |||
91 | v[0]=v0; v[1]=v1; | 91 | v[0]=v0; v[1]=v1; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void decrypt(uint32_t* v, uint32_t* k) | 94 | static void do_decrypt(uint32_t* v, uint32_t* k) |
95 | { | 95 | { |
96 | uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up */ | 96 | uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up */ |
97 | static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ | 97 | static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ |
@@ -365,7 +365,7 @@ static void decrypt_buffer(char *buf, size_t size, uint32_t *key) | |||
365 | block[0] = letoh32(block[0]); | 365 | block[0] = letoh32(block[0]); |
366 | block[1] = letoh32(block[1]); | 366 | block[1] = letoh32(block[1]); |
367 | 367 | ||
368 | decrypt(&block[0], key); | 368 | do_decrypt(&block[0], key); |
369 | 369 | ||
370 | /* byte swap one block */ | 370 | /* byte swap one block */ |
371 | block[0] = letoh32(block[0]); | 371 | block[0] = letoh32(block[0]); |
@@ -388,7 +388,7 @@ static void encrypt_buffer(char *buf, size_t size, uint32_t *key) | |||
388 | block[0] = htole32(block[0]); | 388 | block[0] = htole32(block[0]); |
389 | block[1] = htole32(block[1]); | 389 | block[1] = htole32(block[1]); |
390 | 390 | ||
391 | encrypt(&block[0], key); | 391 | do_encrypt(&block[0], key); |
392 | 392 | ||
393 | block[0] = htole32(block[0]); | 393 | block[0] = htole32(block[0]); |
394 | block[1] = htole32(block[1]); | 394 | block[1] = htole32(block[1]); |
@@ -670,4 +670,3 @@ enum plugin_status plugin_start(const void *parameter) | |||
670 | 670 | ||
671 | return PLUGIN_OK; | 671 | return PLUGIN_OK; |
672 | } | 672 | } |
673 | |||