Skip to content

Commit 1bb2e69

Browse files
committed
- Removed unnecessary _WIN64 conditional checks
- Fixed some conditional compilation using (WIN32) to (_WIN32)
1 parent 2805dde commit 1bb2e69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+132
-132
lines changed

src/Base64.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "Base64.h"
1818

19-
#if defined(_WIN32) || defined(_WIN64)
19+
#if defined(_WIN32)
2020
#pragma comment(lib, "crypt32.lib")
2121
#include <windows.h>
2222
#include <wincrypt.h>
@@ -37,7 +37,7 @@ b64_size_t Base64_encode( char *out, b64_size_t out_len, const b64_data_t *in, b
3737
ret = (b64_size_t)dw_out_len;
3838
return ret;
3939
}
40-
#else /* if defined(_WIN32) || defined(_WIN64) */
40+
#else /* if defined(_WIN32) */
4141

4242
#if defined(OPENSSL)
4343
#include <openssl/bio.h>
@@ -234,7 +234,7 @@ b64_size_t Base64_encode( char *out, b64_size_t out_len, const b64_data_t *in, b
234234
return ret;
235235
}
236236
#endif /* else if defined(OPENSSL) */
237-
#endif /* if else defined(_WIN32) || defined(_WIN64) */
237+
#endif /* if else defined(_WIN32) */
238238

