summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc1152a)
raw | patch | inline | side by side (parent: dc1152a)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 16 Dec 2014 08:54:58 +0000 (09:54 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 16 Dec 2014 08:54:58 +0000 (09:54 +0100) |
… to be consistent with the other functions.
diff --git a/src/client/sock.c b/src/client/sock.c
index d4596cd7a858cda76e1144492c5e2cf71c11291b..a99abf10be889510541d57c25c74743842d0cfc7 100644 (file)
--- a/src/client/sock.c
+++ b/src/client/sock.c
if (rstatus == UINT32_MAX) {
/* retrieve status and data len */
- rstatus = sdb_proto_get_int(buf, data_offset);
- rlen = sdb_proto_get_int(buf, data_offset + sizeof(rstatus));
+ rstatus = sdb_proto_unmarshal_int(buf, data_offset);
+ rlen = sdb_proto_unmarshal_int(buf, data_offset + sizeof(rstatus));
if (! rlen)
break;
diff --git a/src/frontend/query.c b/src/frontend/query.c
index 35ff1026d1d84686d10468b9fe5046d5a14d7a41..4580e57e9714753682b55bb0bebd2de96f231647 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
return -1;
}
- type = sdb_proto_get_int(conn->buf, 0);
+ type = sdb_proto_unmarshal_int(conn->buf, 0);
strncpy(name, sdb_strbuf_string(conn->buf) + sizeof(uint32_t),
conn->cmd_len - sizeof(uint32_t));
name[sizeof(name) - 1] = '\0';
return -1;
if (conn->cmd_len == sizeof(uint32_t))
- type = sdb_proto_get_int(conn->buf, 0);
+ type = sdb_proto_unmarshal_int(conn->buf, 0);
else if (conn->cmd_len) {
sdb_log(SDB_LOG_ERR, "frontend: Invalid command length %d for "
"LIST command", conn->cmd_len);
conn->cmd_len);
return -1;
}
- type = sdb_proto_get_int(conn->buf, 0);
+ type = sdb_proto_unmarshal_int(conn->buf, 0);
matcher = sdb_strbuf_string(conn->buf) + sizeof(uint32_t);
matcher_len = conn->cmd_len - sizeof(uint32_t);
index 6f0907feee2c2e5243e61e2c37ce47419a7539b2..311162bb0682c09aa8acc11908e8b8bf2f7df4f1 100644 (file)
sdb_proto_unmarshal_header(sdb_strbuf_t *buf,
uint32_t *code, uint32_t *msg_len);
+/*
+ * sdb_proto_unmarshal_int:
+ * Read and decode an integer from the specified string buffer.
+ */
uint32_t
-sdb_proto_get_int(sdb_strbuf_t *buf, size_t offset);
+sdb_proto_unmarshal_int(sdb_strbuf_t *buf, size_t offset);
#ifdef __cplusplus
} /* extern "C" */
index 9589875300d468c7b9e6b7268fef5705a9580773..e859bc795db43fc49d64c852fdd8f4f408c6e6e2 100644 (file)
static void
log_printer(sdb_strbuf_t *buf)
{
- uint32_t prio = sdb_proto_get_int(buf, 0);
+ uint32_t prio = sdb_proto_unmarshal_int(buf, 0);
if (prio == UINT32_MAX) {
sdb_log(SDB_LOG_WARNING, "Received a LOG message with invalid "
diff --git a/src/utils/proto.c b/src/utils/proto.c
index 35b19862b12e5ea1fe8258cf519713cfc9e8c7dc..dc6ee715e721ea3ea5f8e60ffec85c8de484acbb 100644 (file)
--- a/src/utils/proto.c
+++ b/src/utils/proto.c
if (sdb_strbuf_len(buf) < 2 * sizeof(uint32_t))
return -1;
- tmp = sdb_proto_get_int(buf, 0);
+ tmp = sdb_proto_unmarshal_int(buf, 0);
if (code)
*code = tmp;
- tmp = sdb_proto_get_int(buf, sizeof(uint32_t));
+ tmp = sdb_proto_unmarshal_int(buf, sizeof(uint32_t));
if (msg_len)
*msg_len = tmp;
return 0;
} /* sdb_proto_unmarshal_header */
uint32_t
-sdb_proto_get_int(sdb_strbuf_t *buf, size_t offset)
+sdb_proto_unmarshal_int(sdb_strbuf_t *buf, size_t offset)
{
const char *data;
uint32_t n;
data += offset;
memcpy(&n, data, sizeof(n));
return ntohl(n);
-} /* sdb_proto_get_int */
+} /* sdb_proto_unmarshal_int */
/* vim: set tw=78 sw=4 ts=4 noexpandtab : */