summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-07-05 21:15:41 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-07-05 21:15:41 +0000
commit1f422e5f2b343d35a8c77ce4be16f74b2819b2bf (patch)
treee24bdebe86afcff3ce29cc0f47f05caec7ab7bc0
parent952e7cc56afa29f77a828aa256985ba38a06fa80 (diff)
Fix some GCC 4.0 warnings
-rw-r--r--cups/hcrp.c3
-rw-r--r--dund/dun.c3
-rw-r--r--dund/main.c3
-rw-r--r--extra/bcm203x.c4
-rw-r--r--hcid/main.c4
-rw-r--r--hcid/parser.y12
-rw-r--r--hcid/security.c6
-rw-r--r--hcid/storage.c2
-rw-r--r--pand/main.c11
-rw-r--r--rfcomm/main.c6
-rw-r--r--sdpd/main.c2
-rw-r--r--test/attest.c2
-rw-r--r--test/hstest.c3
-rw-r--r--test/l2test.c4
-rw-r--r--test/scotest.c7
-rw-r--r--tools/avctrl.c2
-rw-r--r--tools/ciptool.c3
-rw-r--r--tools/dfu.c8
-rw-r--r--tools/dfu.h4
-rw-r--r--tools/dfutool.c4
-rw-r--r--tools/hcitool.c8
-rw-r--r--tools/hid2hci.c2
-rw-r--r--tools/sdptool.c4
23 files changed, 60 insertions, 47 deletions
diff --git a/cups/hcrp.c b/cups/hcrp.c
index 751715241..c8c26f928 100644
--- a/cups/hcrp.c
+++ b/cups/hcrp.c
@@ -176,8 +176,9 @@ int hcrp_print(bdaddr_t *src, bdaddr_t *dst, unsigned short ctrl_psm, unsigned s
{
struct sockaddr_l2 addr;
struct l2cap_options opts;
+ socklen_t size;
unsigned char buf[2048];
- int i, size, ctrl_sk, data_sk, mtu, count, len, timeout = 0;
+ int i, ctrl_sk, data_sk, mtu, count, len, timeout = 0;
uint8_t status;
uint16_t tid = 0;
uint32_t tmp, credit = 0;
diff --git a/dund/dun.c b/dund/dun.c
index 6611ad86c..0593cb854 100644
--- a/dund/dun.c
+++ b/dund/dun.c
@@ -182,7 +182,8 @@ static int dun_create_tty(int sk, char *tty, int size)
{
struct sockaddr_rc sa;
struct stat st;
- int id, alen, try = 3;
+ socklen_t alen;
+ int id, try = 3;
struct rfcomm_dev_req req = {
flags: (1 << RFCOMM_REUSE_DLC) | (1 << RFCOMM_RELEASE_ONHUP),
diff --git a/dund/main.c b/dund/main.c
index 2bc4f9b5b..a620c8de8 100644
--- a/dund/main.c
+++ b/dund/main.c
@@ -163,7 +163,8 @@ static int do_listen(void)
listen(sk, 10);
while (!terminate) {
- int alen = sizeof(sa), nsk;
+ socklen_t alen = sizeof(sa);
+ int nsk;
char ba[40];
char ch[10];
diff --git a/extra/bcm203x.c b/extra/bcm203x.c
index 1aa9257bc..5990ae8c4 100644
--- a/extra/bcm203x.c
+++ b/extra/bcm203x.c
@@ -58,7 +58,7 @@ static char *fw_path = "/lib/firmware";
static int load_file(struct usb_dev_handle *udev, char *filename)
{
- unsigned char buf[4096];
+ char buf[4096];
int fd, err, len;
fd = open(filename, O_RDONLY);
@@ -100,7 +100,7 @@ static void load_firmware(struct usb_device *dev)
{
struct usb_dev_handle *udev;
char filename[PATH_MAX + 1];
- unsigned char buf[16];
+ char buf[16];
udev = usb_open(dev);
if (!udev) {
diff --git a/hcid/main.c b/hcid/main.c
index 57637f3e1..ecfc7db66 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -226,7 +226,7 @@ static void configure_device(int hdev)
if ((device_opts->flags & (1 << HCID_SET_NAME)) && device_opts->name) {
change_local_name_cp cp;
memset(cp.name, 0, sizeof(cp.name));
- expand_name(cp.name, sizeof(cp.name), device_opts->name, hdev);
+ expand_name((char *) cp.name, sizeof(cp.name), device_opts->name, hdev);
hci_send_cmd(s, OGF_HOST_CTL, OCF_CHANGE_LOCAL_NAME,
CHANGE_LOCAL_NAME_CP_SIZE, &cp);
@@ -459,7 +459,7 @@ static gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer dat
ptr = buf;
- if ((err = g_io_channel_read(chan, buf, sizeof(buf), &len))) {
+ if ((err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len))) {
if (err == G_IO_ERROR_AGAIN)
return TRUE;
diff --git a/hcid/parser.y b/hcid/parser.y
index 7616ab56d..d3cbd9367 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -262,14 +262,14 @@ bdaddr:
pkt_type:
WORD {
- int opt;
+ unsigned int opt;
if (!hci_strtoptype($1, &opt))
cfg_error("Unknown packet type '%s'", $1);
$$ = opt;
}
| LIST {
- int opt;
+ unsigned int opt;
if (!hci_strtoptype($1, &opt))
cfg_error("Unknown packet type '%s'", $1);
$$ = opt;
@@ -278,14 +278,14 @@ pkt_type:
link_mode:
WORD {
- int opt;
+ unsigned int opt;
if (!hci_strtolm($1, &opt))
cfg_error("Unknown link mode '%s'", $1);
$$ = opt;
}
| LIST {
- int opt;
+ unsigned int opt;
if (!hci_strtolm($1, &opt))
cfg_error("Unknown link mode '%s'", $1);
$$ = opt;
@@ -294,14 +294,14 @@ link_mode:
link_policy:
WORD {
- int opt;
+ unsigned int opt;
if (!hci_strtolp($1, &opt))
cfg_error("Unknown link policy '%s'", $1);
$$ = opt;
}
| LIST {
- int opt;
+ unsigned int opt;
if (!hci_strtolp($1, &opt))
cfg_error("Unknown link policy '%s'", $1);
$$ = opt;
diff --git a/hcid/security.c b/hcid/security.c
index 921875b35..04f5b9b8f 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -471,7 +471,7 @@ static void remote_name_information(int dev, bdaddr_t *sba, void *ptr)
if (evt->status)
return;
- write_device_name(sba, dba, evt->name);
+ write_device_name(sba, dba, (char *) evt->name);
}
static void remote_version_information(int dev, bdaddr_t *sba, void *ptr)
@@ -518,7 +518,7 @@ static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer
return FALSE;
}
- if ((err = g_io_channel_read(chan, buf, sizeof(buf), &len))) {
+ if ((err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len))) {
if (err == G_IO_ERROR_AGAIN)
return TRUE;
g_io_channel_close(chan);
@@ -664,7 +664,7 @@ void init_security_data(void)
{
/* Set local PIN code */
if (read_default_pin_code() < 0) {
- strcpy(hcid.pin_code, "BlueZ");
+ strcpy((char *) hcid.pin_code, "BlueZ");
hcid.pin_len = 5;
}
diff --git a/hcid/storage.c b/hcid/storage.c
index 284952f47..459ebff67 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -56,7 +56,7 @@ struct list {
};
static struct list *list_add(struct list *list, const bdaddr_t *bdaddr,
- const unsigned char *data, const size_t size)
+ const char *data, const size_t size)
{
struct list *temp = list, *last = list;
diff --git a/pand/main.c b/pand/main.c
index 98b1720de..20fbec19f 100644
--- a/pand/main.c
+++ b/pand/main.c
@@ -127,7 +127,8 @@ static int do_listen(void)
{
struct l2cap_options l2o;
struct sockaddr_l2 l2a;
- int sk, olen, lm;
+ socklen_t olen;
+ int sk, lm;
if (use_sdp)
bnep_sdp_register(role);
@@ -185,7 +186,7 @@ static int do_listen(void)
listen(sk, 10);
while (!terminate) {
- int alen = sizeof(l2a);
+ socklen_t alen = sizeof(l2a);
int nsk;
nsk = accept(sk, (struct sockaddr *) &l2a, &alen);
if (nsk < 0) {
@@ -243,7 +244,8 @@ static int w4_hup(int sk)
}
if (n) {
- int err = 0, olen = sizeof(err);
+ int err = 0;
+ socklen_t olen = sizeof(err);
getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &olen);
syslog(LOG_INFO, "%s disconnected%s%s", netdev,
err ? " : " : "", err ? strerror(err) : "");
@@ -265,7 +267,8 @@ static int create_connection(char *dst, bdaddr_t *bdaddr)
{
struct l2cap_options l2o;
struct sockaddr_l2 l2a;
- int sk, olen, r = 0;
+ socklen_t olen;
+ int sk, r = 0;
syslog(LOG_INFO, "Connecting to %s", dst);
diff --git a/rfcomm/main.c b/rfcomm/main.c
index 86331b9da..decabcc6f 100644
--- a/rfcomm/main.c
+++ b/rfcomm/main.c
@@ -258,8 +258,9 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
struct termios ti;
struct sigaction sa;
struct pollfd p;
+ socklen_t alen;
char dst[18], devname[MAXPATHLEN];
- int sk, fd, alen, try = 3;
+ int sk, fd, try = 3;
laddr.rc_family = AF_BLUETOOTH;
bacpy(&laddr.rc_bdaddr, bdaddr);
@@ -395,8 +396,9 @@ static void cmd_listen(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv
struct termios ti;
struct sigaction sa;
struct pollfd p;
+ socklen_t alen;
char dst[18], devname[MAXPATHLEN];
- int sk, nsk, fd, alen, try = 3;
+ int sk, nsk, fd, try = 3;
laddr.rc_family = AF_BLUETOOTH;
bacpy(&laddr.rc_bdaddr, bdaddr);
diff --git a/sdpd/main.c b/sdpd/main.c
index fc3dd22d4..b80fc0bbf 100644
--- a/sdpd/main.c
+++ b/sdpd/main.c
@@ -316,7 +316,7 @@ static int become_daemon(void)
static inline void handle_request(int sk, char *data, int len)
{
struct sockaddr_l2 sa;
- int size;
+ socklen_t size;
sdp_req_t req;
size = sizeof(sa);
diff --git a/test/attest.c b/test/attest.c
index cd0e93caa..6e7d38088 100644
--- a/test/attest.c
+++ b/test/attest.c
@@ -47,7 +47,7 @@ static int at_command(int fd, char *cmd, int to)
{
fd_set rfds;
struct timeval timeout;
- unsigned char buf[1024];
+ char buf[1024];
int sel, len, i, n;
write(fd, cmd, strlen(cmd));
diff --git a/test/hstest.c b/test/hstest.c
index f269621cf..8949be4bc 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -89,7 +89,8 @@ static int sco_connect(bdaddr_t *src, bdaddr_t *dst, uint16_t *handle, uint16_t
struct sockaddr_sco addr;
struct sco_conninfo conn;
struct sco_options opts;
- int s, size;
+ socklen_t size;
+ int s;
if ((s = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO)) < 0) {
return -1;
diff --git a/test/l2test.c b/test/l2test.c
index 8d337a9d0..f475aa4b8 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -131,7 +131,7 @@ static char *ctoh(char c, char* s)
return s;
}
-static void hexdump(char *s, unsigned long l)
+static void hexdump(unsigned char *s, unsigned long l)
{
char bfr[80];
char *pb;
@@ -477,7 +477,7 @@ static void dump_mode(int sk)
}
syslog(LOG_INFO, "Recevied %d bytes", len);
- hexdump(buf,len);
+ hexdump(buf, len);
}
}
diff --git a/test/scotest.c b/test/scotest.c
index 6447eab43..22a95fed0 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -251,8 +251,9 @@ static void recv_mode(int sk)
static void send_mode(char *svr)
{
struct sco_options so;
+ socklen_t len;
uint32_t seq;
- int sk, i, opt;
+ int i, sk;
if ((sk = do_connect(svr)) < 0) {
syslog(LOG_ERR, "Can't connect to the server: %s (%d)",
@@ -260,8 +261,8 @@ static void send_mode(char *svr)
exit(1);
}
- opt = sizeof(so);
- if (getsockopt(sk, SOL_SCO, SCO_OPTIONS, &so, &opt) < 0) {
+ len = sizeof(so);
+ if (getsockopt(sk, SOL_SCO, SCO_OPTIONS, &so, &len) < 0) {
syslog(LOG_ERR, "Can't get SCO options: %s (%d)",
strerror(errno), errno);
exit(1);
diff --git a/tools/avctrl.c b/tools/avctrl.c
index 120a382f8..14d42e4aa 100644
--- a/tools/avctrl.c
+++ b/tools/avctrl.c
@@ -82,7 +82,7 @@ struct device_info {
static int dongle_csr(struct device_info *devinfo)
{
- unsigned char buf[8];
+ char buf[8];
struct usb_dev_handle *udev;
int err, intf = 2;
diff --git a/tools/ciptool.c b/tools/ciptool.c
index 7c952cf43..38446f93d 100644
--- a/tools/ciptool.c
+++ b/tools/ciptool.c
@@ -134,7 +134,8 @@ static int do_connect(int ctl, int dev_id, bdaddr_t *src, bdaddr_t *dst, unsigne
struct hci_dev_info di;
struct sockaddr_l2 addr;
struct l2cap_options opts;
- int sk, size;
+ socklen_t size;
+ int sk;
hci_devinfo(dev_id, &di);
if (!(di.link_policy & HCI_LP_RSWITCH)) {
diff --git a/tools/dfu.c b/tools/dfu.c
index b46027a05..bfbc0f2d4 100644
--- a/tools/dfu.c
+++ b/tools/dfu.c
@@ -114,7 +114,7 @@ int dfu_detach(struct usb_dev_handle *udev, int intf)
DFU_DETACH, 0x1388, intf, NULL, 0, DFU_TIMEOUT);
}
-int dfu_upload(struct usb_dev_handle *udev, int intf, int block, unsigned char *buffer, int size)
+int dfu_upload(struct usb_dev_handle *udev, int intf, int block, char *buffer, int size)
{
if (!udev)
return -EIO;
@@ -123,7 +123,7 @@ int dfu_upload(struct usb_dev_handle *udev, int intf, int block, unsigned char *
DFU_UPLOAD, block, intf, buffer, size, DFU_TIMEOUT);
}
-int dfu_download(struct usb_dev_handle *udev, int intf, int block, unsigned char *buffer, int size)
+int dfu_download(struct usb_dev_handle *udev, int intf, int block, char *buffer, int size)
{
if (!udev)
return -EIO;
@@ -138,7 +138,7 @@ int dfu_get_status(struct usb_dev_handle *udev, int intf, struct dfu_status *sta
return -EIO;
return usb_control_msg(udev, USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
- DFU_GETSTATUS, 0, intf, (unsigned char *) status, DFU_STATUS_SIZE, DFU_TIMEOUT);
+ DFU_GETSTATUS, 0, intf, (char *) status, DFU_STATUS_SIZE, DFU_TIMEOUT);
}
int dfu_clear_status(struct usb_dev_handle *udev, int intf)
@@ -156,7 +156,7 @@ int dfu_get_state(struct usb_dev_handle *udev, int intf, uint8_t *state)
return -EIO;
return usb_control_msg(udev, USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
- DFU_GETSTATE, 0, intf, (unsigned char *) state, 1, DFU_TIMEOUT);
+ DFU_GETSTATE, 0, intf, (char *) state, 1, DFU_TIMEOUT);
}
int dfu_abort(struct usb_dev_handle *udev, int intf)
diff --git a/tools/dfu.h b/tools/dfu.h
index 1a2535055..915efd8c5 100644
--- a/tools/dfu.h
+++ b/tools/dfu.h
@@ -100,8 +100,8 @@ struct dfu_suffix {
/* DFU interface */
int dfu_detach(struct usb_dev_handle *udev, int intf);
-int dfu_upload(struct usb_dev_handle *udev, int intf, int block, unsigned char *buffer, int size);
-int dfu_download(struct usb_dev_handle *udev, int intf, int block, unsigned char *buffer, int size);
+int dfu_upload(struct usb_dev_handle *udev, int intf, int block, char *buffer, int size);
+int dfu_download(struct usb_dev_handle *udev, int intf, int block, char *buffer, int size);
int dfu_get_status(struct usb_dev_handle *udev, int intf, struct dfu_status *status);
int dfu_clear_status(struct usb_dev_handle *udev, int intf);
int dfu_get_state(struct usb_dev_handle *udev, int intf, uint8_t *state);
diff --git a/tools/dfutool.c b/tools/dfutool.c
index 47510cef1..06da52486 100644
--- a/tools/dfutool.c
+++ b/tools/dfutool.c
@@ -400,7 +400,7 @@ static void cmd_upgrade(char *device, int argc, char **argv)
struct dfu_status status;
struct dfu_suffix suffix;
struct stat st;
- unsigned char *buf;
+ char *buf;
unsigned long filesize, count, timeout = 0;
char *filename;
uint32_t crc;
@@ -568,7 +568,7 @@ static void cmd_archive(char *device, int argc, char **argv)
struct usb_dev_handle *udev;
struct dfu_status status;
struct dfu_suffix suffix;
- unsigned char buf[2048];
+ char buf[2048];
unsigned long timeout = 0;
char *filename;
uint32_t crc;
diff --git a/tools/hcitool.c b/tools/hcitool.c
index ceddeda5a..156b0790d 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -819,7 +819,7 @@ static char *cmd_help =
static void cmd_cmd(int dev_id, int argc, char **argv)
{
- char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
+ unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
struct hci_filter flt;
hci_event_hdr *hdr;
int i, opt, len, dd;
@@ -940,9 +940,10 @@ static char *cc_help =
static void cmd_cc(int dev_id, int argc, char **argv)
{
bdaddr_t bdaddr;
- int opt, ptype, dd;
uint16_t handle;
uint8_t role;
+ unsigned int ptype;
+ int dd, opt;
role = 0x01;
ptype = HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 | HCI_DH5;
@@ -1451,7 +1452,8 @@ static void cmd_cpt(int dev_id, int argc, char **argv)
set_conn_ptype_cp cp;
evt_conn_ptype_changed rp;
bdaddr_t bdaddr;
- int opt, dd, ptype;
+ unsigned int ptype;
+ int dd, opt;
for_each_opt(opt, cpt_options, NULL) {
switch (opt) {
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index 115e0ef52..9a85c1fda 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -130,7 +130,7 @@ static int switch_hidproxy(struct device_info *devinfo)
return err;
}
-static int send_report(int fd, const unsigned char *buf, size_t size)
+static int send_report(int fd, const char *buf, size_t size)
{
struct hiddev_report_info rinfo;
struct hiddev_usage_ref uref;
diff --git a/tools/sdptool.c b/tools/sdptool.c
index 97282e8d9..3a2ce8343 100644
--- a/tools/sdptool.c
+++ b/tools/sdptool.c
@@ -874,7 +874,7 @@ static int set_attribseq(sdp_session_t *session, uint32_t handle, uint16_t attri
if (!strncasecmp(argv[i], "u0x", 3)) {
/* UUID16 */
uint16_t value_int = strtoul((argv[i]) + 3, NULL, 16);
- uuid_t *value_uuid = (uuid_t *)malloc(sizeof(uuid_t));
+ uuid_t *value_uuid = (uuid_t *) malloc(sizeof(uuid_t));
allocArray[i] = value_uuid;
sdp_uuid16_create(value_uuid, value_int);
@@ -883,7 +883,7 @@ static int set_attribseq(sdp_session_t *session, uint32_t handle, uint16_t attri
valueArray[i] = &value_uuid->value.uuid16;
} else if (!strncasecmp(argv[i], "0x", 2)) {
/* Int */
- uint32_t *value_int = (int *)malloc(sizeof(int));
+ uint32_t *value_int = (uint32_t *) malloc(sizeof(int));
allocArray[i] = value_int;
*value_int = strtoul((argv[i]) + 2, NULL, 16);