Skip to content

Commit

Permalink
Merge pull request #422 from sbertin-telular/warning_fixes
Browse files Browse the repository at this point in the history
Fix a variety of warning
  • Loading branch information
dnav authored Feb 14, 2019
2 parents 8154ff5 + ec6fb12 commit 8662d9f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion core/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void lwm2m_data_encode_nstring(const char * string,
size_t length,
lwm2m_data_t * dataP)
{
LOG_ARG("length: %d, string: \"%s\"", length, string);
LOG_ARG("length: %d, string: \"%.*s\"", length, length, string);
lwm2m_data_encode_opaque((uint8_t *)string, length, dataP);

if (dataP->type == LWM2M_TYPE_OPAQUE)
Expand Down
7 changes: 4 additions & 3 deletions core/liblwm2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ int lwm2m_step(lwm2m_context_t * contextP,
time_t * timeoutP)
{
time_t tv_sec;
int result;

LOG_ARG("timeoutP: %" PRId64, *timeoutP);
tv_sec = lwm2m_gettime();
Expand Down Expand Up @@ -427,10 +426,12 @@ int lwm2m_step(lwm2m_context_t * contextP,
break;
#endif
case STATE_REGISTER_REQUIRED:
result = registration_start(contextP, true);
{
int result = registration_start(contextP, true);
if (COAP_NO_ERROR != result) return result;
contextP->state = STATE_REGISTERING;
break;
}
break;

case STATE_REGISTERING:
{
Expand Down
1 change: 0 additions & 1 deletion examples/bootstrap_server/bootstrap_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ bs_info_t * bs_get_info(FILE * fd)
bs_info_t * infoP;
read_server_t * readSrvP;
bs_endpoint_info_t * cltInfoP;
bs_command_t * cmdP;

infoP = (bs_info_t *)lwm2m_malloc(sizeof(bs_info_t));
if (infoP == NULL) return NULL;
Expand Down
5 changes: 2 additions & 3 deletions examples/bootstrap_server/bootstrap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ static int prv_bootstrap_callback(void * sessionH,
void * userData)
{
internal_data_t * dataP = (internal_data_t *)userData;
uint8_t result;
endpoint_t * endP;

switch (status)
Expand Down Expand Up @@ -407,8 +406,8 @@ static void prv_bootstrap_client(char * buffer,
{
internal_data_t * dataP = (internal_data_t *)user_data;
char * uri;
char * name;
char* end = NULL;
char * name = "";
char * end = NULL;
char * host;
char * port;
connection_t * newConnP = NULL;
Expand Down
2 changes: 2 additions & 0 deletions examples/client/lwm2mclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,9 @@ int main(int argc, char *argv[])
#endif

char * pskId = NULL;
#ifdef WITH_TINYDTLS
char * psk = NULL;
#endif
uint16_t pskLen = -1;
char * pskBuffer = NULL;

Expand Down
2 changes: 1 addition & 1 deletion examples/client/object_access_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static uint8_t prv_write_resources(uint16_t instanceId, int numData,
lwm2m_data_t* tlvArray, lwm2m_object_t* objectP, bool doCreate)
{
int i;
uint8_t result;
uint8_t result = COAP_500_INTERNAL_SERVER_ERROR;
int64_t value;

acc_ctrl_oi_t* accCtrlOiP = (acc_ctrl_oi_t *)
Expand Down
1 change: 0 additions & 1 deletion examples/client/object_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ static uint8_t prv_firmware_write(uint16_t instanceId,
{
int i;
uint8_t result;
firmware_data_t * data = (firmware_data_t*)(objectP->userData);

// this is a single instance object
if (instanceId != 0)
Expand Down
22 changes: 4 additions & 18 deletions examples/client/object_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,15 +767,8 @@ static uint8_t prv_server_write(uint16_t instanceId,
bool value;
if (1 == lwm2m_data_decode_bool(dataArray + i, &value))
{
if (value <= INT_MAX)
{
targetP->registrationFailureBlock = value;
result = COAP_204_CHANGED;
}
else
{
result = COAP_406_NOT_ACCEPTABLE;
}
targetP->registrationFailureBlock = value;
result = COAP_204_CHANGED;
}
else
{
Expand All @@ -789,15 +782,8 @@ static uint8_t prv_server_write(uint16_t instanceId,
bool value;
if (1 == lwm2m_data_decode_bool(dataArray + i, &value))
{
if (value <= INT_MAX)
{
targetP->bootstrapOnRegistrationFailure = value;
result = COAP_204_CHANGED;
}
else
{
result = COAP_406_NOT_ACCEPTABLE;
}
targetP->bootstrapOnRegistrationFailure = value;
result = COAP_204_CHANGED;
}
else
{
Expand Down
4 changes: 1 addition & 3 deletions examples/shared/dtlsconnection.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ char * security_get_uri(lwm2m_object_t * obj, int instanceId, char * uriBuffer,
{
if (bufferSize > dataP->value.asBuffer.length){
memset(uriBuffer,0,dataP->value.asBuffer.length+1);
strncpy(uriBuffer,dataP->value.asBuffer.buffer,dataP->value.asBuffer.length);
strncpy(uriBuffer,(const char *)dataP->value.asBuffer.buffer,dataP->value.asBuffer.length);
lwm2m_data_free(size, dataP);
return uriBuffer;
}
Expand Down Expand Up @@ -234,7 +234,6 @@ static int send_to_peer(struct dtls_context_t *ctx,
session_t *session, uint8 *data, size_t len) {

// find connection
dtls_connection_t * connP = (dtls_connection_t *) ctx->app;
dtls_connection_t* cnx = connection_find((dtls_connection_t *) ctx->app, &(session->addr.st),session->size);
if (cnx != NULL)
{
Expand All @@ -255,7 +254,6 @@ static int read_from_peer(struct dtls_context_t *ctx,
session_t *session, uint8 *data, size_t len) {

// find connection
dtls_connection_t * connP = (dtls_connection_t *) ctx->app;
dtls_connection_t* cnx = connection_find((dtls_connection_t *) ctx->app, &(session->addr.st),session->size);
if (cnx != NULL)
{
Expand Down
1 change: 0 additions & 1 deletion examples/shared/tinydtls.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(TINYDTLS_SOURCES
${TINYDTLS_SOURCES_DIR}/peer.c
${TINYDTLS_SOURCES_DIR}/dtls_time.c
${TINYDTLS_SOURCES_DIR}/session.c
${TINYDTLS_SOURCES_DIR}/sha2/sha2.c
${TINYDTLS_SOURCES_DIR}/aes/rijndael.c
${TINYDTLS_SOURCES_DIR}/sha2/sha2.c
${TINYDTLS_SOURCES_DIR}/ecc/ecc.c)
Expand Down

0 comments on commit 8662d9f

Please sign in to comment.