summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lib/kbd_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/kbd_helper.c')
-rw-r--r--apps/plugins/lib/kbd_helper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugins/lib/kbd_helper.c b/apps/plugins/lib/kbd_helper.c
index e3a844a993..f99282575d 100644
--- a/apps/plugins/lib/kbd_helper.c
+++ b/apps/plugins/lib/kbd_helper.c
@@ -34,11 +34,12 @@
* success returns size of buffer used
* failure returns 0
*/
-int kbd_create_layout(char *layout, unsigned short *buf, int bufsz)
+int kbd_create_layout(const char *layout, unsigned short *buf, int bufsz)
{
unsigned short *pbuf;
const unsigned char *p = layout;
int len = 0;
+ int total_len = 0;
pbuf = buf;
while (*p && (pbuf - buf + (ptrdiff_t) sizeof(unsigned short)) < bufsz)
{
@@ -47,6 +48,7 @@ int kbd_create_layout(char *layout, unsigned short *buf, int bufsz)
{
*pbuf = len;
pbuf += len+1;
+ total_len += len + 1;
len = 0;
}
else
@@ -57,7 +59,9 @@ int kbd_create_layout(char *layout, unsigned short *buf, int bufsz)
{
*pbuf = len;
pbuf[len+1] = 0xFEFF; /* mark end of characters */
- return len + 1;
+ total_len += len + 1;
+ return total_len * sizeof(unsigned short);
}
+
return 0;
}