summaryrefslogtreecommitdiffstats
path: root/gisi
diff options
context:
space:
mode:
authorAki Niemi <aki.niemi@nokia.com>2010-12-22 17:47:11 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-12-22 17:47:11 +0200
commit4ca9022358cf84db98c550296ae969bceab14fa1 (patch)
treea2e624d2e2ca82716428c4c7efd106e2def6d3a0 /gisi
parent374dd32812026c3d728f2a14f78357463f12a3f8 (diff)
downloadofono-4ca9022358cf84db98c550296ae969bceab14fa1.tar.bz2
gisi: Minor style fixes
Diffstat (limited to 'gisi')
-rw-r--r--gisi/client.c5
-rw-r--r--gisi/iter.c23
-rw-r--r--gisi/iter.h2
-rw-r--r--gisi/modem.c9
-rw-r--r--gisi/pipe.c2
5 files changed, 26 insertions, 15 deletions
diff --git a/gisi/client.c b/gisi/client.c
index 267bfc5e..335a8326 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -184,8 +184,9 @@ GIsiPending *g_isi_client_send(GIsiClient *client, const void *__restrict buf,
if (pd == NULL)
return NULL;
- op = g_isi_request_send(client->modem, client->resource, buf, len, timeout,
- pending_resp_notify, pd, pending_destroy);
+ op = g_isi_request_send(client->modem, client->resource, buf, len,
+ timeout, pending_resp_notify, pd,
+ pending_destroy);
if (op == NULL) {
g_free(pd);
return NULL;
diff --git a/gisi/iter.c b/gisi/iter.c
index d9c111fd..a925b158 100644
--- a/gisi/iter.c
+++ b/gisi/iter.c
@@ -91,9 +91,9 @@ void g_isi_sb_subiter_init(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
inner->sub_blocks = len > used ? inner->start[-1] : 0;
}
-void g_isi_sb_subiter_init_full(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
- size_t used, gboolean longhdr,
- uint16_t sub_blocks)
+void g_isi_sb_subiter_init_full(GIsiSubBlockIter *outer,
+ GIsiSubBlockIter *inner, size_t used,
+ gboolean longhdr, uint16_t sub_blocks)
{
size_t len = g_isi_sb_iter_get_len(outer);
@@ -127,14 +127,16 @@ gboolean g_isi_sb_iter_is_valid(const GIsiSubBlockIter *iter)
int g_isi_sb_iter_get_id(const GIsiSubBlockIter *iter)
{
if (iter->longhdr)
- return (iter->start[0] << 8) | (iter->start[1]);
+ return (iter->start[0] << 8) | iter->start[1];
+
return iter->start[0];
}
size_t g_isi_sb_iter_get_len(const GIsiSubBlockIter *iter)
{
if (iter->longhdr)
- return (iter->start[2] << 8) | (iter->start[3]);
+ return (iter->start[2] << 8) | iter->start[3];
+
return iter->start[1];
}
@@ -142,7 +144,7 @@ gboolean g_isi_sb_iter_get_data(const GIsiSubBlockIter *restrict iter,
void **data, unsigned pos)
{
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
- || iter->start + pos > iter->end)
+ || iter->start + pos > iter->end)
return FALSE;
*data = (void *)iter->start + pos;
@@ -153,7 +155,7 @@ gboolean g_isi_sb_iter_get_byte(const GIsiSubBlockIter *restrict iter,
uint8_t *byte, unsigned pos)
{
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
- || iter->start + pos > iter->end)
+ || iter->start + pos > iter->end)
return FALSE;
*byte = iter->start[pos];
@@ -208,6 +210,7 @@ gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
return FALSE;
ucs2 = iter->start + pos;
+
if (ucs2 + len > iter->end)
return FALSE;
@@ -224,10 +227,14 @@ gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
if (pos > g_isi_sb_iter_get_len(iter))
return FALSE;
- if (latin == NULL || len == 0 || pos + len > g_isi_sb_iter_get_len(iter))
+ if (latin == NULL || len == 0)
+ return FALSE;
+
+ if (pos + len > g_isi_sb_iter_get_len(iter))
return FALSE;
str = iter->start + pos;
+
if (str + len > iter->end)
return FALSE;
diff --git a/gisi/iter.h b/gisi/iter.h
index b6de8cff..1dfcfa9c 100644
--- a/gisi/iter.h
+++ b/gisi/iter.h
@@ -45,7 +45,7 @@ void g_isi_sb_iter_init_full(GIsiSubBlockIter *iter, const GIsiMessage *msg,
uint16_t sub_blocks);
void g_isi_sb_subiter_init(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
size_t used);
-void g_isi_sb_subiter_init_full(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
+void g_isi_sb_subiter_init_full(GIsiSubBlockIter *out, GIsiSubBlockIter *in,
size_t used, gboolean longhdr,
uint16_t sub_blocks);
gboolean g_isi_sb_iter_is_valid(const GIsiSubBlockIter *iter);
diff --git a/gisi/modem.c b/gisi/modem.c
index 50c75a6a..ff06cf22 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -152,7 +152,8 @@ static void pending_dispatch(GIsiPending *pend, GIsiMessage *msg)
ISIDBG(modem, "%s %s to %p [res=0x%02X, id=0x%02X, utid=0x%02X]",
g_isi_msg_strerror(msg), pend_type_to_str(pend->type), pend,
- g_isi_msg_resource(msg), g_isi_msg_id(msg), g_isi_msg_utid(msg));
+ g_isi_msg_resource(msg), g_isi_msg_id(msg),
+ g_isi_msg_utid(msg));
pend->notify(msg, pend->data);
}
@@ -185,7 +186,8 @@ static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
* Some of these may be synthesized, but nevertheless need to
* be removed.
*/
- if (pend->type < GISI_MESSAGE_TYPE_RESP && pend->msgid == msgid) {
+ if (pend->type < GISI_MESSAGE_TYPE_RESP
+ && pend->msgid == msgid) {
pending_dispatch(pend, msg);
@@ -725,7 +727,8 @@ GIsiPending *g_isi_request_vsendto(GIsiModem *modem, struct sockaddr_pn *dst,
mux->pending = g_slist_prepend(mux->pending, resp);
if (timeout > 0)
- resp->timeout = g_timeout_add_seconds(timeout, resp_timeout, resp);
+ resp->timeout = g_timeout_add_seconds(timeout, resp_timeout,
+ resp);
mux->last_utid = resp->utid;
return resp;
diff --git a/gisi/pipe.c b/gisi/pipe.c
index aebd1bf4..6070776d 100644
--- a/gisi/pipe.c
+++ b/gisi/pipe.c
@@ -180,7 +180,7 @@ static void g_isi_pipe_created(const GIsiMessage *msg, void *data)
}
if (g_isi_msg_id(msg) != PNS_PIPE_CREATE_RESP)
- return;
+ return;
if (!g_isi_msg_data_get_struct(msg, 0, (const void **) &resp, len))
return;