diff options
author | Nils Wallménius <nils@rockbox.org> | 2012-05-07 18:27:46 +0200 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-05-07 18:43:12 +0200 |
commit | 7803f31c531c75c75d57513caa14caa934edcf19 (patch) | |
tree | d17e992acdd80e74edbe9b9a71d676d20d2c389a | |
parent | 3f61caa0cd7e818416be08778f356efd54e596fb (diff) | |
download | rockbox-7803f31c531c75c75d57513caa14caa934edcf19.tar.gz rockbox-7803f31c531c75c75d57513caa14caa934edcf19.zip |
Don't reinvent ctype.h functions
Remove ctype.h functions in text_editor and rockboy,
fix #define name clash in mpegplayer.
Change-Id: Icb40cf45e27b793c62cb095197757a27f508f344
-rw-r--r-- | apps/plugin.h | 1 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 32 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockmacros.h | 6 | ||||
-rw-r--r-- | apps/plugins/text_editor.c | 6 |
4 files changed, 19 insertions, 26 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index 4091cecc16..3f63b9a749 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <stdio.h> | 34 | #include <stdio.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <string.h> | 36 | #include <string.h> |
37 | #include <ctype.h> | ||
37 | #include "string-extra.h" | 38 | #include "string-extra.h" |
38 | #include "gcc_extensions.h" | 39 | #include "gcc_extensions.h" |
39 | 40 | ||
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 033a3ed1cb..928c48ab11 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -526,15 +526,15 @@ static struct fps fps NOCACHEBSS_ATTR; /* Accessed on other processor */ | |||
526 | static void osd_show(unsigned show); | 526 | static void osd_show(unsigned show); |
527 | 527 | ||
528 | #ifdef LCD_LANDSCAPE | 528 | #ifdef LCD_LANDSCAPE |
529 | #define _X (x + osd.x) | 529 | #define __X (x + osd.x) |
530 | #define _Y (y + osd.y) | 530 | #define __Y (y + osd.y) |
531 | #define _W width | 531 | #define __W width |
532 | #define _H height | 532 | #define __H height |
533 | #else | 533 | #else |
534 | #define _X (LCD_WIDTH - (y + osd.y) - height) | 534 | #define __X (LCD_WIDTH - (y + osd.y) - height) |
535 | #define _Y (x + osd.x) | 535 | #define __Y (x + osd.x) |
536 | #define _W height | 536 | #define __W height |
537 | #define _H width | 537 | #define __H width |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | #ifdef HAVE_LCD_COLOR | 540 | #ifdef HAVE_LCD_COLOR |
@@ -560,17 +560,17 @@ static unsigned draw_blendcolor(unsigned c1, unsigned c2, unsigned char amount) | |||
560 | * The origin is the upper-left corner of the OSD area */ | 560 | * The origin is the upper-left corner of the OSD area */ |
561 | static void draw_update_rect(int x, int y, int width, int height) | 561 | static void draw_update_rect(int x, int y, int width, int height) |
562 | { | 562 | { |
563 | mylcd_update_rect(_X, _Y, _W, _H); | 563 | mylcd_update_rect(__X, __Y, __W, __H); |
564 | } | 564 | } |
565 | 565 | ||
566 | static void draw_clear_area(int x, int y, int width, int height) | 566 | static void draw_clear_area(int x, int y, int width, int height) |
567 | { | 567 | { |
568 | #ifdef HAVE_LCD_COLOR | 568 | #ifdef HAVE_LCD_COLOR |
569 | rb->screen_clear_area(rb->screens[SCREEN_MAIN], _X, _Y, _W, _H); | 569 | rb->screen_clear_area(rb->screens[SCREEN_MAIN], __X, __Y, __W, __H); |
570 | #else | 570 | #else |
571 | int oldmode = grey_get_drawmode(); | 571 | int oldmode = grey_get_drawmode(); |
572 | grey_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); | 572 | grey_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); |
573 | grey_fillrect(_X, _Y, _W, _H); | 573 | grey_fillrect(__X, __Y, __W, __H); |
574 | grey_set_drawmode(oldmode); | 574 | grey_set_drawmode(oldmode); |
575 | #endif | 575 | #endif |
576 | } | 576 | } |
@@ -582,7 +582,7 @@ static void draw_clear_area_rect(const struct vo_rect *rc) | |||
582 | 582 | ||
583 | static void draw_fillrect(int x, int y, int width, int height) | 583 | static void draw_fillrect(int x, int y, int width, int height) |
584 | { | 584 | { |
585 | mylcd_fillrect(_X, _Y, _W, _H); | 585 | mylcd_fillrect(__X, __Y, __W, __H); |
586 | } | 586 | } |
587 | 587 | ||
588 | static void draw_hline(int x1, int x2, int y) | 588 | static void draw_hline(int x1, int x2, int y) |
@@ -967,10 +967,10 @@ static void fps_update_post_frame_callback(void) | |||
967 | int height = cliprect.b - cliprect.t; | 967 | int height = cliprect.b - cliprect.t; |
968 | 968 | ||
969 | /* OSD coordinates -> framebuffer coordinates */ | 969 | /* OSD coordinates -> framebuffer coordinates */ |
970 | fps.pf_x = _X; | 970 | fps.pf_x = __X; |
971 | fps.pf_y = _Y; | 971 | fps.pf_y = __Y; |
972 | fps.pf_width = _W; | 972 | fps.pf_width = __W; |
973 | fps.pf_height = _H; | 973 | fps.pf_height = __H; |
974 | 974 | ||
975 | cb = fps_post_frame_callback; | 975 | cb = fps_post_frame_callback; |
976 | } | 976 | } |
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index 87e570b55a..2d3baf1680 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h | |||
@@ -52,11 +52,6 @@ void dynamic_recompile (struct dynarec_block *newblock); | |||
52 | #define IBSS_ATTR | 52 | #define IBSS_ATTR |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | /* libc functions */ | ||
56 | #define isdigit(c) ((c) >= '0' && (c) <= '9') | ||
57 | #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) | ||
58 | #define isalnum(c) (isdigit(c) || (isalpha(c))) | ||
59 | |||
60 | /* only 1 fixed argument for open, since variadic macros don't except empty | 55 | /* only 1 fixed argument for open, since variadic macros don't except empty |
61 | * variable parameters */ | 56 | * variable parameters */ |
62 | #define open(a, ...) rb->open((a), __VA_ARGS__) | 57 | #define open(a, ...) rb->open((a), __VA_ARGS__) |
@@ -79,7 +74,6 @@ void dynamic_recompile (struct dynarec_block *newblock); | |||
79 | #define strcat(a,b) rb->strcat((a),(b)) | 74 | #define strcat(a,b) rb->strcat((a),(b)) |
80 | #define snprintf(...) rb->snprintf(__VA_ARGS__) | 75 | #define snprintf(...) rb->snprintf(__VA_ARGS__) |
81 | #define fdprintf(...) rb->fdprintf(__VA_ARGS__) | 76 | #define fdprintf(...) rb->fdprintf(__VA_ARGS__) |
82 | #define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_) | ||
83 | 77 | ||
84 | /* Using #define isn't enough with GCC 4.0.1 */ | 78 | /* Using #define isn't enough with GCC 4.0.1 */ |
85 | void* memcpy(void* dst, const void* src, size_t size) ICODE_ATTR; | 79 | void* memcpy(void* dst, const void* src, size_t size) ICODE_ATTR; |
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 32013b6f28..6c1136cf48 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -287,12 +287,10 @@ static int do_item_menu(int cur_sel) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | #ifdef HAVE_LCD_COLOR | 289 | #ifdef HAVE_LCD_COLOR |
290 | /* in misc.h but no need to polute the api */ | 290 | |
291 | #define toupper(c) (((c >= 'a') && (c <= 'z'))?c+'A':c) | ||
292 | #define isxdigit(c) ((c>='a' && c<= 'f') || (c>='A' && c<= 'F') \ | ||
293 | || (c>='0' && c<= '9')) | ||
294 | #define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \ | 291 | #define hex2dec(c) (((c) >= '0' && ((c) <= '9')) ? (toupper(c)) - '0' : \ |
295 | (toupper(c)) - 'A' + 10) | 292 | (toupper(c)) - 'A' + 10) |
293 | |||
296 | static int my_hex_to_rgb(const char* hex, int* color) | 294 | static int my_hex_to_rgb(const char* hex, int* color) |
297 | { int ok = 1; | 295 | { int ok = 1; |
298 | int i; | 296 | int i; |