Commit 2b22d608f370565c87f55928b524207031419c11
Committed by
Wolfgang Denk
1 parent
e90fb6afab
Exists in
master
and in
54 other branches
loads: allow negative offsets
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
common/cmd_load.c
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | #endif |
39 | 39 | |
40 | 40 | #if defined(CONFIG_CMD_LOADS) |
41 | -static ulong load_serial (ulong offset); | |
41 | +static ulong load_serial (long offset); | |
42 | 42 | static int read_record (char *buf, ulong len); |
43 | 43 | # if defined(CONFIG_CMD_SAVES) |
44 | 44 | static int save_serial (ulong offset, ulong size); |
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | #if defined(CONFIG_CMD_LOADS) |
54 | 54 | int do_load_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) |
55 | 55 | { |
56 | - ulong offset = 0; | |
56 | + long offset = 0; | |
57 | 57 | ulong addr; |
58 | 58 | int i; |
59 | 59 | char *env_echo; |
... | ... | @@ -72,7 +72,7 @@ |
72 | 72 | |
73 | 73 | #ifdef CFG_LOADS_BAUD_CHANGE |
74 | 74 | if (argc >= 2) { |
75 | - offset = simple_strtoul(argv[1], NULL, 16); | |
75 | + offset = simple_strtol(argv[1], NULL, 16); | |
76 | 76 | } |
77 | 77 | if (argc == 3) { |
78 | 78 | load_baudrate = (int)simple_strtoul(argv[2], NULL, 10); |
... | ... | @@ -95,7 +95,7 @@ |
95 | 95 | } |
96 | 96 | #else /* ! CFG_LOADS_BAUD_CHANGE */ |
97 | 97 | if (argc == 2) { |
98 | - offset = simple_strtoul(argv[1], NULL, 16); | |
98 | + offset = simple_strtol(argv[1], NULL, 16); | |
99 | 99 | } |
100 | 100 | #endif /* CFG_LOADS_BAUD_CHANGE */ |
101 | 101 | |
... | ... | @@ -141,7 +141,7 @@ |
141 | 141 | } |
142 | 142 | |
143 | 143 | static ulong |
144 | -load_serial (ulong offset) | |
144 | +load_serial (long offset) | |
145 | 145 | { |
146 | 146 | char record[SREC_MAXRECLEN + 1]; /* buffer for one S-Record */ |
147 | 147 | char binbuf[SREC_MAXBINLEN]; /* buffer for binary data */ |