all warnings fixed

pull/47/head
Benjamin Runnels 9 years ago
parent f90bf5bb30
commit b3408a7022
  1. 3
      mqtt/mqtt_msg.c
  2. 20
      mqtt/utils.c

@ -125,7 +125,8 @@ static mqtt_message_t* ICACHE_FLASH_ATTR fini_message(mqtt_connection_t* connect
void ICACHE_FLASH_ATTR void ICACHE_FLASH_ATTR
mqtt_msg_init(mqtt_connection_t* connection, uint8_t* buffer, uint16_t buffer_length) { mqtt_msg_init(mqtt_connection_t* connection, uint8_t* buffer, uint16_t buffer_length) {
memset(connection, 0, sizeof(connection)); uint8_t len = sizeof(connection);
memset(connection, '\0', len);
connection->buffer = buffer; connection->buffer = buffer;
connection->buffer_length = buffer_length; connection->buffer_length = buffer_length;
} }

@ -32,8 +32,8 @@
*/ */
#include "utils.h" #include "utils.h"
uint8_t ICACHE_FLASH_ATTR
uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str) UTILS_IsIPV4(int8_t *str)
{ {
uint8_t segs = 0; /* Segment count. */ uint8_t segs = 0; /* Segment count. */
uint8_t chcnt = 0; /* Character count within segment. */ uint8_t chcnt = 0; /* Character count within segment. */
@ -83,23 +83,22 @@ uint8_t ICACHE_FLASH_ATTR UTILS_IsIPV4 (int8_t *str)
return 1; return 1;
} }
uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip)
uint8_t ICACHE_FLASH_ATTR
UTILS_StrToIP(const int8_t* str, void *ip)
{ {
/* The count of the number of bytes processed. */ /* The count of the number of bytes processed. */
int i; int i;
/* A pointer to the next digit to process. */ /* A pointer to the next digit to process. */
const char * start;
start = str;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
/* The digit being processed. */ /* The digit being processed. */
char c; char c;
/* The value of this byte. */ /* The value of this byte. */
int n = 0; int n = 0;
while (1) { while (1) {
c = * start; c = *(const char *)str;
start++; (const char *)str++;
if (c >= '0' && c <= '9') { if (c >= '0' && c <= '9') {
n *= 10; n *= 10;
n += c - '0'; n += c - '0';
@ -120,9 +119,10 @@ uint8_t ICACHE_FLASH_ATTR UTILS_StrToIP(const int8_t* str, void *ip)
((uint8_t*)ip)[i] = n; ((uint8_t*)ip)[i] = n;
} }
return 1; return 1;
} }
uint32_t ICACHE_FLASH_ATTR UTILS_Atoh(const int8_t *s)
uint32_t ICACHE_FLASH_ATTR
UTILS_Atoh(const int8_t *s)
{ {
uint32_t value = 0, digit; uint32_t value = 0, digit;
int8_t c; int8_t c;

Loading…
Cancel
Save