• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revisionf89fdc91346995e642534a9c5db4e8cd8289a7da (tree)
Time2014-02-18 17:49:26
AuthorYoshinori Sato <ysato@sa76...>
CommiterYoshinori Sato

Log Message

cosmetic update

Change Summary

Incremental Difference

--- a/main.c
+++ b/main.c
@@ -39,11 +39,13 @@ const static struct option long_options[] = {
3939
4040 static void usage(void)
4141 {
42- puts(PROGNAME " [-p port][-f input clock frequency][-b][--userboot][-l][-V] filename");
42+ puts(PROGNAME "-f input clock frequency [-p port]]"
43+ "[-b][--userboot][-l][-V] filename");
4344 }
4445
4546 /* read raw binary */
46-static int write_binary(FILE *fp, struct writeinfo_t *writeinfo, struct port_t *p)
47+static int write_binary(FILE *fp, struct writeinfo_t *writeinfo,
48+ struct port_t *p)
4749 {
4850 int fno;
4951 struct stat bin_st;
@@ -55,7 +57,8 @@ static int write_binary(FILE *fp, struct writeinfo_t *writeinfo, struct port_t *
5557 fstat(fno, &bin_st);
5658 bin_len = bin_st.st_size;
5759
58- if ((bin_buf = (unsigned char *)mmap(NULL, bin_len, PROT_READ, MAP_SHARED, fno, 0)) == MAP_FAILED)
60+ if ((bin_buf = (unsigned char *)mmap(NULL, bin_len, PROT_READ,
61+ MAP_SHARED, fno, 0)) == MAP_FAILED)
5962 goto error_perror;
6063 writeinfo->area.end = bin_len - 1;
6164 if (!write_rom(p, bin_buf, writeinfo))
@@ -88,13 +91,15 @@ static int write_srec(FILE *fp, struct writeinfo_t *writeinfo, struct port_t *p)
8891 const static int address_len[]={0,4,6,8,0,0,0,8,6,4};
8992 int r = 0;
9093 int l;
94+ unsigned int romsize;
9195
92- romimage = (unsigned char *)malloc(writeinfo->area.end - writeinfo->area.start + 1);
96+ romsize = writeinfo->area.end - writeinfo->area.start + 1;
97+ romimage = (unsigned char *)malloc(romsize);
9398 if (!romimage) {
9499 perror(PROGNAME);
95100 goto error;
96101 }
97- memset(romimage, 0xff, writeinfo->area.end - writeinfo->area.start + 1);
102+ memset(romimage, 0xff, romsize);
98103
99104 while (fgets(linebuf, sizeof(linebuf), fp)) {
100105 /* check valid Srecord */
@@ -126,7 +131,8 @@ static int write_srec(FILE *fp, struct writeinfo_t *writeinfo, struct port_t *p)
126131 /* area check */
127132 if (addr < writeinfo->area.start ||
128133 (addr + len - 1) > writeinfo->area.end) {
129- fprintf(stderr, "srec address %08x is out of romarea\n", addr);
134+ fprintf(stderr,
135+ "srec address %08x is out of rom\n", addr);
130136 goto error;
131137 }
132138 bufp = romimage + addr - writeinfo->area.start;