# HG changeset patch # User reimar # Date 1287329414 0 # Node ID f2b40b588792baaeb080666ac2881da5a489f74f # Parent 47f95407542453db48345ed92cfed9d1f613c99f Avoid C99-style loops with variable declaration inside for () Patch by Gianluigi Tiesi [sherpya netfarm it]. diff -r 47f954075424 -r f2b40b588792 subassconvert.c --- a/subassconvert.c Sun Oct 17 15:25:38 2010 +0000 +++ b/subassconvert.c Sun Oct 17 15:30:14 2010 +0000 @@ -126,8 +126,9 @@ font_stack[0] = (struct font_tag){}; // type with all defaults while (*line && new_line.len < new_line.bufsize - 1) { char *orig_line = line; + int i; - for (int i = 0; i < FF_ARRAY_ELEMS(subrip_basic_tags); i++) { + for (i = 0; i < FF_ARRAY_ELEMS(subrip_basic_tags); i++) { const struct tag_conv *tag = &subrip_basic_tags[i]; int from_len = strlen(tag->from); if (strncmp(line, tag->from, from_len) == 0) { @@ -411,13 +412,14 @@ static void microdvd_open_tags(struct line *new_line, struct microdvd_tag *tags) { - for (int i = 0; i < sizeof(MICRODVD_TAGS) - 1; i++) { + int i, sidx; + for (i = 0; i < sizeof(MICRODVD_TAGS) - 1; i++) { if (tags[i].persistent == MICRODVD_PERSISTENT_OPENED) continue; switch (tags[i].key) { case 'Y': case 'y': - for (int sidx = 0; sidx < sizeof(MICRODVD_STYLES) - 1; sidx++) + for (sidx = 0; sidx < sizeof(MICRODVD_STYLES) - 1; sidx++) if (tags[i].data1 & (1 << sidx)) append_text(new_line, "{\\%c1}", MICRODVD_STYLES[sidx]); break; @@ -452,7 +454,7 @@ static void microdvd_close_no_persistent_tags(struct line *new_line, struct microdvd_tag *tags) { - int i; + int i, sidx; for (i = sizeof(MICRODVD_TAGS) - 2; i; i--) { if (tags[i].persistent != MICRODVD_PERSISTENT_OFF) @@ -460,7 +462,7 @@ switch (tags[i].key) { case 'y': - for (int sidx = sizeof(MICRODVD_STYLES) - 2; sidx >= 0; sidx--) + for (sidx = sizeof(MICRODVD_STYLES) - 2; sidx >= 0; sidx--) if (tags[i].data1 & (1 << sidx)) append_text(new_line, "{\\%c0}", MICRODVD_STYLES[sidx]); break;