239239
b64_size_t Base64_decodeLength( const char *in, b64_size_t in_len )
240240
{

src/Clients.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include <stdint.h>
2626
#include "MQTTTime.h"
27-
#if defined(_WIN32) || defined(_WIN64)
27+
#if defined(_WIN32)
2828
#include <winsock2.h>
2929
#endif
3030
#if defined(OPENSSL)

src/Heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ char* Broker_recordFFDC(char* symptoms);
4949
#undef realloc
5050
#undef free
5151

52-
#if defined(_WIN32) || defined(_WIN64)
52+
#if defined(_WIN32)
5353
mutex_type heap_mutex;
5454
#else
5555
static pthread_mutex_t heap_mutex_store = PTHREAD_MUTEX_INITIALIZER;

src/Log.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <time.h>
3939
#include <string.h>
4040

41-
#if !defined(_WIN32) && !defined(_WIN64)
41+
#if !defined(_WIN32)
4242
#include <syslog.h>
4343
#include <sys/stat.h>
4444
#define GETTIMEOFDAY 1
@@ -52,7 +52,7 @@
5252
#include <sys/timeb.h>
5353
#endif
5454

55-
#if !defined(_WIN32) && !defined(_WIN64)
55+
#if !defined(_WIN32)
5656
/**
5757
* _unlink mapping for linux
5858
*/
@@ -123,7 +123,7 @@ struct timeb now_ts;
123123
#endif
124124
static char msg_buf[512];
125125

126-
#if defined(_WIN32) || defined(_WIN64)
126+
#if defined(_WIN32)
127127
mutex_type log_mutex;
128128
#else
129129
static pthread_mutex_t log_mutex_store = PTHREAD_MUTEX_INITIALIZER;
@@ -135,7 +135,7 @@ int Log_initialize(Log_nameValue* info)
135135
{
136136
int rc = SOCKET_ERROR;
137137
char* envval = NULL;
138-
#if !defined(_WIN32) && !defined(_WIN64)
138+
#if !defined(_WIN32)
139139
struct stat buf;
140140
#endif
141141

@@ -198,7 +198,7 @@ int Log_initialize(Log_nameValue* info)
198198
info++;
199199
}
200200
}
201-
#if !defined(_WIN32) && !defined(_WIN64)
201+
#if !defined(_WIN32)
202202
if (stat("/proc/version", &buf) != -1)
203203
{
204204
FILE* vfile;

src/Log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if !defined(LOG_H)
1919
#define LOG_H
2020

21-
#if defined(_WIN32) || defined(_WIN64)
21+
#if defined(_WIN32)
2222
#include <windows.h>
2323
#define thread_id_type DWORD
2424
#else

src/MQTTAsync.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
#include <stdlib.h>
4343
#include <string.h>
44-
#if !defined(_WIN32) && !defined(_WIN64)
44+
#if !defined(_WIN32)
4545
#include <sys/time.h>
4646
#else
4747
#if defined(_MSC_VER) && _MSC_VER < 1900
@@ -105,7 +105,7 @@ void MQTTAsync_global_init(MQTTAsync_init_options* inits)
105105
#define min(a, b) (((a) < (b)) ? (a) : (b))
106106
#endif
107107

108-
#if defined(WIN32) || defined(WIN64)
108+
#if defined(_WIN32)
109109
void MQTTAsync_init_rand(void)
110110
{
111111
START_TIME_TYPE now = MQTTTime_start_clock();
@@ -125,7 +125,7 @@ void MQTTAsync_init_rand(void)
125125
}
126126
#endif
127127

128-
#if defined(_WIN32) || defined(_WIN64)
128+
#if defined(_WIN32)
129129
mutex_type mqttasync_mutex = NULL;
130130
mutex_type socket_mutex = NULL;
131131
mutex_type mqttcommand_mutex = NULL;
@@ -300,7 +300,7 @@ int MQTTAsync_createWithOptions(MQTTAsync* handle, const char* serverURI, const
300300
int rc = 0;
301301
MQTTAsyncs *m = NULL;
302302

303-
#if (defined(_WIN32) || defined(_WIN64)) && defined(PAHO_MQTT_STATIC)
303+
#if (defined(_WIN32)) && defined(PAHO_MQTT_STATIC)
304304
/* intializes mutexes once. Must come before FUNC_ENTRY */
305305
BOOL bStatus = InitOnceExecuteOnce(&g_InitOnce, InitMutexesOnce, NULL, NULL);
306306
#endif

src/MQTTAsyncUtils.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include <stdlib.h>
1919
#include <string.h>
20-
#if !defined(_WIN32) && !defined(_WIN64)
20+
#if !defined(_WIN32)
2121
#include <sys/time.h>
2222
#endif
2323

@@ -81,7 +81,7 @@ extern List* MQTTAsync_handles;
8181
extern List* MQTTAsync_commands;
8282
extern int MQTTAsync_tostop;
8383

84-
#if defined(_WIN32) || defined(_WIN64)
84+
#if defined(_WIN32)
8585
#if defined(_MSC_VER) && _MSC_VER < 1900
8686
#define snprintf _snprintf
8787
#endif
@@ -108,7 +108,7 @@ extern cond_type send_cond;
108108
void MQTTAsync_sleep(long milliseconds)
109109
{
110110
FUNC_ENTRY;
111-
#if defined(_WIN32) || defined(_WIN64)
111+
#if defined(_WIN32)
112112
Sleep(milliseconds);
113113
#else
114114
usleep(milliseconds*1000);
@@ -936,7 +936,7 @@ int MQTTAsync_addCommand(MQTTAsync_queuedCommand* command, int command_size)
936936
}
937937
exit:
938938
MQTTAsync_unlock_mutex(mqttcommand_mutex);
939-
#if !defined(_WIN32) && !defined(_WIN64)
939+
#if !defined(_WIN32)
940940
if ((rc1 = Thread_signal_cond(send_cond)) != 0)
941941
Log(LOG_ERROR, 0, "Error %d from signal cond", rc1);
942942
#else
@@ -1847,7 +1847,7 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
18471847
command_count = MQTTAsync_commands->count;
18481848
MQTTAsync_unlock_mutex(mqttcommand_mutex);
18491849
}
1850-
#if !defined(_WIN32) && !defined(_WIN64)
1850+
#if !defined(_WIN32)
18511851
if ((rc = Thread_wait_cond(send_cond, timeout)) != 0 && rc != ETIMEDOUT)
18521852
Log(LOG_ERROR, -1, "Error %d waiting for condition variable", rc);
18531853
#else
@@ -1872,7 +1872,7 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
18721872
#endif
18731873

18741874
FUNC_EXIT;
1875-
#if defined(_WIN32) || defined(_WIN64)
1875+
#if defined(_WIN32)
18761876
ExitThread(0);
18771877
#endif
18781878
return 0;
@@ -2058,7 +2058,7 @@ static int MQTTAsync_completeConnection(MQTTAsyncs* m, Connack* connack)
20582058
}
20592059
}
20602060
m->pack = NULL;
2061-
#if !defined(_WIN32) && !defined(_WIN64)
2061+
#if !defined(_WIN32)
20622062
Thread_signal_cond(send_cond);
20632063
#else
20642064
Thread_post_sem(send_sem);
@@ -2388,7 +2388,7 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
23882388
receiveThread_state = STOPPED;
23892389
receiveThread_id = 0;
23902390
MQTTAsync_unlock_mutex(mqttasync_mutex);
2391-
#if !defined(_WIN32) && !defined(_WIN64)
2391+
#if !defined(_WIN32)
23922392
if (sendThread_state != STOPPED)
23932393
Thread_signal_cond(send_cond);
23942394
#else
@@ -2405,7 +2405,7 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
24052405
#endif
24062406

