Skip to content

Commit ed41f83

Browse files
committed
Replaces the return type of avtp_<Format>_valid method from boolean to uint8_t. Adds a definition for TRUE and FALSE in Defines.h
1 parent 9e9b9be commit ed41f83

21 files changed

+76
-82
lines changed

include/avtp/Defines.h

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ typedef struct Avtp_FieldDescriptor {
6262
uint8_t bits;
6363
} Avtp_FieldDescriptor_t;
6464

65+
#define TRUE 1
66+
#define FALSE 0
67+
6568
#ifdef __cplusplus
6669
}
6770
#endif

include/avtp/acf/Can.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838

3939
#include "avtp/Defines.h"
4040
#include "avtp/acf/AcfCommon.h"
41-
#include <stdbool.h>
4241

4342
#ifdef __cplusplus
4443
extern "C" {
4544
#endif
4645

46+
#define TRUE 1
47+
#define FALSE 0
48+
4749
#define AVTP_CAN_HEADER_LEN (4 * AVTP_QUADLET_SIZE)
4850

4951
typedef struct {
@@ -198,7 +200,7 @@ uint8_t Avtp_Can_GetCanPayloadLength(Avtp_Can_t* pdu);
198200
* @param bufferSize Size of the buffer containing the ACF CAN frame.
199201
* @return true if the ACF CAN frame is valid, false otherwise.
200202
*/
201-
bool Avtp_Can_IsValid(Avtp_Can_t* pdu, size_t bufferSize);
203+
uint8_t Avtp_Can_IsValid(Avtp_Can_t* pdu, size_t bufferSize);
202204

203205

204206
#ifdef __cplusplus

include/avtp/acf/CanBrief.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#pragma once
3737

3838
#include <stdint.h>
39-
#include <stdbool.h>
4039

4140
#include "avtp/Defines.h"
4241
#include "avtp/acf/AcfCommon.h"
@@ -162,7 +161,7 @@ int Avtp_CanBrief_Finalize(Avtp_CanBrief_t* can_pdu, uint16_t payload_length);
162161
* @param bufferSize Size of the buffer containing the ACF CAN Brief frame.
163162
* @return true if the ACF CAN Brief frame is valid, false otherwise.
164163
*/
165-
bool Avtp_CanBrief_IsValid(Avtp_CanBrief_t* pdu, size_t bufferSize);
164+
uint8_t Avtp_CanBrief_IsValid(Avtp_CanBrief_t* pdu, size_t bufferSize);
166165

167166

168167

include/avtp/acf/FlexRay.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#pragma once
3636

3737
#include <stdint.h>
38-
#include <stdbool.h>
3938

4039
#include "avtp/Defines.h"
4140
#include "avtp/acf/AcfCommon.h"
@@ -144,7 +143,7 @@ void Avtp_FlexRay_SetCycle(Avtp_FlexRay_t* pdu, uint8_t value);
144143
* @param bufferSize Size of the buffer containing the ACF FlexRay frame.
145144
* @return true if the ACF FlexRay frame is valid, false otherwise.
146145
*/
147-
bool Avtp_FlexRay_IsValid(Avtp_FlexRay_t* pdu, size_t bufferSize);
146+
uint8_t Avtp_FlexRay_IsValid(Avtp_FlexRay_t* pdu, size_t bufferSize);
148147

149148

150149
#ifdef __cplusplus

include/avtp/acf/Gpc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#pragma once
3636

3737
#include <stdint.h>
38-
#include <stdbool.h>
3938

4039
#include "avtp/Defines.h"
4140
#include "avtp/acf/AcfCommon.h"
@@ -107,7 +106,7 @@ void Avtp_Gpc_SetGpcMsgId(Avtp_Gpc_t* pdu, uint64_t value);
107106
* @param bufferSize Size of the buffer containing the ACF Gpc frame.
108107
* @return true if the ACF Gpc frame is valid, false otherwise.
109108
*/
110-
bool Avtp_Gpc_IsValid(Avtp_Gpc_t* pdu, size_t bufferSize);
109+
uint8_t Avtp_Gpc_IsValid(Avtp_Gpc_t* pdu, size_t bufferSize);
111110

112111
#ifdef __cplusplus
113112
}

include/avtp/acf/Lin.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#pragma once
3636

3737
#include <stdint.h>
38-
#include <stdbool.h>
3938

4039
#include "avtp/Defines.h"
4140
#include "avtp/acf/AcfCommon.h"
@@ -120,7 +119,7 @@ void Avtp_Lin_SetMessageTimestamp(Avtp_Lin_t* pdu, uint64_t value);
120119
* @param bufferSize Size of the buffer containing the ACF Lin frame.
121120
* @return true if the ACF Lin frame is valid, false otherwise.
122121
*/
123-
bool Avtp_Lin_IsValid(Avtp_Lin_t* pdu, size_t bufferSize);
122+
uint8_t Avtp_Lin_IsValid(Avtp_Lin_t* pdu, size_t bufferSize);
124123

125124
#ifdef __cplusplus
126125
}

