Skip to content

Commit 54d6de5

Browse files
Fixed compilation on FreeBSD
(Closes #1463)
1 parent 296aa36 commit 54d6de5

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/st-flash/flash_opts.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <helper.h>
1818

1919
static bool starts_with(const char * str, const char * prefix) {
20-
uint32_t n = (uint32_t) strlen(prefix);
20+
uint64_t n = strlen(prefix);
2121

2222
if(strlen(str) < n) { return (false); }
2323

@@ -203,7 +203,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
203203
if(result != 0) {
204204
return (bad_arg ("--flash"));
205205
} else {
206-
o->flash_size = (uint32_t) flash_size;
206+
o->flash_size = flash_size;
207207
}
208208
} else if(strcmp(av[0], "--connect-under-reset") == 0) {
209209
o->connect = CONNECT_UNDER_RESET;
@@ -263,7 +263,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
263263
if(result != 0) {
264264
return bad_arg ("size");
265265
} else {
266-
o->size = (uint32_t) size;
266+
o->size = size;
267267
}
268268
}
269269

@@ -287,7 +287,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
287287
if(result != 0) {
288288
return bad_arg ("size");
289289
} else {
290-
o->size = (uint32_t) size;
290+
o->size = size;
291291
}
292292

293293
break;
@@ -304,7 +304,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
304304
if(result != 0) {
305305
return bad_arg("option bytes read: invalid size");
306306
} else {
307-
o->size = (uint32_t) size;
307+
o->size = size;
308308
}
309309
}
310310
break;

src/st-info/info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void stlink_probe(enum connect_type connect, int32_t freq) {
5555
stlink_t **stdevs;
5656
uint32_t size;
5757

58-
size = stlink_probe_usb(&stdevs, connect, freq);
58+
size = (uint32_t) stlink_probe_usb(&stdevs, connect, freq);
5959

6060
printf("Found %u stlink programmers\n", size);
6161

src/stlink-lib/chipid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void process_chipfile(char *fname) {
214214

215215
void init_chipids(char *dir_to_scan) {
216216
DIR *d;
217-
uint32_t nl; // namelen
217+
uint64_t nl; // namelen
218218
struct dirent *dir;
219219

220220
if(!dir_to_scan) {

src/stlink-lib/common_legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ int32_t stlink_parse_ihex(const char *path, uint8_t erased_pattern, uint8_t **me
745745
break;
746746
}
747747

748-
uint32_t l = (uint32_t) strlen(line);
748+
uint64_t l = strlen(line);
749749

750750
while (l > 0 && (line[l - 1] == '\n' || line[l - 1] == '\r')) {
751751
--l;

src/stlink-lib/flash_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ int32_t stlink_flashloader_write(stlink_t *sl, flash_loader_t *fl, stm32_addr_t
838838
if(stm32l1_write_half_pages(sl, fl, addr, base, len, pagesize)) {
839839
return (-1);
840840
} else {
841-
off = (uint32_t) (len / pagesize) * pagesize;
841+
off = (uint32_t) ((uint64_t) (len / pagesize) * pagesize);
842842
}
843843
}
844844

src/stlink-lib/usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, enum connect_type connect,
11921192

11931193
if(ret) { continue; } // could not open device
11941194

1195-
uint32_t serial_len = stlink_serial(handle, &desc, sl->serial);
1195+
uint64_t serial_len = stlink_serial(handle, &desc, sl->serial);
11961196

11971197
libusb_close(handle);
11981198

@@ -1396,7 +1396,7 @@ static uint32_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[],
13961396
break;
13971397
}
13981398

1399-
uint32_t serial_len = stlink_serial(handle, &desc, serial);
1399+
uint64_t serial_len = stlink_serial(handle, &desc, serial);
14001400

14011401
libusb_close(handle);
14021402

0 commit comments

Comments
 (0)