Skip to content

Fix the build for C23 #1597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/MQTTAsyncUtils.c
Original file line number Diff line number Diff line change
@@ -1703,7 +1703,15 @@ static void nextOrClose(MQTTAsyncs* m, int rc, char* message)
MQTTAsync_failureData5 data = MQTTAsync_failureData5_initializer;

data.token = 0;
data.code = rc;
if (rc > 0) /* MQTT Reason Codes are > 0; C client return codes are < 0 */
{
/* MQTT 5 reason codes >= 0x00 and < 0x80 are successful,
* but in that case we should not get here but be calling
* onSuccess instead. */
data.reasonCode = rc;
data.code = MQTTASYNC_FAILURE;
} else
data.code = rc;
data.message = message;
Log(TRACE_MIN, -1, "Calling connect failure for client %s", m->c->clientID);
(*(m->connect.onFailure5))(m->connect.context, &data);
4 changes: 2 additions & 2 deletions src/MQTTPacket.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
* Copyright (c) 2009, 2025 IBM Corp. and Ian Craggs
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@@ -860,7 +860,7 @@ int MQTTPacket_formatPayload(int buflen, char* buf, int payloadlen, char* payloa

for (i = 0; i < payloadlen; i++)
{
if (isprint(payload[i]))
if (isprint((unsigned char)payload[i]))
{
if (pos >= buflen)
break;
34 changes: 17 additions & 17 deletions src/MQTTPacket.h
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
#include "LinkedList.h"
#include "Clients.h"

typedef unsigned int bool;
typedef unsigned int bit;
typedef void* (*pf)(int, unsigned char, char*, size_t);

#include "MQTTProperties.h"
@@ -67,16 +67,16 @@ typedef union
struct
{
unsigned int type : 4; /**< message type nibble */
bool dup : 1; /**< DUP flag bit */
bit dup : 1; /**< DUP flag bit */
unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
bool retain : 1; /**< retained flag bit */
bit retain : 1; /**< retained flag bit */
} bits;
#else
struct
{
bool retain : 1; /**< retained flag bit */
bit retain : 1; /**< retained flag bit */
unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
bool dup : 1; /**< DUP flag bit */
bit dup : 1; /**< DUP flag bit */
unsigned int type : 4; /**< message type nibble */
} bits;
#endif
@@ -95,24 +95,24 @@ typedef struct
#if defined(REVERSED)
struct
{
bool username : 1; /**< 3.1 user name */
bool password : 1; /**< 3.1 password */
bool willRetain : 1; /**< will retain setting */
bit username : 1; /**< 3.1 user name */
bit password : 1; /**< 3.1 password */
bit willRetain : 1; /**< will retain setting */
unsigned int willQoS : 2; /**< will QoS value */
bool will : 1; /**< will flag */
bool cleanstart : 1; /**< cleansession flag */
bit will : 1; /**< will flag */
bit cleanstart : 1; /**< cleansession flag */
int : 1; /**< unused */
} bits;
#else
struct
{
int : 1; /**< unused */
bool cleanstart : 1; /**< cleansession flag */
bool will : 1; /**< will flag */
bit cleanstart : 1; /**< cleansession flag */
bit will : 1; /**< will flag */
unsigned int willQoS : 2; /**< will QoS value */
bool willRetain : 1; /**< will retain setting */
bool password : 1; /**< 3.1 password */
bool username : 1; /**< 3.1 user name */
bit willRetain : 1; /**< will retain setting */
bit password : 1; /**< 3.1 password */
bit username : 1; /**< 3.1 user name */
} bits;
#endif
} flags; /**< connect flags byte */
@@ -140,12 +140,12 @@ typedef struct
struct
{
unsigned int reserved : 7; /**< message type nibble */
bool sessionPresent : 1; /**< was a session found on the server? */
bit sessionPresent : 1; /**< was a session found on the server? */
} bits;
#else
struct
{
bool sessionPresent : 1; /**< was a session found on the server? */
bit sessionPresent : 1; /**< was a session found on the server? */
unsigned int reserved : 7; /**< message type nibble */
} bits;
#endif
4 changes: 2 additions & 2 deletions src/MQTTVersion.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2020 IBM Corp.
* Copyright (c) 2012, 2025 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@@ -96,7 +96,7 @@ char* FindString(char* filename, const char* eyecatcher_input)
char* ptr = value;
c = fgetc(infile); /* skip space */
c = fgetc(infile);
while (isprint(c))
while (isprint((unsigned char)c))
{
*ptr++ = c;
c = fgetc(infile);
4 changes: 2 additions & 2 deletions src/Proxy.c
Original file line number Diff line number Diff line change
@@ -272,7 +272,7 @@ void Proxy_specialChars(char* p0, char* p1, b64_size_t *basic_auth_in_len)
{
*p0++ = *p1++;
}
else if (isxdigit(*(p1 + 1)) && isxdigit(*(p1 + 2)))
else if (isxdigit((unsigned char)*(p1 + 1)) && isxdigit((unsigned char)*(p1 + 2)))
{
/* next 2 characters are hexa digits */
char hex[3];
@@ -350,4 +350,4 @@ int Proxy_setHTTPProxy(Clients* aClient, char* source, char** dest, char** auth_
}
exit:
return rc;
}
}
Loading
Oops, something went wrong.