Commits

jfinkels committed 2e605d4

Matt.c: fixed off-by-one bug, in which incorrect index was used to shift into bit mask; now we simply iterate up from 0 instead of down to 0 using an unsigned int

Comments (0)

Files changed (1)

 									if (!strcmp("all", format)) {
 										outFormats = 0xFFFF;
 									}
-									for (i=1+(sizeof(formats)/sizeof(formats[0])); i!=0; i--) {
-										if (!strcmp(formats[i - 1], format)) break;
+									for (i=0; i<sizeof(formats)/sizeof(formats[0]); i++) {
+										if (!strcmp(formats[i], format)) break;
 									}
-									if (i == 0) {
+									if (i == sizeof(formats)/sizeof(formats[0])) {
 										ErrorLog(1, 0, "Unsupported output format: %s.", format);
 									}
 									else if (outFormats & (1<<i)) {