1
0
Fork 0
forked from len0rd/rockbox

be smarter about %xd so it only eats 2 letters if that image has subimages

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26371 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-05-29 09:35:05 +00:00
parent 8cd3f8452c
commit 04130c2c7e

View file

@ -28,6 +28,8 @@
#define PUTCH(out, c) fprintf(out, "%c", c) #define PUTCH(out, c) fprintf(out, "%c", c)
extern struct tag_info legal_tags[]; extern struct tag_info legal_tags[];
char images_with_subimages[100];
int image_count = 0;
/** Command line setting **/ /** Command line setting **/
bool is_mono_display = false; bool is_mono_display = false;
@ -106,12 +108,14 @@ int parse_tag(FILE* out, const char* start, bool in_conditional)
} }
else if (MATCH("xl")) else if (MATCH("xl"))
{ {
char label = start[1];
PUTCH(out, '('); PUTCH(out, '(');
int read = 1+dump_arg(out, start+1, 4, false); int read = 1+dump_arg(out, start+1, 4, false);
len += read; len += read;
start += read; start += read;
if (*start>= '0' && *start <= '9') if (*start>= '0' && *start <= '9')
{ {
images_with_subimages[image_count++] = label;
PUTCH(out, ','); PUTCH(out, ',');
len += dump_arg(out, start, 1, false); len += dump_arg(out, start, 1, false);
} }
@ -119,11 +123,19 @@ int parse_tag(FILE* out, const char* start, bool in_conditional)
} }
else if (MATCH("xd")) else if (MATCH("xd"))
{ {
/* NOTE: almost certainly needs work */ char label = start[0];
int i=0;
while (i<image_count)
{
if (images_with_subimages[i] == label)
break;
i++;
}
PUTCH(out, '('); PUTCH(out, '(');
PUTCH(out, *start++); len++; PUTCH(out, *start++); len++;
if ((*start >= 'a' && *start <= 'z') || if (i<image_count &&
(*start >= 'A' && *start <= 'Z')) ((*start >= 'a' && *start <= 'z') ||
(*start >= 'A' && *start <= 'Z')))
{ {
PUTCH(out, *start); len++; PUTCH(out, *start); len++;
} }