Use macros instead of constants to eliminate compile warnings

This commit is contained in:
Ian Craggs 2026-02-07 21:56:17 +00:00
parent 695ef2cbd9
commit 02db68bf76
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
3 changed files with 4 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2025 IBM Corp. and Ian Craggs
* Copyright (c) 2009, 2026 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
@ -945,11 +945,7 @@ int MQTTPacket_send_publish(Publish* pack, int dup, int qos, int retained, netwo
memcpy(pack->mask, packetbufs.mask, sizeof(pack->mask));
}
{
#if defined(_WIN32)
#define buflen 30
#else
const int buflen = 30;
#endif
char buf[buflen];
int len = 0;

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2023 IBM Corp.
* Copyright (c) 2009, 2026 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
@ -655,14 +655,10 @@ void MQTTPersistence_wrapMsgID(Clients *client)
#if !defined(NO_PERSISTENCE)
#define KEYSIZE PERSISTENCE_MAX_KEY_LENGTH + 1
int MQTTPersistence_unpersistQueueEntry(Clients* client, MQTTPersistence_qEntry* qe)
{
int rc = 0;
#if defined(_WIN32)
#define KEYSIZE PERSISTENCE_MAX_KEY_LENGTH + 1
#else
const size_t KEYSIZE = PERSISTENCE_MAX_KEY_LENGTH + 1;
#endif
char key[KEYSIZE];
int chars = 0;
@ -688,9 +684,6 @@ int MQTTPersistence_persistQueueEntry(Clients* aclient, MQTTPersistence_qEntry*
{
int rc = 0;
int bufindex = 0;
#if !defined(_WIN32)
const size_t KEYSIZE = PERSISTENCE_MAX_KEY_LENGTH + 1;
#endif
char key[KEYSIZE];
int chars = 0;
int lens[MAX_NO_OF_BUFFERS];

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2024 IBM Corp. and Ian Craggs
* Copyright (c) 2009, 2026 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
@ -334,11 +334,7 @@ int MQTTProtocol_handlePublishes(void* pack, SOCKET sock)
/* Format and print publish data to trace */
{
#if defined(_WIN32)
#define buflen 30
#else
const int buflen = 30;
#endif
char buf[buflen];
int len = 0;