include/avtp/acf/Most.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#pragma once
3636

3737
#include <stdint.h>
38-
#include <stdbool.h>
3938

4039
#include "avtp/Defines.h"
4140
#include "avtp/acf/AcfCommon.h"
@@ -132,7 +131,7 @@ void Avtp_Most_SetOpType(Avtp_Most_t* pdu, uint8_t value);
132131
* @param bufferSize Size of the buffer containing the ACF Most frame.
133132
* @return true if the ACF Most frame is valid, false otherwise.
134133
*/
135-
bool Avtp_Most_IsValid(Avtp_Most_t* pdu, size_t bufferSize);
134+
uint8_t Avtp_Most_IsValid(Avtp_Most_t* pdu, size_t bufferSize);
136135

137136

138137
#ifdef __cplusplus

include/avtp/acf/Ntscf.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#endif
4343

4444
#include "avtp/Defines.h"
45-
#include <stdbool.h>
4645

4746
#ifdef __cplusplus
4847
extern "C" {
@@ -116,7 +115,7 @@ void Avtp_Ntscf_SetStreamId(Avtp_Ntscf_t* pdu, uint64_t value);
116115
* @param bufferSize Size of the buffer containing the ACF Ntscf frame.
117116
* @return true if the ACF Ntscf frame is valid, false otherwise.
118117
*/
119-
bool Avtp_Ntscf_IsValid(Avtp_Ntscf_t* pdu, size_t bufferSize);
118+
uint8_t Avtp_Ntscf_IsValid(Avtp_Ntscf_t* pdu, size_t bufferSize);
120119

121120

122121
#ifdef __cplusplus

include/avtp/acf/Sensor.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#pragma once
3737

3838
#include <stdint.h>
39-
#include <stdbool.h>
4039

4140
#include "avtp/Defines.h"
4241
#include "avtp/acf/AcfCommon.h"
@@ -119,7 +118,7 @@ void Avtp_Sensor_SetMessageTimestamp(Avtp_Sensor_t* pdu, uint64_t value);
119118
* @param bufferSize Size of the buffer containing the ACF Sensor frame.
120119
* @return true if the ACF Sensor frame is valid, false otherwise.
121120
*/
122-
bool Avtp_Sensor_IsValid(Avtp_Sensor_t* pdu, size_t bufferSize);
121+
uint8_t Avtp_Sensor_IsValid(Avtp_Sensor_t* pdu, size_t bufferSize);
123122

124123
#ifdef __cplusplus
125124
}

include/avtp/acf/SensorBrief.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#pragma once
3737

3838
#include <stdint.h>
39-
#include <stdbool.h>
4039

4140
#include "avtp/Defines.h"
4241
#include "avtp/acf/AcfCommon.h"
@@ -113,7 +112,7 @@ void Avtp_SensorBrief_SetSensorGroup(Avtp_SensorBrief_t* pdu, uint8_t value);
113112
* @param bufferSize Size of the buffer containing the ACF SensorBrief frame.
114113
* @return true if the ACF SensorBrief frame is valid, false otherwise.
115114
*/
116-
bool Avtp_SensorBrief_IsValid(Avtp_SensorBrief_t* pdu, size_t bufferSize);
115+
uint8_t Avtp_SensorBrief_IsValid(Avtp_SensorBrief_t* pdu, size_t bufferSize);
117116

