Commit bf67bab4 authored by Ian Craggs's avatar Ian Craggs

Get rid of compiler warnings on MacOSX

parent 93a064db
...@@ -2619,7 +2619,7 @@ exit: ...@@ -2619,7 +2619,7 @@ exit:
void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level) void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level)
{ {
Log_setTraceLevel(level); Log_setTraceLevel((enum LOG_LEVELS)level);
} }
......
...@@ -104,7 +104,7 @@ void StackTrace_entry(const char* name, int line, int trace_level) ...@@ -104,7 +104,7 @@ void StackTrace_entry(const char* name, int line, int trace_level)
if (!setStack(1)) if (!setStack(1))
goto exit; goto exit;
if (trace_level != -1) if (trace_level != -1)
Log_stackTrace(trace_level, 9, cur_thread->id, cur_thread->current_depth, name, line, NULL); Log_stackTrace(trace_level, 9, (int)cur_thread->id, cur_thread->current_depth, name, line, NULL);
strncpy(cur_thread->callstack[cur_thread->current_depth].name, name, sizeof(cur_thread->callstack[0].name)-1); strncpy(cur_thread->callstack[cur_thread->current_depth].name, name, sizeof(cur_thread->callstack[0].name)-1);
cur_thread->callstack[(cur_thread->current_depth)++].line = line; cur_thread->callstack[(cur_thread->current_depth)++].line = line;
if (cur_thread->current_depth > cur_thread->maxdepth) if (cur_thread->current_depth > cur_thread->maxdepth)
...@@ -128,9 +128,9 @@ void StackTrace_exit(const char* name, int line, void* rc, int trace_level) ...@@ -128,9 +128,9 @@ void StackTrace_exit(const char* name, int line, void* rc, int trace_level)
if (trace_level != -1) if (trace_level != -1)
{ {
if (rc == NULL) if (rc == NULL)
Log_stackTrace(trace_level, 10, cur_thread->id, cur_thread->current_depth, name, line, NULL); Log_stackTrace(trace_level, 10, (int)cur_thread->id, cur_thread->current_depth, name, line, NULL);
else else
Log_stackTrace(trace_level, 11, cur_thread->id, cur_thread->current_depth, name, line, (int*)rc); Log_stackTrace(trace_level, 11, (int)cur_thread->id, cur_thread->current_depth, name, line, (int*)rc);
} }
exit: exit:
Thread_unlock_mutex(stack_mutex); Thread_unlock_mutex(stack_mutex);
...@@ -152,14 +152,14 @@ void StackTrace_printStack(FILE* dest) ...@@ -152,14 +152,14 @@ void StackTrace_printStack(FILE* dest)
{ {
int i = cur_thread->current_depth - 1; int i = cur_thread->current_depth - 1;
fprintf(file, "=========== Start of stack trace for thread %lu ==========\n", cur_thread->id); fprintf(file, "=========== Start of stack trace for thread %lu ==========\n", (unsigned long)cur_thread->id);
if (i >= 0) if (i >= 0)
{ {
fprintf(file, "%s (%d)\n", cur_thread->callstack[i].name, cur_thread->callstack[i].line); fprintf(file, "%s (%d)\n", cur_thread->callstack[i].name, cur_thread->callstack[i].line);
while (--i >= 0) while (--i >= 0)
fprintf(file, " at %s (%d)\n", cur_thread->callstack[i].name, cur_thread->callstack[i].line); fprintf(file, " at %s (%d)\n", cur_thread->callstack[i].name, cur_thread->callstack[i].line);
} }
fprintf(file, "=========== End of stack trace for thread %lu ==========\n\n", cur_thread->id); fprintf(file, "=========== End of stack trace for thread %lu ==========\n\n", (unsigned long)cur_thread->id);
} }
} }
if (file != stdout && file != stderr && file != NULL) if (file != stdout && file != stderr && file != NULL)
...@@ -167,7 +167,7 @@ void StackTrace_printStack(FILE* dest) ...@@ -167,7 +167,7 @@ void StackTrace_printStack(FILE* dest)
} }
char* StackTrace_get(unsigned long threadid) char* StackTrace_get(thread_id_type threadid)
{ {
int bufsize = 256; int bufsize = 256;
char* buf = NULL; char* buf = NULL;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <stdio.h> #include <stdio.h>
#include "Log.h" #include "Log.h"
#include "Thread.h"
#if defined(NOSTACKTRACE) #if defined(NOSTACKTRACE)
#define FUNC_ENTRY #define FUNC_ENTRY
...@@ -65,6 +66,6 @@ void StackTrace_entry(const char* name, int line, int trace); ...@@ -65,6 +66,6 @@ void StackTrace_entry(const char* name, int line, int trace);
void StackTrace_exit(const char* name, int line, void* return_value, int trace); void StackTrace_exit(const char* name, int line, void* return_value, int trace);
void StackTrace_printStack(FILE* dest); void StackTrace_printStack(FILE* dest);
char* StackTrace_get(unsigned long); char* StackTrace_get(thread_id_type);
#endif /* STACKTRACE_H_ */ #endif /* STACKTRACE_H_ */
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
#include "string.h" #include "string.h"
#include "MQTTAsync.h" #include "MQTTAsync.h"
#if !defined(WIN32)
#include <unistd.h>
#endif
#define ADDRESS "tcp://m2m.eclipse.org:1883" #define ADDRESS "tcp://m2m.eclipse.org:1883"
#define CLIENTID "ExampleClientPub" #define CLIENTID "ExampleClientPub"
#define TOPIC "MQTT Examples" #define TOPIC "MQTT Examples"
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
#include "string.h" #include "string.h"
#include "MQTTAsync.h" #include "MQTTAsync.h"
#if !defined(WIN32)
#include <unistd.h>
#endif
#define ADDRESS "tcp://localhost:1883" #define ADDRESS "tcp://localhost:1883"
#define CLIENTID "ExampleClientSub" #define CLIENTID "ExampleClientSub"
#define TOPIC "MQTT Examples" #define TOPIC "MQTT Examples"
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#else #else
#include <sys/time.h> #include <sys/time.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#endif #endif
......
...@@ -606,7 +606,7 @@ int test3(struct Options options) ...@@ -606,7 +606,7 @@ int test3(struct Options options)
/* authorization failure (RC = 5) */ /* authorization failure (RC = 5) */
opts.username = "Admin"; opts.username = "Admin";
opts.password = "Admin"; opts.password = "Admin";
/*opts.will = &wopts; /* "Admin" not authorized to publish to Will topic by default /*opts.will = &wopts; "Admin" not authorized to publish to Will topic by default
opts.will->message = "will message"; opts.will->message = "will message";
opts.will->qos = 1; opts.will->qos = 1;
opts.will->retained = 0; opts.will->retained = 0;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment