From ba255beb79afb9c00ae5b71821f84f911aa8d1fe Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 28 Jan 2008 10:38:40 +0000 Subject: Whitespace cleanup --- audio/avdtp.c | 2 +- common/sdp-xml.c | 23 +++++++++++------------ hcid/adapter.c | 8 +++----- hcid/dbus-api.txt | 20 ++++++++++---------- hcid/dbus-database.c | 2 +- hcid/dbus-error.c | 2 +- hcid/dbus-hci.c | 19 ++++++------------- hcid/dbus-sdp.c | 4 ++-- hcid/security.c | 2 +- input/device.c | 22 +++++++++++----------- sbc/sbc.c | 2 +- serial/manager.c | 8 ++++---- serial/port.c | 2 +- serial/serial-api.txt | 2 +- 14 files changed, 54 insertions(+), 64 deletions(-) diff --git a/audio/avdtp.c b/audio/avdtp.c index 55addb0b..30716f44 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -1259,7 +1259,7 @@ static gboolean avdtp_suspend_cmd(struct avdtp *session, error("Too short suspend request"); return FALSE; } - + seid_count = 1 + size - sizeof(struct suspend_req); seid = &req->first_seid; diff --git a/common/sdp-xml.c b/common/sdp-xml.c index 5aeca405..bf3eb0c3 100644 --- a/common/sdp-xml.c +++ b/common/sdp-xml.c @@ -237,7 +237,7 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, hex = 0; int num_chars_to_escape = 0; - + for (i = 0; i < value->unitSize; i++) { if (i == (value->unitSize - 1) && value->val.str[i] == '\0') @@ -246,16 +246,15 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, hex = 1; break; } - + /* XML is evil, must do this... */ if ((value->val.str[i] == '<') || - (value->val.str[i] == '>') || - (value->val.str[i] == '"') || - (value->val.str[i] == '&')) - num_chars_to_escape++; - + (value->val.str[i] == '>') || + (value->val.str[i] == '"') || + (value->val.str[i] == '&')) + num_chars_to_escape++; } - + appender(data, indent); appender(data, "val.dataseq, indent_level + 1, data, appender); - + appender(data, indent); appender(data, "\n"); - + break; case SDP_ALT8: @@ -358,7 +357,7 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, appender(data, indent); appender(data, "\n"); - + break; } @@ -577,7 +576,7 @@ sdp_data_t *sdp_xml_parse_int(const char * data, uint8_t dtd) case SDP_INT64: { int64_t val = strtoull(data, &endptr, 0); - + /* Failed to parse */ if ((endptr != data) && (*endptr != '\0')) return NULL; diff --git a/hcid/adapter.c b/hcid/adapter.c index c3fa8d1c..08fecda7 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -1845,7 +1845,7 @@ static DBusHandlerResult adapter_clear_remote_alias(DBusConnection *conn, str2ba(addr_ptr, &bdaddr); ecode = get_device_alias(adapter->dev_id, &bdaddr, NULL, 0); - if (ecode == -ENXIO) + if (ecode == -ENXIO) had_alias = 0; ecode = set_device_alias(adapter->dev_id, &bdaddr, NULL); @@ -2820,10 +2820,8 @@ static DBusHandlerResult adapter_cancel_discovery(DBusConnection *conn, strcmp(adapter->discov_requestor, dbus_message_get_sender(msg))) return error_not_authorized(conn, msg); - /* - * Cleanup the discovered devices list and send the cmd - * to cancel inquiry or cancel remote name request - */ + /* Cleanup the discovered devices list and send the cmd to cancel + * inquiry or cancel remote name request */ err = cancel_discovery(adapter); if (err < 0) { if (err == -ENODEV) diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index 51a2eff7..feeb8130 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -52,9 +52,9 @@ Error hierarchy Interface org.bluez.Error Shared Errors (Can be thrown by hcid or any bluetooth service) - + DeviceUnreachable - + The remote device is either powered down or out of range. AlreadyConnected @@ -82,7 +82,7 @@ Shared Errors (Can be thrown by hcid or any bluetooth service) InvalidArguments The DBUS request does not contain the right number of - arguments with the right type, or the arguments are there + arguments with the right type, or the arguments are there but their value is wrong, or does not makes sense in the current context. @@ -96,8 +96,8 @@ Shared Errors (Can be thrown by hcid or any bluetooth service) Error returned when a specified record is not available. - NotSupported - + NotSupported + The remote device does not support the expected feature. @@ -123,7 +123,7 @@ Hcid specific Errors (Can be thrown by hcid only) Error returned when the adapter is DOWN. UnknwownMethod - + This is an experimental method. NotAuthorized @@ -140,9 +140,9 @@ Hcid specific Errors (Can be thrown by hcid only) exists. This error is similar to ENODEV. NoSuchService - + RequestDeferred - + NotInProgress UnsupportedMajorClass @@ -1164,7 +1164,7 @@ Signals void ModeChanged(string mode) Signals that a bonding was removed. void TrustAdded(string address) - + Sent when SetTrusted() is called. void TrustRemoved(string address) @@ -1261,7 +1261,7 @@ Signals void Started() was stopped. void TrustAdded(string address) - + Sent when SetTrusted() is called. void TrustRemoved(string address) diff --git a/hcid/dbus-database.c b/hcid/dbus-database.c index 8b4060b4..a954d11f 100644 --- a/hcid/dbus-database.c +++ b/hcid/dbus-database.c @@ -491,7 +491,7 @@ static DBusHandlerResult cancel_authorization_request(DBusConnection *conn, } static DBusMethodVTable database_methods[] = { - { "AddServiceRecord", add_service_record, "ay", "u" }, + { "AddServiceRecord", add_service_record, "ay", "u" }, { "AddServiceRecordFromXML", add_service_record_from_xml, "s", "u" }, { "UpdateServiceRecord", update_service_record, "uay", "" }, { "UpdateServiceRecordFromXML", update_service_record_from_xml, "us", "" }, diff --git a/hcid/dbus-error.c b/hcid/dbus-error.c index 26a0ffa6..10a201f7 100644 --- a/hcid/dbus-error.c +++ b/hcid/dbus-error.c @@ -54,7 +54,7 @@ DBusHandlerResult error_unknown_method(DBusConnection *conn, DBusMessage *msg) snprintf(error, 128, "Method \"%s\" with signature \"%s\" on interface \"%s\" doesn't exist", method, signature, interface); - + return send_message_and_unref(conn, dbus_message_new_error(msg, ERROR_INTERFACE ".UnknownMethod", error)); diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c index 1a21af4b..e5114517 100644 --- a/hcid/dbus-hci.c +++ b/hcid/dbus-hci.c @@ -1451,10 +1451,8 @@ void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status, g_slist_free(adapter->found_devices); adapter->found_devices = NULL; - /* - * The discovery completed signal must be sent only for discover - * devices request WITH name resolving - */ + /* The discovery completed signal must be sent only for discover + * devices request WITH name resolving */ if (adapter->discov_requestor) { name_listener_remove(connection, adapter->discov_requestor, (name_cb_t) discover_devices_req_exit, adapter); @@ -2016,11 +2014,8 @@ void discover_devices_req_exit(const char *name, struct adapter *adapter) { debug("DiscoverDevices requestor (%s) exited", name); - /* - * Cleanup the discovered devices list and send the command to - * cancel inquiry or cancel remote name request. The return - * can be ignored. - */ + /* Cleanup the discovered devices list and send the command to cancel + * inquiry or cancel remote name request. The return can be ignored. */ cancel_discovery(adapter); } @@ -2139,11 +2134,9 @@ void periodic_discover_req_exit(const char *name, struct adapter *adapter) { debug("PeriodicDiscovery requestor (%s) exited", name); - /* - * Cleanup the discovered devices list and send the cmd to exit from + /* Cleanup the discovered devices list and send the cmd to exit from * periodic inquiry or cancel remote name request. The return value can - * be ignored. - */ + * be ignored. */ cancel_periodic_discovery(adapter); } diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index 4036f4fd..f456cebf 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -163,7 +163,7 @@ static int get_bdaddrs(int sock, bdaddr_t *sba, bdaddr_t *dba) error("getsockname: %s (%d)", strerror(errno), errno); return -1; } - + bacpy(sba, &a.l2_bdaddr); len = sizeof(a); @@ -562,7 +562,7 @@ static void remote_svc_rec_completed_xml_cb(uint8_t type, uint16_t err, src = get_address_from_message(ctxt->conn, ctxt->rq); reply = dbus_message_new_method_return(ctxt->rq); - + rec = sdp_extract_pdu(rsp, &scanned); if (rec == NULL || size != scanned) { error("Invalid service record!"); diff --git a/hcid/security.c b/hcid/security.c index 03907d9d..404ff93c 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -110,7 +110,7 @@ static void hci_req_queue_process(int dev_id) data = l->data; data->status = REQ_SENT; - + ret_val = hci_send_cmd(dd, data->ogf, data->ocf, data->clen, data->cparam); if (ret_val < 0) { hci_req_queue = g_slist_remove(hci_req_queue, data); diff --git a/input/device.c b/input/device.c index 66712be2..07ed7d9c 100644 --- a/input/device.c +++ b/input/device.c @@ -96,11 +96,11 @@ static struct device *device_new(bdaddr_t *src, bdaddr_t *dst, uint8_t subclass) if (read_device_class(src, dst, &cls) < 0) return NULL; - major = (cls >> 8) & 0x1f; - minor = (cls >> 2) & 0x3f; + major = (cls >> 8) & 0x1f; + minor = (cls >> 2) & 0x3f; } else { - major = 0x05; /* Peripheral */ - minor = (subclass >> 2) & 0x3f; + major = 0x05; /* Peripheral */ + minor = (subclass >> 2) & 0x3f; } idev = g_new0(struct device, 1); @@ -199,8 +199,8 @@ static const char *create_input_path(uint8_t major, uint8_t minor) static int next_id = 0; switch (major) { - case 0x02: /* Phone */ - strcpy(subpath, "phone"); + case 0x02: /* Phone */ + strcpy(subpath, "phone"); break; case 0x04: /* Audio */ switch (minor) { @@ -274,7 +274,7 @@ static const char *create_input_path(uint8_t major, uint8_t minor) static int decode_key(const char *str) { static int mode = UPDOWN_ENABLED, gain = 0; - + uint16_t key; int new_gain; @@ -335,7 +335,7 @@ static gboolean rfcomm_io_cb(GIOChannel *chan, GIOCondition cond, gpointer data) if (cond & G_IO_NVAL) return FALSE; - + if (cond & (G_IO_HUP | G_IO_ERR)) { error("Hangup or error on rfcomm server socket"); goto failed; @@ -871,7 +871,7 @@ static DBusHandlerResult device_connect(DBusConnection *conn, struct device *idev = data; if (idev->pending_connect) - return error_in_progress(conn, msg, + return error_in_progress(conn, msg, "Device connection already in progress"); if (is_connected(idev)) @@ -887,7 +887,7 @@ static DBusHandlerResult device_connect(DBusConnection *conn, error("RFCOMM connect failed: %s(%d)", str, err); dbus_message_unref(idev->pending_connect); idev->pending_connect = NULL; - return error_connection_attempt_failed(conn, + return error_connection_attempt_failed(conn, msg, err); } return DBUS_HANDLER_RESULT_HANDLED; @@ -987,7 +987,7 @@ static DBusHandlerResult device_get_name(DBusConnection *conn, struct device *idev = data; DBusMessage *reply; const char *pname = (idev->name ? idev->name : ""); - + reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; diff --git a/sbc/sbc.c b/sbc/sbc.c index 0cb839b6..c9ea5b5c 100644 --- a/sbc/sbc.c +++ b/sbc/sbc.c @@ -1154,7 +1154,7 @@ static int sbc_pack_frame(uint8_t *data, struct sbc_frame *frame, size_t len) } /* align the last crc byte */ - if (crc_pos % 8) + if (crc_pos % 8) crc_header[crc_pos >> 3] <<= 8 - (crc_pos % 8); data[3] = sbc_crc8(crc_header, crc_pos); diff --git a/serial/manager.c b/serial/manager.c index b33e30ac..2bbb5999 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -64,7 +64,7 @@ #define BUF_SIZE 1024 /* Waiting for udev to create the device node */ -#define MAX_OPEN_TRIES 5 +#define MAX_OPEN_TRIES 5 #define OPEN_WAIT 300 /* ms */ struct pending_connect { @@ -80,7 +80,7 @@ struct pending_connect { char *dev; /* tty device name */ int id; /* RFCOMM device id */ int ntries; /* Open attempts */ - int canceled; /* Operation canceled */ + int canceled; /* Operation canceled */ }; /* FIXME: Common file required */ @@ -1646,7 +1646,7 @@ static DBusHandlerResult proxy_set_serial_params(DBusConnection *conn, struct proxy *prx = data; const char *ratestr, *paritystr; uint8_t databits, stopbits; - tcflag_t ctrl; /* Control mode flags */ + tcflag_t ctrl; /* Control mode flags */ speed_t speed = B0; /* In/Out speed */ /* Don't allow change TTY settings if it is open */ @@ -1691,7 +1691,7 @@ static DBusMethodVTable proxy_methods[] = { { "Enable", proxy_enable, "", "" }, { "Disable", proxy_disable, "", "" }, { "GetInfo", proxy_get_info, "", "a{sv}" }, - { "SetSerialParameters", proxy_set_serial_params, "syys", "" }, + { "SetSerialParameters", proxy_set_serial_params, "syys", "" }, { NULL, NULL, NULL, NULL }, }; diff --git a/serial/port.c b/serial/port.c index b12a2645..6d82c632 100644 --- a/serial/port.c +++ b/serial/port.c @@ -145,7 +145,7 @@ static DBusHandlerResult port_get_name(DBusConnection *conn, DBusMessage *reply; const char *pname; char *name = NULL; - + reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; diff --git a/serial/serial-api.txt b/serial/serial-api.txt index 96b5d684..7e17b86e 100644 --- a/serial/serial-api.txt +++ b/serial/serial-api.txt @@ -157,7 +157,7 @@ Methods: void Enable() [experimental] void Disable() [experimental] Unregister the service record and stop listenning. - + Possible errors:org.bluez.Error.Failed dict GetInfo() [experimental] -- cgit