2014-05-14 19:49:07

by Szymon Janc

[permalink] [raw]
Subject: [PATCH 1/3] input: Fix compilation errors on 32 bit machine

Fix following with GCC version 4.8.2 (Debian 4.8.2-21):

CC profiles/input/bluetoothd-device.o
profiles/input/device.c: In function ‘uhid_send_feature_answer’:
profiles/input/device.c:232:8: error: format ‘%lu’ expects argument
of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
[-Werror=format=]
len, sizeof(ev));
^
profiles/input/device.c: In function ‘uhid_send_input_report’:
profiles/input/device.c:274:8: error: format ‘%lu’ expects argument of
type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
[-Werror=format=]
len, sizeof(ev));
^
---
profiles/input/device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 3e89e2d..52222ea 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -228,7 +228,7 @@ static bool uhid_send_feature_answer(struct input_device *idev,

/* uHID kernel driver does not handle partial writes */
if ((size_t) len < sizeof(ev)) {
- error("uHID dev write error: partial write (%zd of %lu bytes)",
+ error("uHID dev write error: partial write (%zd of %zu bytes)",
len, sizeof(ev));
return false;
}
@@ -270,7 +270,7 @@ static bool uhid_send_input_report(struct input_device *idev,

/* uHID kernel driver does not handle partial writes */
if ((size_t) len < sizeof(ev)) {
- error("uHID dev write error: partial write (%zd of %lu bytes)",
+ error("uHID dev write error: partial write (%zd of %zu bytes)",
len, sizeof(ev));
return false;
}
--
2.0.0.rc2



2014-05-14 20:15:11

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 1/3] input: Fix compilation errors on 32 bit machine

Hi Szymon,

On Wed, May 14, 2014, Szymon Janc wrote:
> Fix following with GCC version 4.8.2 (Debian 4.8.2-21):
>
> CC profiles/input/bluetoothd-device.o
> profiles/input/device.c: In function ‘uhid_send_feature_answer’:
> profiles/input/device.c:232:8: error: format ‘%lu’ expects argument
> of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
> [-Werror=format=]
> len, sizeof(ev));
> ^
> profiles/input/device.c: In function ‘uhid_send_input_report’:
> profiles/input/device.c:274:8: error: format ‘%lu’ expects argument of
> type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
> [-Werror=format=]
> len, sizeof(ev));
> ^
> ---
> profiles/input/device.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

All three patches have been applied. Thanks.

Johan

2014-05-14 19:49:09

by Szymon Janc

[permalink] [raw]
Subject: [PATCH 3/3] tools: Fix hex2hcd compilation error

Fix following with GCC version 4.8.2 (Debian 4.8.2-21):

tools/hex2hcd.c: In function ‘main’:
tools/hex2hcd.c:118:19: error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]
for (i = 0; i < hex_to_int(rbuf + 1); i++) {
^
cc1: all warnings being treated as errors
---
tools/hex2hcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/hex2hcd.c b/tools/hex2hcd.c
index c5e5e1f..d9b5d3b 100644
--- a/tools/hex2hcd.c
+++ b/tools/hex2hcd.c
@@ -70,10 +70,10 @@ static int check_hex_line(const char *str, unsigned int len)

int main(int argc, char *argv[])
{
- unsigned int addr = 0;
+ unsigned int i, addr = 0;
FILE *ifp, *ofp;
char *rbuf;
- ssize_t len, i;
+ ssize_t len;
size_t buflen;

if (argc != 3) {
--
2.0.0.rc2


2014-05-14 19:49:08

by Szymon Janc

[permalink] [raw]
Subject: [PATCH 2/3] hog: Fix compilation error on 32 bit machine

Fix following with GCC version 4.8.2 (Debian 4.8.2-21):

CC profiles/input/bluetoothd-hog.o
profiles/input/hog.c: In function ‘report_value_cb’:
profiles/input/hog.c:149:8: error: format ‘%lu’ expects argument of
type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
[-Werror=format=]
status, sizeof(ev));
^
---
profiles/input/hog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index c196f65..e82e827 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -145,7 +145,7 @@ static void report_value_cb(const guint8 *pdu, guint16 len, gpointer user_data)

/* uHID kernel driver does not handle partial writes */
if ((size_t) status < sizeof(ev)) {
- error("uHID dev write error: partial write (%zd of %lu bytes)",
+ error("uHID dev write error: partial write (%zd of %zu bytes)",
status, sizeof(ev));
return;
}
--
2.0.0.rc2