mbed.org implementation of the abstract SmartREST library for the Cumulocity Platform SmartREST protocol.

Dependents:   MbedSmartRestMain MbedSmartRestMain

Revision:
11:e1bee9a77652
Parent:
0:099f76422485
--- a/StaticData.cpp	Thu Oct 23 14:41:58 2014 +0200
+++ b/StaticData.cpp	Sat Nov 15 11:21:01 2014 +0100
@@ -30,49 +30,57 @@
 #include <stdlib.h>
 #include <string.h>
 
+
+/*-------------------------------------------------------------------------*/
 StaticData::StaticData(void* buffer, size_t length, bool copy)
 {
-    _alloc = copy;
-    _len = length;
-    if (copy) {
-        _buf = malloc(length);
-        memcpy(_buf, buffer, length);
-    } else {
-        _buf = buffer;
-    }
+	_alloc = copy;
+	_len = length;
+	if (copy)
+	{
+		_buf = malloc(length);
+		memcpy(_buf, buffer, length);
+	}
+	else
+	{
+		_buf = buffer;
+	}
 }
-
+/*-------------------------------------------------------------------------*/
 StaticData::StaticData(const char* string, bool copy)
 {
-    _alloc = copy;
-    if (copy) {
-        _len = strlen(string)*sizeof(char);
-        _buf = malloc(_len);
-        memcpy(_buf, string, _len);
-    } else {
-        _buf = (void*)string;
-        _len = strlen(string)*sizeof(char);
-    }
+	_alloc = copy;
+	if (copy)
+	{
+		_len = strlen(string)*sizeof(char);
+		_buf = malloc(_len);
+		memcpy(_buf, string, _len);
+	}
+	else
+	{
+		_buf = (void*)string;
+		_len = strlen(string)*sizeof(char);
+	}
 }
-
+/*-------------------------------------------------------------------------*/
 StaticData::~StaticData()
 {
-    if (_alloc)
-        free(_buf);
+	if (_alloc)
+		free(_buf);
 }
-
+/*-------------------------------------------------------------------------*/
 size_t StaticData::writeTo(AbstractDataSink& sink) const
 {
-    return sink.write((void*)_buf, _len*sizeof(char));
+	return sink.write((void*)_buf, _len*sizeof(char));
 }
-
+/*-------------------------------------------------------------------------*/
 size_t StaticData::writtenLength() const
 {
-    return _len;
+	return _len;
 }
-
+/*-------------------------------------------------------------------------*/
 DataGenerator* StaticData::copy() const
 {
-    return new StaticData(_buf, _len, true);
+	return new StaticData(_buf, _len, true);
 }
-
+/*-------------------------------------------------------------------------*/