118117

119118
#ifdef __cplusplus

include/avtp/acf/Tscf.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#pragma once
3737

3838
#include "avtp/Defines.h"
39-
#include <stdbool.h>
4039

4140
#ifdef __cplusplus
4241
extern "C" {
@@ -130,7 +129,7 @@ void Avtp_Tscf_SetStreamDataLength(Avtp_Tscf_t* pdu, uint16_t value);
130129
* @param bufferSize Size of the buffer containing the ACF Tscf frame.
131130
* @return true if the ACF Tscf frame is valid, false otherwise.
132131
*/
133-
bool Avtp_Tscf_IsValid(Avtp_Tscf_t* pdu, size_t bufferSize);
132+
uint8_t Avtp_Tscf_IsValid(Avtp_Tscf_t* pdu, size_t bufferSize);
134133

135134
#ifdef __cplusplus
136135
}

src/avtp/acf/Can.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -283,24 +283,22 @@ uint8_t Avtp_Can_GetCanPayloadLength(Avtp_Can_t* pdu)
283283
return acf_msg_length - AVTP_CAN_HEADER_LEN - acf_pad_length;
284284
}
285285

286-
bool Avtp_Can_IsValid(Avtp_Can_t* pdu, size_t bufferSize)
286+
uint8_t Avtp_Can_IsValid(Avtp_Can_t* pdu, size_t bufferSize)
287287
{
288288
if (pdu == NULL) {
289-
return false;
289+
return FALSE;
290290
}
291291

292292
if (bufferSize < AVTP_CAN_HEADER_LEN) {
293-
return false;
293+
return FALSE;
294294
}
295295

296296
if (Avtp_Can_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_CAN) {
297-
return false;
297+
return FALSE;
298298
}
299299

300300
if (Avtp_Can_GetAcfMsgLength(pdu) > bufferSize) {
301-
return false;
301+
return FALSE;
302302
}
303-
304-
return true;
305-
303+
return TRUE;
306304
}

src/avtp/acf/CanBrief.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,23 @@ int Avtp_CanBrief_Finalize(Avtp_CanBrief_t* pdu, uint16_t payload_length)
253253
return avtpCanLength;
254254
}
255255

256-
bool Avtp_CanBrief_IsValid(Avtp_CanBrief_t* pdu, size_t bufferSize)
256+
uint8_t Avtp_CanBrief_IsValid(Avtp_CanBrief_t* pdu, size_t bufferSize)
257257
{
258258
if (pdu == NULL) {
259-
return false;
259+
return FALSE;
260260
}
261261

262262
if (bufferSize < AVTP_CAN_BRIEF_HEADER_LEN) {
263-
return false;
263+
return FALSE;
264264
}
265265

266266
if (Avtp_CanBrief_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_CAN_BRIEF) {
267-
return false;
267+
return FALSE;
268268
}
269269

270270
if (Avtp_CanBrief_GetAcfMsgLength(pdu) > bufferSize) {
271-
return false;
271+
return FALSE;
272272
}
273273

274-
return true;
274+
return TRUE;
275275
}

src/avtp/acf/FlexRay.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -236,28 +236,28 @@ void Avtp_FlexRay_SetCycle(Avtp_FlexRay_t *pdu, uint8_t value)
236236
SET_FIELD(AVTP_FLEXRAY_FIELD_CYCLE, value);
237237
}
238238

