Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions MQTTKit/MQTTKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
// Copyright 2012 Nicholas Humfrey. All rights reserved.
//

typedef enum MQTTConnectionReturnCode : NSUInteger {
typedef NS_ENUM(NSUInteger, MQTTConnectionReturnCode) {
ConnectionAccepted,
ConnectionRefusedUnacceptableProtocolVersion,
ConnectionRefusedIdentiferRejected,
ConnectionRefusedServerUnavailable,
ConnectionRefusedBadUserNameOrPassword,
ConnectionRefusedNotAuthorized
} MQTTConnectionReturnCode;
};

typedef enum MQTTQualityOfService : NSUInteger {
typedef NS_ENUM(NSUInteger, MQTTQualityOfService) {
AtMostOnce,
AtLeastOnce,
ExactlyOnce
} MQTTQualityOfService;
};

#pragma mark - MQTT Message

Expand Down
4 changes: 2 additions & 2 deletions MQTTKit/MQTTKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ - (void)setWillData:(NSData *)payload
retain:(BOOL)retain
{
const char* cstrTopic = [willTopic cStringUsingEncoding:NSUTF8StringEncoding];
mosquitto_will_set(mosq, cstrTopic, payload.length, payload.bytes, willQos, retain);
mosquitto_will_set(mosq, cstrTopic, (int)payload.length, payload.bytes, willQos, retain);
}

- (void)setWill:(NSString *)payload
Expand Down Expand Up @@ -303,7 +303,7 @@ - (void)publishData:(NSData *)payload
[self.publishHandlers setObject:completionHandler forKey:[NSNumber numberWithInt:0]];
}
int mid;
mosquitto_publish(mosq, &mid, cstrTopic, payload.length, payload.bytes, qos, retain);
mosquitto_publish(mosq, &mid, cstrTopic, (int)payload.length, payload.bytes, qos, retain);
if (completionHandler) {
if (qos == 0) {
completionHandler(mid);
Expand Down
2 changes: 1 addition & 1 deletion libmosquitto/logging_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int _mosquitto_log_printf(struct mosquitto *mosq, int priority, const char *fmt,
{
va_list va;
char *s;
int len;
size_t len;

assert(mosq);
assert(fmt);
Expand Down
6 changes: 3 additions & 3 deletions libmosquitto/mosquitto.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int mosquitto_lib_init(void)
struct timeval tv;

gettimeofday(&tv, NULL);
srand(tv.tv_sec*1000 + tv.tv_usec/1000);
srand((unsigned int)(tv.tv_sec*1000 + tv.tv_usec/1000));
#endif

_mosquitto_net_init();
Expand Down Expand Up @@ -898,7 +898,7 @@ int mosquitto_loop_forever(struct mosquitto *mosq, int timeout, int max_packets)
#ifdef WIN32
Sleep(reconnect_delay*1000);
#else
sleep(reconnect_delay);
sleep((unsigned int)reconnect_delay);
#endif

pthread_mutex_lock(&mosq->state_mutex);
Expand Down Expand Up @@ -1143,7 +1143,7 @@ const char *mosquitto_connack_string(int connack_code)

int mosquitto_sub_topic_tokenise(const char *subtopic, char ***topics, int *count)
{
int len;
size_t len;
int hier_count = 1;
int start, stop;
int hier;
Expand Down
8 changes: 4 additions & 4 deletions libmosquitto/send_client_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
int _mosquitto_send_connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session)
{
struct _mosquitto_packet *packet = NULL;
int payloadlen;
size_t payloadlen;
uint8_t will = 0;
uint8_t byte;
int rc;
Expand All @@ -72,7 +72,7 @@ int _mosquitto_send_connect(struct mosquitto *mosq, uint16_t keepalive, bool cle
}

packet->command = CONNECT;
packet->remaining_length = 12+payloadlen;
packet->remaining_length = (uint32_t)(12+payloadlen);
rc = _mosquitto_packet_alloc(packet);
if(rc){
_mosquitto_free(packet);
Expand Down Expand Up @@ -152,7 +152,7 @@ int _mosquitto_send_subscribe(struct mosquitto *mosq, int *mid, bool dup, const
packet = _mosquitto_calloc(1, sizeof(struct _mosquitto_packet));
if(!packet) return MOSQ_ERR_NOMEM;

packetlen = 2 + 2+strlen(topic) + 1;
packetlen = 2 + 2+(uint32_t)strlen(topic) + 1;

packet->command = SUBSCRIBE | (dup<<3) | (1<<1);
packet->remaining_length = packetlen;
Expand Down Expand Up @@ -197,7 +197,7 @@ int _mosquitto_send_unsubscribe(struct mosquitto *mosq, int *mid, bool dup, cons
packet = _mosquitto_calloc(1, sizeof(struct _mosquitto_packet));
if(!packet) return MOSQ_ERR_NOMEM;

packetlen = 2 + 2+strlen(topic);
packetlen = 2 + 2+(uint32_t)strlen(topic);

packet->command = UNSUBSCRIBE | (dup<<3) | (1<<1);
packet->remaining_length = packetlen;
Expand Down
4 changes: 2 additions & 2 deletions libmosquitto/send_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ int _mosquitto_send_simple_command(struct mosquitto *mosq, uint8_t command)
int _mosquitto_send_real_publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, int qos, bool retain, bool dup)
{
struct _mosquitto_packet *packet = NULL;
int packetlen;
size_t packetlen;
int rc;

assert(mosq);
Expand All @@ -267,7 +267,7 @@ int _mosquitto_send_real_publish(struct mosquitto *mosq, uint16_t mid, const cha

packet->mid = mid;
packet->command = PUBLISH | ((dup&0x1)<<3) | (qos<<1) | retain;
packet->remaining_length = packetlen;
packet->remaining_length = (uint32_t)packetlen;
rc = _mosquitto_packet_alloc(packet);
if(rc){
_mosquitto_free(packet);
Expand Down
2 changes: 1 addition & 1 deletion libmosquitto/util_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int _mosquitto_topic_wildcard_len_check(const char *str)
int mosquitto_topic_matches_sub(const char *sub, const char *topic, bool *result)
{
char *local_sub, *local_topic;
int slen, tlen;
size_t slen, tlen;
int spos, tpos;
int rc;
bool multilevel_wildcard = false;
Expand Down