summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-10-28 06:44:37 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-10-28 06:44:37 +0000
commitbee59000324bfd74a38d6d652dae62fc61b3b344 (patch)
tree1f210c42661e3f2bc3de3d0e73e0e2c635b43611 /apps/misc.c
parenta30f25ddd422c3bf39a6c9964b25c3a7b01676b3 (diff)
downloadrockbox-bee59000324bfd74a38d6d652dae62fc61b3b344.zip
rockbox-bee59000324bfd74a38d6d652dae62fc61b3b344.tar.gz
rockbox-bee59000324bfd74a38d6d652dae62fc61b3b344.tar.bz2
rockbox-bee59000324bfd74a38d6d652dae62fc61b3b344.tar.xz
Allow the x and y pixel values of viewports to be a negative number..
%V|-50|0|-|..... will position that viewport 50 pixels from the right of the display at the top. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23378 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 5af57fe..6be9f8f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -945,7 +945,7 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
const char* p = str, *f = fmt;
const char** s;
int* d;
- bool set;
+ bool set, is_negative;
int i=0;
va_start(ap, str);
@@ -973,7 +973,13 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
break;
case 'd': /* int */
+ is_negative = false;
d = va_arg(ap, int*);
+ if (*p == '-' && isdigit(*(p+1)))
+ {
+ is_negative = true;
+ p++;
+ }
if (!isdigit(*p))
{
if (!set_vals || *p != '-')
@@ -987,6 +993,8 @@ const char* parse_list(const char *fmt, uint32_t *set_vals,
while (isdigit(*p))
*d = (*d * 10) + (*p++ - '0');
set = true;
+ if (is_negative)
+ *d *= -1;
}
break;