From: notaz Date: Sun, 15 Mar 2009 16:26:43 +0000 (+0000) Subject: minor adjustments X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43c53abb4a702a51e62f98609eacbcf9ea5c22f6;p=megadrive.git minor adjustments --- diff --git a/mx/linux/sms2mx.c b/mx/linux/sms2mx.c index 2dd4292..6b084ea 100644 --- a/mx/linux/sms2mx.c +++ b/mx/linux/sms2mx.c @@ -1,8 +1,9 @@ #include #include -#define IN_SIZE 0x8000 -static unsigned char buff[0x400000], buff_in[IN_SIZE]; +#define IN_SIZE 0x8000 +#define OUT_SIZE 0x400000 +static unsigned char buff[OUT_SIZE], buff_in[IN_SIZE]; int main(int argc, char *argv[]) { @@ -44,10 +45,10 @@ int main(int argc, char *argv[]) for (bsize = 1; bsize < size; bsize <<= 1) ; - for (i = 0, o = 0; o < sizeof(buff); i = (i + 1) & (bsize - 1), o += 2) - buff[o] = buff[o+1] = buff_in[i]; + for (i = o = 0; o < sizeof(buff); i = (i + 1) & (bsize - 1), o += 2) + buff[o+1] = buff_in[i]; - if (fwrite(buff, 1, 0x400000, fo) != 0x400000) + if (fwrite(buff, 1, OUT_SIZE, fo) != OUT_SIZE) fprintf(stderr, "failed to write to %s\n", argv[2]); fclose(fi); fclose(fo);