Upstream merge request: https://git.sailfishos.org/mer-core/libdsme/merge_requests/8
From 33442f0a318af4904164262bb2acc4cf66731578 Mon Sep 17 00:00:00 2001
From: Bart Ribbers <bribbers@disroot.org>
Date: Tue, 14 Apr 2020 15:35:06 +0200
Subject: [PATCH] Replace u_int*_t usages for the enwer uint*_t
---
include/dsme/messages.h | 15 ++++++++-------
include/dsme/processwd.h | 2 +-
message.c | 8 ++++----
tests/ut_libdsme.c | 2 +-
4 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/include/dsme/messages.h b/include/dsme/messages.h
index 3c4eb30..57e12ad 100644
--- a/include/dsme/messages.h
+++ b/include/dsme/messages.h
@@ -29,6 +29,7 @@
#include <stddef.h>
#include <sys/types.h>
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -88,9 +89,9 @@ extern "C" {
*/
#define DSMEMSG_PRIVATE_FIELDS \
- u_int32_t line_size_; \
- u_int32_t size_; \
- u_int32_t type_;
+ uint32_t line_size_; \
+ uint32_t size_; \
+ uint32_t type_;
/**
Generic message type
@@ -107,7 +108,7 @@ typedef struct dsmemsg_generic_t {
*/
typedef struct {
DSMEMSG_PRIVATE_FIELDS
- u_int8_t reason;
+ uint8_t reason;
} DSM_MSGTYPE_CLOSE;
/**
@@ -169,7 +170,7 @@ enum {
* @param size message body size
* @param extra space to reserve for extra data
*/
-void *dsmemsg_new(u_int32_t id, size_t size, size_t extra);
+void *dsmemsg_new(uint32_t id, size_t size, size_t extra);
/** Get dsme message type identifier
*
@@ -177,7 +178,7 @@ void *dsmemsg_new(u_int32_t id, size_t size, size_t extra);
*
* @return type identifier
*/
-u_int32_t dsmemsg_id(const dsmemsg_generic_t *msg);
+uint32_t dsmemsg_id(const dsmemsg_generic_t *msg);
/** Get human readable name of dsme message type
*
@@ -242,7 +243,7 @@ const void *dsmemsg_extra_data(const dsmemsg_generic_t *msg);
*
* @sa dsmemsg_name()
*/
-const char * dsmemsg_id_name(u_int32_t id);
+const char * dsmemsg_id_name(uint32_t id);
#ifdef __cplusplus
}
diff --git a/include/dsme/processwd.h b/include/dsme/processwd.h
index ed77cc0..afb578f 100644
--- a/include/dsme/processwd.h
+++ b/include/dsme/processwd.h
@@ -65,7 +65,7 @@ typedef dsmemsg_generic_t DSM_MSGTYPE_PROCESSWD_MANUAL_PING;
typedef struct {
DSMEMSG_PRIVATE_FIELDS
- u_int32_t timeout;
+ uint32_t timeout;
} DSM_MSGTYPE_PROCESSWD_SET_INTERVAL;
#endif
diff --git a/message.c b/message.c
index f8d91bb..5ff5585 100644
--- a/message.c
+++ b/message.c
@@ -38,7 +38,7 @@
static const struct
{
const char *name;
- u_int32_t id;
+ uint32_t id;
} dsmemsg_id_lut[] =
{
{ "CLOSE", 0x00000001 },
@@ -90,7 +90,7 @@ static const struct
};
const char *
-dsmemsg_id_name(u_int32_t id)
+dsmemsg_id_name(uint32_t id)
{
for( size_t i = 0; dsmemsg_id_lut[i].name; ++i ) {
if( dsmemsg_id_lut[i].id == id )
@@ -104,7 +104,7 @@ dsmemsg_id_name(u_int32_t id)
}
void *
-dsmemsg_new(u_int32_t id, size_t size, size_t extra)
+dsmemsg_new(uint32_t id, size_t size, size_t extra)
{
dsmemsg_generic_t *msg = calloc(1, size + extra);
if (msg == NULL) {
@@ -119,7 +119,7 @@ dsmemsg_new(u_int32_t id, size_t size, size_t extra)
return msg;
}
-u_int32_t dsmemsg_id(const dsmemsg_generic_t *msg)
+uint32_t dsmemsg_id(const dsmemsg_generic_t *msg)
{
return msg->type_;
}
diff --git a/tests/ut_libdsme.c b/tests/ut_libdsme.c
index 4afa436..7ac6805 100644
--- a/tests/ut_libdsme.c
+++ b/tests/ut_libdsme.c
@@ -127,7 +127,7 @@ static int mock(void)
START_TEST(test_message)
{
- const u_int32_t id = 42;
+ const uint32_t id = 42;
dsmemsg_generic_t* msg = dsmemsg_new(id, sizeof(dsmemsg_generic_t), sizeof(int));
--
2.23.0