Snap for 6439596 from d42fc3b49cda5c21aee74f0ec7bd06e1bcab8731 to qt-aml-tzdata-release
Change-Id: I97cd22eb46ec571e126ad3bd36929236fe1127a7
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e076dc8..195c780 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,6 @@
option ( coveralls_send "Send data to coveralls site" OFF )
option ( build_docs "Create docs using Doxygen" ${DOXYGEN_FOUND} )
option ( no_floats "Build without floating point support" OFF )
-option ( align_reads "Use memcpy in ntoh*p()" OFF )
set ( dist_dir ${CMAKE_BINARY_DIR}/dist )
set ( prefix ${CMAKE_INSTALL_PREFIX} )
diff --git a/METADATA b/METADATA
index 973907e..14483ca 100644
--- a/METADATA
+++ b/METADATA
@@ -1,5 +1,7 @@
name: "cn-cbor"
-description: "cn-cbor: A constrained node implementation of CBOR in C"
+description:
+ "cn-cbor: A constrained node implementation of CBOR in C"
+
third_party {
url {
type: HOMEPAGE
@@ -9,11 +11,7 @@
type: GIT
value: "https://github.com/cabo/cn-cbor.git"
}
- version: "f1cf9ffdf5cfab935a45900556f9b68af925c256"
+ version: "2f9c3b1931eb012909e74f3b628e6a31fd446ad1"
+ last_upgrade_date { year: 2017 month: 11 day: 8 }
license_type: NOTICE
- last_upgrade_date {
- year: 2019
- month: 2
- day: 1
- }
}
diff --git a/include/cn-cbor/cn-cbor.h b/include/cn-cbor/cn-cbor.h
index 187a55c..bf71af8 100644
--- a/include/cn-cbor/cn-cbor.h
+++ b/include/cn-cbor/cn-cbor.h
@@ -1,4 +1,3 @@
-
/**
* \file
* \brief
@@ -53,8 +52,6 @@
CN_CBOR_SIMPLE,
/** Doubles, floats, and half-floats */
CN_CBOR_DOUBLE,
- /** Floats, and half-floats */
- CN_CBOR_FLOAT,
/** An error has occurred */
CN_CBOR_INVALID
} cn_cbor_type;
@@ -94,8 +91,6 @@
unsigned long uint;
/** CN_CBOR_DOUBLE */
double dbl;
- /** CN_CBOR_FLOAT */
- float f;
/** for use during parsing */
unsigned long count;
} v; /* TBD: optimize immediate */
@@ -329,32 +324,6 @@
CBOR_CONTEXT,
cn_cbor_errback *errp);
-#ifndef CBOR_NO_FLOAT
-/**
- * Create a CBOR float.
- *
- * @param[in] value the value of the float
- * @param[in] CBOR_CONTEXT Allocation context (only if USE_CBOR_CONTEXT is defined)
- * @param[out] errp Error, if NULL is returned
- * @return The created object, or NULL on error
- */
-cn_cbor* cn_cbor_float_create(float value
- CBOR_CONTEXT,
- cn_cbor_errback *errp);
-
-/**
- * Create a CBOR double.
- *
- * @param[in] value the value of the double
- * @param[in] CBOR_CONTEXT Allocation context (only if USE_CBOR_CONTEXT is defined)
- * @param[out] errp Error, if NULL is returned
- * @return The created object, or NULL on error
- */
-cn_cbor* cn_cbor_double_create(double value
- CBOR_CONTEXT,
- cn_cbor_errback *errp);
-#endif /* CBOR_NO_FLOAT */
-
/**
* Put a CBOR object into a map with a CBOR object key. Duplicate checks are NOT
* currently performed.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index babe95c..ceb0608 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,9 +10,6 @@
cn-get.c
)
-if (align_reads)
- add_definitions(-DCBOR_ALIGN_READS)
-endif()
if (use_context)
add_definitions(-DUSE_CBOR_CONTEXT)
endif()
diff --git a/src/cn-cbor.c b/src/cn-cbor.c
index 2526b92..8fadf73 100644
--- a/src/cn-cbor.c
+++ b/src/cn-cbor.c
@@ -49,25 +49,10 @@
}
#endif /* CBOR_NO_FLOAT */
+/* Fix these if you can't do non-aligned reads */
#define ntoh8p(p) (*(unsigned char*)(p))
-
-#ifndef CBOR_ALIGN_READS
#define ntoh16p(p) (ntohs(*(unsigned short*)(p)))
#define ntoh32p(p) (ntohl(*(uint32_t*)(p)))
-#else
-static uint16_t ntoh16p(unsigned char *p) {
- uint16_t tmp;
- memcpy(&tmp, p, sizeof(tmp));
- return ntohs(tmp);
-}
-
-static uint32_t ntoh32p(unsigned char *p) {
- uint32_t tmp;
- memcpy(&tmp, p, sizeof(tmp));
- return ntohl(tmp);
-}
-#endif /* CBOR_ALIGN_READS */
-
static uint64_t ntoh64p(unsigned char *p) {
uint64_t ret = ntoh32p(p);
ret <<= 32;
diff --git a/src/cn-create.c b/src/cn-create.c
index 4ddce3b..bc448e9 100644
--- a/src/cn-create.c
+++ b/src/cn-create.c
@@ -73,34 +73,6 @@
return ret;
}
-#ifndef CBOR_NO_FLOAT
-cn_cbor* cn_cbor_float_create(float value
- CBOR_CONTEXT,
- cn_cbor_errback *errp)
-{
- cn_cbor* ret;
- INIT_CB(ret);
-
- ret->type = CN_CBOR_FLOAT;
- ret->v.f = value;
-
- return ret;
-}
-
-cn_cbor* cn_cbor_double_create(double value
- CBOR_CONTEXT,
- cn_cbor_errback *errp)
-{
- cn_cbor* ret;
- INIT_CB(ret);
-
- ret->type = CN_CBOR_DOUBLE;
- ret->v.dbl = value;
-
- return ret;
-}
-#endif /* CBOR_NO_FLOAT */
-
static bool _append_kv(cn_cbor *cb_map, cn_cbor *key, cn_cbor *val)
{
//Connect key and value and insert them into the map.
diff --git a/src/cn-encoder.c b/src/cn-encoder.c
index d8a4d49..8593b39 100644
--- a/src/cn-encoder.c
+++ b/src/cn-encoder.c
@@ -276,11 +276,6 @@
CHECK(_write_double(ws, cb->v.dbl));
#endif /* CBOR_NO_FLOAT */
break;
- case CN_CBOR_FLOAT:
-#ifndef CBOR_NO_FLOAT
- CHECK(_write_double(ws, cb->v.f));
-#endif /* CBOR_NO_FLOAT */
- break;
case CN_CBOR_INVALID:
ws->offset = -1;
diff --git a/test/cbor_test.c b/test/cbor_test.c
index eafea5d..3326497 100644
--- a/test/cbor_test.c
+++ b/test/cbor_test.c
@@ -327,9 +327,6 @@
cn_cbor *cb_map = cn_cbor_map_create(CONTEXT_NULL_COMMA &err);
cn_cbor *cb_int;
cn_cbor *cb_data;
-#ifndef CBOR_NO_FLOAT
- cn_cbor *cb_dbl;
-#endif
ASSERT_NOT_NULL(cb_map);
ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
@@ -342,12 +339,6 @@
ASSERT_NOT_NULL(cb_data);
ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
-#ifndef CBOR_NO_FLOAT
- cb_dbl = cn_cbor_double_create(3.14159 CONTEXT_NULL, &err);
- ASSERT_NOT_NULL(cb_dbl);
- ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
-#endif
-
cn_cbor_mapput_int(cb_map, 5, cb_int CONTEXT_NULL, &err);
ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
ASSERT_TRUE(cb_map->length == 2);
@@ -369,12 +360,6 @@
ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
ASSERT_TRUE(cb_map->length == 8);
-#ifndef CBOR_NO_FLOAT
- cn_cbor_mapput_int(cb_map, 42, cb_dbl CONTEXT_NULL, &err);
- ASSERT_TRUE(err.err == CN_CBOR_NO_ERROR);
- ASSERT_TRUE(cb_map->length == 10);
-#endif
-
val = cn_cbor_mapget_int(cb_map, 5);
ASSERT_NOT_NULL(val);
ASSERT_TRUE(val->v.sint == 256);
@@ -383,12 +368,6 @@
ASSERT_NOT_NULL(val);
ASSERT_STR(val->v.str, "abc");
-#ifndef CBOR_NO_FLOAT
- val = cn_cbor_mapget_int(cb_map, 42);
- ASSERT_NOT_NULL(val);
- ASSERT_TRUE(val->v.dbl > 3.14 && val->v.dbl < 3.15);
-#endif
-
cn_cbor_free(cb_map CONTEXT_NULL);
}
diff --git a/test/test.c b/test/test.c
index b7d85af..d24992f 100644
--- a/test/test.c
+++ b/test/test.c
@@ -109,7 +109,7 @@
printf("%s at %d\n", err_name[back.err], back.pos);
}
-int main(void) {
+int main() {
char buf[100000];
unsigned char *end;
char *bufend;