24072407
FUNC_EXIT;
2408-
#if defined(_WIN32) || defined(_WIN64)
2408+
#if defined(_WIN32)
24092409
ExitThread(0);
24102410
#endif
24112411
return 0;
@@ -3134,7 +3134,7 @@ static MQTTPacket* MQTTAsync_cycle(SOCKET* sock, unsigned long timeout, int* rc)
31343134
{
31353135
*rc = MQTTProtocol_handlePubcomps(pack, *sock, &pubToRemove);
31363136
if (sendThread_state != STOPPED)
3137-
#if !defined(_WIN32) && !defined(_WIN64)
3137+
#if !defined(_WIN32)
31383138
Thread_signal_cond(send_cond);
31393139
#else
31403140
Thread_post_sem(send_sem);
@@ -3146,7 +3146,7 @@ static MQTTPacket* MQTTAsync_cycle(SOCKET* sock, unsigned long timeout, int* rc)
31463146
{
31473147
*rc = MQTTProtocol_handlePubacks(pack, *sock, &pubToRemove);
31483148
if (sendThread_state != STOPPED)
3149-
#if !defined(_WIN32) && !defined(_WIN64)
3149+
#if !defined(_WIN32)
31503150
Thread_signal_cond(send_cond);
31513151
#else
31523152
Thread_post_sem(send_sem);

src/MQTTAsyncUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void MQTTAsync_writeComplete(SOCKET socket, int rc);
177177
void setRetryLoopInterval(int keepalive);
178178
void MQTTAsync_NULLPublishResponses(MQTTAsyncs* m);
179179

180-
#if defined(_WIN32) || defined(_WIN64)
180+
#if defined(_WIN32)
181181
#else
182182
#define WINAPI
183183
#endif

src/MQTTClient.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
#include <stdlib.h>
4848
#include <string.h>
49-
#if !defined(_WIN32) && !defined(_WIN64)
49+
#if !defined(_WIN32)
5050
#include <sys/time.h>
5151
#else
5252
#if defined(_MSC_VER) && _MSC_VER < 1900
@@ -114,7 +114,7 @@ ClientStates* bstate = &ClientState;
114114

115115
MQTTProtocol state;
116116

117-
#if defined(_WIN32) || defined(_WIN64)
117+
#if defined(_WIN32)
118118
static mutex_type mqttclient_mutex = NULL;
119119
mutex_type socket_mutex = NULL;
120120
static mutex_type subscribe_mutex = NULL;
@@ -370,7 +370,7 @@ int MQTTClient_createWithOptions(MQTTClient* handle, const char* serverURI, cons
370370
int rc = 0;
371371
MQTTClients *m = NULL;
372372

373-
#if (defined(_WIN32) || defined(_WIN64)) && defined(PAHO_MQTT_STATIC)
373+
#if (defined(_WIN32)) && defined(PAHO_MQTT_STATIC)
374374
/* intializes mutexes once. Must come before FUNC_ENTRY */
375375
BOOL bStatus = InitOnceExecuteOnce(&g_InitOnce, InitOnceFunction, NULL, NULL);
376376
#endif
@@ -1026,7 +1026,7 @@ static thread_return_type WINAPI MQTTClient_run(void* n)
10261026
running = tostop = 0;
10271027
Paho_thread_unlock_mutex(mqttclient_mutex);
10281028
FUNC_EXIT;
1029-
#if defined(_WIN32) || defined(_WIN64)
1029+
#if defined(_WIN32)
10301030
ExitThread(0);
10311031
#endif
10321032
return 0;

src/MQTTExportDeclarations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#if !defined(EXPORTDECLARATIONS_H)
1818
#define EXPORTDECLARATIONS_H
1919

20-
#if defined(_WIN32) || defined(_WIN64)
20+
#if defined(_WIN32)
2121
# if defined(PAHO_MQTT_EXPORTS)
2222
# define LIBMQTT_API __declspec(dllexport)
2323
# elif defined(PAHO_MQTT_IMPORTS)

src/MQTTPacket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ int MQTTPacket_send_publish(Publish* pack, int dup, int qos, int retained, netwo
945945
memcpy(pack->mask, packetbufs.mask, sizeof(pack->mask));
946946
}
947947
{
948-
#if defined(_WIN32) || defined(_WIN64)
948+
#if defined(_WIN32)
949949
#define buflen 30
950950
#else
951951
const int buflen = 30;

src/MQTTPersistence.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "MQTTProtocolClient.h"
3232
#include "Heap.h"
3333

34-
#if defined(_WIN32) || defined(_WIN64)
34+
#if defined(_WIN32)
3535
#define snprintf _snprintf
3636
#endif
3737

@@ -658,7 +658,7 @@ void MQTTPersistence_wrapMsgID(Clients *client)
658658
int MQTTPersistence_unpersistQueueEntry(Clients* client, MQTTPersistence_qEntry* qe)
659659
{
660660
int rc = 0;
661-
#if defined(_WIN32) || defined(_WIN64)
661+
#if defined(_WIN32)
662662
#define KEYSIZE PERSISTENCE_MAX_KEY_LENGTH + 1
663663
#else
664664
const size_t KEYSIZE = PERSISTENCE_MAX_KEY_LENGTH + 1;
@@ -688,7 +688,7 @@ int MQTTPersistence_persistQueueEntry(Clients* aclient, MQTTPersistence_qEntry*
688688
{
689689
int rc = 0;
690690
int bufindex = 0;
691-
#if !defined(_WIN32) && !defined(_WIN64)
691+
#if !defined(_WIN32)
692692
const size_t KEYSIZE = PERSISTENCE_MAX_KEY_LENGTH + 1;
693693
#endif
694694
char key[KEYSIZE];

0 commit comments

Comments
 (0)