diff options
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/action_helper.h | 2 | ||||
-rwxr-xr-x | apps/plugins/lib/action_helper.pl | 2 | ||||
-rw-r--r-- | apps/plugins/lib/button_helper.h | 2 | ||||
-rwxr-xr-x | apps/plugins/lib/button_helper.pl | 5 |
4 files changed, 10 insertions, 1 deletions
diff --git a/apps/plugins/lib/action_helper.h b/apps/plugins/lib/action_helper.h index 58d9c6c303..53f5c840f8 100644 --- a/apps/plugins/lib/action_helper.h +++ b/apps/plugins/lib/action_helper.h | |||
@@ -27,7 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | #ifndef _ACTION_HELPER_H_ | 28 | #ifndef _ACTION_HELPER_H_ |
29 | #define _ACTION_HELPER_H_ | 29 | #define _ACTION_HELPER_H_ |
30 | 30 | extern const size_t action_helper_maxbuffer; | |
31 | char* action_name(int action); | 31 | char* action_name(int action); |
32 | char* context_name(int context); | 32 | char* context_name(int context); |
33 | 33 | ||
diff --git a/apps/plugins/lib/action_helper.pl b/apps/plugins/lib/action_helper.pl index 1dfdcfd070..742419e23b 100755 --- a/apps/plugins/lib/action_helper.pl +++ b/apps/plugins/lib/action_helper.pl | |||
@@ -140,10 +140,12 @@ printf "#define CONTEXTBUFSZ %d\n\n", $len_max_context; | |||
140 | 140 | ||
141 | if ($len_max_action > $len_max_context) | 141 | if ($len_max_action > $len_max_context) |
142 | { | 142 | { |
143 | print "const size_t action_helper_maxbuffer = ACTIONBUFSZ;\n"; | ||
143 | print "static char name_buf[ACTIONBUFSZ];\n"; | 144 | print "static char name_buf[ACTIONBUFSZ];\n"; |
144 | } | 145 | } |
145 | else | 146 | else |
146 | { | 147 | { |
148 | print "const size_t action_helper_maxbuffer = CONTEXTBUFSZ;\n"; | ||
147 | print "static char name_buf[CONTEXTBUFSZ];\n"; | 149 | print "static char name_buf[CONTEXTBUFSZ];\n"; |
148 | } | 150 | } |
149 | print <<EOF | 151 | print <<EOF |
diff --git a/apps/plugins/lib/button_helper.h b/apps/plugins/lib/button_helper.h index 1197b172b0..4087ba898a 100644 --- a/apps/plugins/lib/button_helper.h +++ b/apps/plugins/lib/button_helper.h | |||
@@ -32,7 +32,9 @@ struct available_button | |||
32 | * generated at compile time you can still call it as such though | 32 | * generated at compile time you can still call it as such though |
33 | * eg available_buttons[0] or available_buttons[available_button_count] (NULL SENTINEL, 0)*/ | 33 | * eg available_buttons[0] or available_buttons[available_button_count] (NULL SENTINEL, 0)*/ |
34 | 34 | ||
35 | extern const size_t button_helper_maxbuffer; | ||
35 | extern const struct available_button * const available_buttons; | 36 | extern const struct available_button * const available_buttons; |
36 | extern const int available_button_count; | 37 | extern const int available_button_count; |
38 | |||
37 | int get_button_names(char *buf, size_t bufsz, unsigned long button); | 39 | int get_button_names(char *buf, size_t bufsz, unsigned long button); |
38 | #endif /* _BUTTON_HELPER_H_ */ | 40 | #endif /* _BUTTON_HELPER_H_ */ |
diff --git a/apps/plugins/lib/button_helper.pl b/apps/plugins/lib/button_helper.pl index 45c3fd9073..192df18d7f 100755 --- a/apps/plugins/lib/button_helper.pl +++ b/apps/plugins/lib/button_helper.pl | |||
@@ -26,12 +26,15 @@ my @buttons = (); | |||
26 | my $count = 1; #null sentinel | 26 | my $count = 1; #null sentinel |
27 | my $val; | 27 | my $val; |
28 | my $def; | 28 | my $def; |
29 | my $len_max_button = 0; | ||
29 | while(my $line = <STDIN>) | 30 | while(my $line = <STDIN>) |
30 | { | 31 | { |
31 | chomp($line); | 32 | chomp($line); |
32 | if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) | 33 | if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) |
33 | { | 34 | { |
34 | $def = "{\"$1\", $2},\n"; | 35 | $def = "{\"$1\", $2},\n"; |
36 | my $slen = length($1) + 1; # NULL terminator | ||
37 | if ($slen > $len_max_button) { $len_max_button = $slen; } | ||
35 | $val = $2; | 38 | $val = $2; |
36 | if($val =~ /^0/) | 39 | if($val =~ /^0/) |
37 | { | 40 | { |
@@ -53,6 +56,8 @@ print <<EOF | |||
53 | #include "button.h" | 56 | #include "button.h" |
54 | #include "button_helper.h" | 57 | #include "button_helper.h" |
55 | 58 | ||
59 | const size_t button_helper_maxbuffer = $len_max_button; | ||
60 | |||
56 | static const struct available_button buttons[$count] = { | 61 | static const struct available_button buttons[$count] = { |
57 | EOF | 62 | EOF |
58 | ; | 63 | ; |