Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error on raspbian #869

Closed
koendv opened this issue Feb 28, 2020 · 1 comment · Fixed by #872
Closed

Compilation error on raspbian #869

koendv opened this issue Feb 28, 2020 · 1 comment · Fixed by #872

Comments

@koendv
Copy link

koendv commented Feb 28, 2020

Compilation error on raspbian (arm 32-bit):

/home/koen/src/stm32duino-raspberrypi/STM32Tools/tools/src/stlink/src/usb.c: In function ‘_stlink_usb_version’:
/home/koen/src/stm32duino-raspberrypi/STM32Tools/tools/src/stlink/src/usb.c:192:18: error: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘int’} and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
if (size != rep_len) {
^~
cc1: all warnings being treated as errors

Propose the following patch, to make sure that rep_len and size have the same type (usb.c).

diff --git a/src/usb.c b/src/usb.c
index 9df9d72..ad90baa 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -171,7 +171,7 @@ int _stlink_usb_version(stlink_t *sl) {
     unsigned char* const data = sl->q_buf;
     unsigned char* const cmd  = sl->c_buf;
     ssize_t size;
-    uint32_t rep_len = 6;
+    ssize_t rep_len = 6;
     int i = fill_command(sl, SG_DXFER_FROM_DEV, rep_len);
 
     cmd[i++] = STLINK_GET_VERSION;
@Nightwalker-87
Copy link
Member

Nightwalker-87 commented Mar 21, 2020

Fixed by @slyshykO in PR #872.

@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.