239-
bool Avtp_FlexRay_IsValid(Avtp_FlexRay_t *pdu, size_t bufferSize)
239+
uint8_t Avtp_FlexRay_IsValid(Avtp_FlexRay_t *pdu, size_t bufferSize)
240240
{
241241

242242
if (pdu == NULL)
243243
{
244-
return false;
244+
return FALSE;
245245
}
246246

247247
if (bufferSize < AVTP_FLEXRAY_HEADER_LEN)
248248
{
249-
return false;
249+
return FALSE;
250250
}
251251

252252
if (Avtp_FlexRay_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_FLEXRAY)
253253
{
254-
return false;
254+
return FALSE;
255255
}
256256

257257
if (Avtp_FlexRay_GetAcfMsgLength(pdu) > bufferSize)
258258
{
259-
return false;
259+
return FALSE;
260260
}
261261

262-
return true;
262+
return TRUE;
263263
}

src/avtp/acf/Gpc.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -99,23 +99,23 @@ void Avtp_Gpc_SetGpcMsgId(Avtp_Gpc_t* pdu, uint64_t value)
9999
SET_FIELD(AVTP_GPC_FIELD_GPC_MSG_ID, value);
100100
}
101101

102-
bool Avtp_Gpc_IsValid(Avtp_Gpc_t* pdu, size_t bufferSize)
102+
uint8_t Avtp_Gpc_IsValid(Avtp_Gpc_t* pdu, size_t bufferSize)
103103
{
104104
if (pdu == NULL) {
105-
return false;
105+
return FALSE;
106106
}
107107

108108
if (bufferSize < AVTP_GPC_HEADER_LEN) {
109-
return false;
109+
return FALSE;
110110
}
111111

112112
if (Avtp_Gpc_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_GPC) {
113-
return false;
113+
return FALSE;
114114
}
115115

116116
if (Avtp_Gpc_GetAcfMsgLength(pdu) > bufferSize) {
117-
return false;
117+
return FALSE;
118118
}
119119

120-
return true;
120+
return TRUE;
121121
}

src/avtp/acf/Lin.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,22 @@ void Avtp_Lin_SetMessageTimestamp(Avtp_Lin_t* pdu, uint64_t value)
147147
SET_FIELD(AVTP_LIN_FIELD_MESSAGE_TIMESTAMP, value);
148148
}
149149

150-
bool Avtp_Lin_IsValid(Avtp_Lin_t* pdu, size_t bufferSize){
150+
uint8_t Avtp_Lin_IsValid(Avtp_Lin_t* pdu, size_t bufferSize){
151151
if (pdu == NULL) {
152-
return false;
152+
return FALSE;
153153
}
154154

155155
if (bufferSize < AVTP_LIN_HEADER_LEN) {
156-
return false;
156+
return FALSE;
157157
}
158158

159159
if (Avtp_Lin_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_LIN) {
160-
return false;
160+
return FALSE;
161161
}
162162

163163
if (Avtp_Lin_GetAcfMsgLength(pdu) > bufferSize) {
164-
return false;
164+
return FALSE;
165165
}
166166

167-
return true;
167+
return TRUE;
168168
}

src/avtp/acf/Most.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,27 @@ void Avtp_Most_SetOpType(Avtp_Most_t *pdu, uint8_t value)
194194
SET_FIELD(AVTP_MOST_FIELD_OP_TYPE, value);
195195
}
196196

197-
bool Avtp_Most_IsValid(Avtp_Most_t *pdu, size_t bufferSize)
197+
uint8_t Avtp_Most_IsValid(Avtp_Most_t *pdu, size_t bufferSize)
198198
{
199199
if (pdu == NULL)
200200
{
201-
return false;
201+
return FALSE;
202202
}
203203

204204
if (bufferSize < AVTP_MOST_HEADER_LEN)
205205
{
206-
return false;
206+
return FALSE;
207207
}
208208

209209
if (Avtp_Most_GetAcfMsgType(pdu) != AVTP_ACF_TYPE_MOST)
210210
{
211-
return false;
211+
return FALSE;
212212
}
213213

214214
if (Avtp_Most_GetAcfMsgLength(pdu) > bufferSize)
215215
{
216-
return false;
216+
return FALSE;
217217
}
218218

219-
return true;
219+
return TRUE;
220220
}

0 commit comments

Comments
 (0)