Skip to content

Commit

Permalink
Merge pull request #1392 from Ilgrim/develop
Browse files Browse the repository at this point in the history
Modifications to allow building of toolset in OpenBSD
  • Loading branch information
Nightwalker-87 authored May 29, 2024
2 parents 3655871 + 0cb0793 commit 91d7033
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/st-flash/flash_opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <helper.h>

static bool starts_with(const char * str, const char * prefix) {
uint32_t n = strlen(prefix);
uint32_t n = (uint32_t)strlen(prefix);

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

Expand Down Expand Up @@ -70,7 +70,7 @@ static int32_t get_integer_from_char_array (const char *const str, uint32_t *rea
fprintf (stderr, "*** Error: Integer greater than UINT32_MAX, cannot convert to int32_t\n");
return (-1);
} else {
*read_value = value;
*read_value = (uint32_t)value;
return (0);
}
}
Expand Down Expand Up @@ -201,7 +201,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
if (result != 0) {
return (bad_arg ("--flash"));
} else {
o->flash_size = (size_t)flash_size;
o->flash_size = (uint32_t)flash_size;
}
} else if (strcmp(av[0], "--connect-under-reset") == 0) {
o->connect = CONNECT_UNDER_RESET;
Expand Down Expand Up @@ -261,7 +261,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
if (result != 0) {
return bad_arg ("size");
} else {
o->size = (size_t) size;
o->size = (uint32_t) size;
}
}

Expand All @@ -285,7 +285,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
if (result != 0) {
return bad_arg ("size");
} else {
o->size = (size_t) size;
o->size = (uint32_t) size;
}

break;
Expand All @@ -302,7 +302,7 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
if (result != 0) {
return bad_arg("option bytes read: invalid size");
} else {
o->size = (size_t) size;
o->size = (uint32_t) size;
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/st-info/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void stlink_probe(enum connect_type connect, int32_t freq) {
stlink_t **stdevs;
uint32_t size;

size = stlink_probe_usb(&stdevs, connect, freq);
size = (uint32_t)stlink_probe_usb(&stdevs, connect, freq);

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

Expand Down
2 changes: 1 addition & 1 deletion src/st-util/gdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ int32_t serve(stlink_t *sl, st_state_t *st) {
params = separator + 1;
}

uint32_t hex_len = strlen(params);
uint32_t hex_len = (uint32_t)strlen(params);
uint32_t alloc_size = (hex_len / 2) + 1;
uint32_t cmd_len;
char *cmd = malloc(alloc_size);
Expand Down
2 changes: 1 addition & 1 deletion src/stlink-lib/chipid.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void init_chipids(char *dir_to_scan) {

if (d) {
while ((dir = readdir(d)) != NULL) {
nl = strlen(dir->d_name);
nl = (uint32_t)strlen(dir->d_name);

if (strcmp(dir->d_name + nl - 5, ".chip") == 0) {
char buf[1024];
Expand Down
2 changes: 1 addition & 1 deletion src/stlink-lib/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ int32_t stlink_parse_ihex(const char *path, uint8_t erased_pattern, uint8_t **me
break;
}

uint32_t l = strlen(line);
uint32_t l = (uint32_t)strlen(line);

while (l > 0 && (line[l - 1] == '\n' || line[l - 1] == '\r')) {
--l;
Expand Down
2 changes: 1 addition & 1 deletion src/stlink-lib/flash_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ int32_t stlink_flashloader_write(stlink_t *sl, flash_loader_t *fl, stm32_addr_t
if (stm32l1_write_half_pages(sl, fl, addr, base, len, pagesize)) {
return (-1);
} else {
off = (size_t)(len / pagesize) * pagesize;
off = (uint32_t)(len / pagesize) * pagesize;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stlink-lib/map_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int32_t map_file(mapped_file_t *mf, const char *path) {
goto on_error;
}

mf->len = (size_t)st.st_size;
mf->len = (uint32_t)st.st_size;
error = 0; // success

on_error:
Expand Down
4 changes: 2 additions & 2 deletions src/stlink-lib/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, enum connect_type connect,

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

uint32_t serial_len = stlink_serial(handle, &desc, sl->serial);
uint32_t serial_len = (uint32_t)stlink_serial(handle, &desc, sl->serial);

libusb_close(handle);

Expand Down Expand Up @@ -1376,7 +1376,7 @@ static uint32_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[],
break;
}

uint32_t serial_len = stlink_serial(handle, &desc, serial);
uint32_t serial_len = (uint32_t)stlink_serial(handle, &desc, serial);

libusb_close(handle);

Expand Down

0 comments on commit 91d7033

Please sign in to comment.