mirror of git://git.sysmocom.de/ofono
gisi: Minor style fixes
This commit is contained in:
parent
374dd32812
commit
4ca9022358
|
@ -184,8 +184,9 @@ GIsiPending *g_isi_client_send(GIsiClient *client, const void *__restrict buf,
|
||||||
if (pd == NULL)
|
if (pd == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
op = g_isi_request_send(client->modem, client->resource, buf, len, timeout,
|
op = g_isi_request_send(client->modem, client->resource, buf, len,
|
||||||
pending_resp_notify, pd, pending_destroy);
|
timeout, pending_resp_notify, pd,
|
||||||
|
pending_destroy);
|
||||||
if (op == NULL) {
|
if (op == NULL) {
|
||||||
g_free(pd);
|
g_free(pd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
23
gisi/iter.c
23
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;
|
inner->sub_blocks = len > used ? inner->start[-1] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void g_isi_sb_subiter_init_full(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
|
void g_isi_sb_subiter_init_full(GIsiSubBlockIter *outer,
|
||||||
size_t used, gboolean longhdr,
|
GIsiSubBlockIter *inner, size_t used,
|
||||||
uint16_t sub_blocks)
|
gboolean longhdr, uint16_t sub_blocks)
|
||||||
{
|
{
|
||||||
size_t len = g_isi_sb_iter_get_len(outer);
|
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)
|
int g_isi_sb_iter_get_id(const GIsiSubBlockIter *iter)
|
||||||
{
|
{
|
||||||
if (iter->longhdr)
|
if (iter->longhdr)
|
||||||
return (iter->start[0] << 8) | (iter->start[1]);
|
return (iter->start[0] << 8) | iter->start[1];
|
||||||
|
|
||||||
return iter->start[0];
|
return iter->start[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t g_isi_sb_iter_get_len(const GIsiSubBlockIter *iter)
|
size_t g_isi_sb_iter_get_len(const GIsiSubBlockIter *iter)
|
||||||
{
|
{
|
||||||
if (iter->longhdr)
|
if (iter->longhdr)
|
||||||
return (iter->start[2] << 8) | (iter->start[3]);
|
return (iter->start[2] << 8) | iter->start[3];
|
||||||
|
|
||||||
return iter->start[1];
|
return iter->start[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +144,7 @@ gboolean g_isi_sb_iter_get_data(const GIsiSubBlockIter *restrict iter,
|
||||||
void **data, unsigned pos)
|
void **data, unsigned pos)
|
||||||
{
|
{
|
||||||
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
|
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
|
||||||
|| iter->start + pos > iter->end)
|
|| iter->start + pos > iter->end)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*data = (void *)iter->start + pos;
|
*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)
|
uint8_t *byte, unsigned pos)
|
||||||
{
|
{
|
||||||
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
|
if ((size_t)pos > g_isi_sb_iter_get_len(iter)
|
||||||
|| iter->start + pos > iter->end)
|
|| iter->start + pos > iter->end)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*byte = iter->start[pos];
|
*byte = iter->start[pos];
|
||||||
|
@ -208,6 +210,7 @@ gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ucs2 = iter->start + pos;
|
ucs2 = iter->start + pos;
|
||||||
|
|
||||||
if (ucs2 + len > iter->end)
|
if (ucs2 + len > iter->end)
|
||||||
return FALSE;
|
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))
|
if (pos > g_isi_sb_iter_get_len(iter))
|
||||||
return FALSE;
|
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;
|
return FALSE;
|
||||||
|
|
||||||
str = iter->start + pos;
|
str = iter->start + pos;
|
||||||
|
|
||||||
if (str + len > iter->end)
|
if (str + len > iter->end)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void g_isi_sb_iter_init_full(GIsiSubBlockIter *iter, const GIsiMessage *msg,
|
||||||
uint16_t sub_blocks);
|
uint16_t sub_blocks);
|
||||||
void g_isi_sb_subiter_init(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
|
void g_isi_sb_subiter_init(GIsiSubBlockIter *outer, GIsiSubBlockIter *inner,
|
||||||
size_t used);
|
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,
|
size_t used, gboolean longhdr,
|
||||||
uint16_t sub_blocks);
|
uint16_t sub_blocks);
|
||||||
gboolean g_isi_sb_iter_is_valid(const GIsiSubBlockIter *iter);
|
gboolean g_isi_sb_iter_is_valid(const GIsiSubBlockIter *iter);
|
||||||
|
|
|
@ -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]",
|
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_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);
|
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
|
* Some of these may be synthesized, but nevertheless need to
|
||||||
* be removed.
|
* 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);
|
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);
|
mux->pending = g_slist_prepend(mux->pending, resp);
|
||||||
|
|
||||||
if (timeout > 0)
|
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;
|
mux->last_utid = resp->utid;
|
||||||
return resp;
|
return resp;
|
||||||
|
|
|
@ -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)
|
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))
|
if (!g_isi_msg_data_get_struct(msg, 0, (const void **) &resp, len))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue