aboutsummaryrefslogtreecommitdiffstats
path: root/testing/libdsme/fix-musl-incompatibility.patch
blob: 69f4b29149300b5611e34e98c884fbe97094844b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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