OCException's string handling was missing a few items.
ocstack used some creative casting to get a 16 bit value out
of an 8 bit array that could likely result in bad-optimizations
or undefined behavior.
Removed an unused variable.
Change-Id: I9af5d22f450f72d15b793cec57630e8c81f7b5de
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/496
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Sashi Penta <sashi.kumar.penta@intel.com>
#include "logger.h"
#include "ocmalloc.h"
#include "cJSON.h"
+#include "ocmalloc.h"
+
/// Module Name
#include <stdio.h>
ipAddr->addr[1] = b;
ipAddr->addr[2] = c;
ipAddr->addr[3] = d;
- *((uint16_t*)&(ipAddr->addr[4])) = port;
+ ipAddr->addr[4] = (uint8_t)port;
+ ipAddr->addr[5] = (uint8_t)(port >> 8);
return OC_STACK_OK;
}
*/
void insertResource(OCResource *resource)
{
- OCResource *pointer = NULL;
-
if (!headResource) {
headResource = resource;
tailResource = resource;
return OC_STACK_INVALID_PARAM;
}
- *port = *((uint16_t*)&ipAddr->addr[4]);
+ *port = (ipAddr->addr[5]<< 8) | ipAddr->addr[4];
return OC_STACK_OK;
}
static const char INVALID_OBESERVE[] = "Invalid Observe Param";
static const char NO_MEMORY[] = "No Memory";
static const char COMM_ERROR[] = "Communication Error";
+ static const char TIMEOUT[] = "Timeout";
+ static const char ADAPTER_NOT_ENABLED[] = "Adapter Not Enabled";
static const char NOT_IMPL[] = "Not Implemented";
static const char NOT_FOUND[] = "Resource Not Found";
static const char RESOURCE_ERROR[] = "Resource Error";
return OC::Exception::NO_MEMORY;
case OC_STACK_COMM_ERROR:
return OC::Exception::COMM_ERROR;
+ case OC_STACK_TIMEOUT:
+ return OC::Exception::TIMEOUT;
+ case OC_STACK_ADAPTER_NOT_ENABLED:
+ return OC::Exception::ADAPTER_NOT_ENABLED;
case OC_STACK_NOTIMPL:
return OC::Exception::NOT_IMPL;
case OC_STACK_NO_RESOURCE: